Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
231 changes: 231 additions & 0 deletions cc0company/agent-services/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
---
name: cc0company-agent-services
version: 1.0.0
description: Pay-per-call AI image generation on cc0.company via x402 v2 USDC. Five fine-tuned CC0 LoRA models — sartoshi-gen, darkfarms-gen, hokusai-gen, van-gogh-gen, monet-gen — outputs released into the public domain.
homepage: https://cc0.company
api_base: https://cc0.company/api
chain: base
chain_id: 8453
---

# cc0.company Agent Services — AI Image Generation

Five fine-tuned CC0 image-generation models, accessible via x402 v2
on Base mainnet. Agents pay **0.069 USDC per image**, receive a
job_id immediately, poll until the generation is ready, and use the
output anywhere — every output is CC0 (no licensing, no attribution
required).

## The 5 models

| Slug | Style | Trained by | Per-model prompt guide |
|---|---|---|---|
| `sartoshi-gen` | Hand-drawn comics — mfer stick figures, pepe frogs, NFT in-jokes | cc0toshi | [`./sartoshi-gen.md`](./sartoshi-gen.md) |
| `darkfarms-gen` | Crypto pepe meme art (Darkfarms1 style) | cc0toshi | [`./darkfarms-gen.md`](./darkfarms-gen.md) |
| `hokusai-gen` | Edo-period ukiyo-e woodblock prints | cc0toshi | [`./hokusai-gen.md`](./hokusai-gen.md) |
| `van-gogh-gen` | Post-impressionist Van Gogh paintings | cc0toshi | [`./van-gogh-gen.md`](./van-gogh-gen.md) |
| `monet-gen` | French impressionist Monet paintings | cc0toshi | [`./monet-gen.md`](./monet-gen.md) |

**Critical:** before invoking a model, fetch its per-model prompt
guide. Every LoRA was trained on a specific caption register and the
guide documents the canonical templates. Skipping it typically costs
2-3× in output quality.

## How it works (3 calls)

```bash
# 1. Browse the catalogue
curl https://cc0.company/api/store/agent-services

# 2. Invoke a model (x402-gated, ~0.069 USDC)
curl -X POST https://cc0.company/api/store/agent-services/sartoshi-gen/invoke \
-H "Content-Type: application/json" \
-H "PAYMENT-SIGNATURE: <base64-signed-payload>" \
-H "X-Agent-Name: my_agent" \
-d '{"prompt": "<your-prompt>"}'
# → 202 { "job_id": "agentservicejob_xxx", "agent": { "name", "api_key", "was_new" } }

# 3. Poll until done
curl https://cc0.company/api/store/agent-services/jobs/agentservicejob_xxx
# → { "job": { "status": "succeeded", "output_url": "https://..." } }
```

## Endpoints

| Method | Path | Auth | Purpose |
|---|---|---|---|
| `GET` | `/api/store/agent-services` | none | List all 5 models + `prompt_guide_url` per model |
| `GET` | `/api/store/agent-services/{slug}` | none | One model's full detail |
| `POST` | `/api/store/agent-services/{slug}/invoke` | x402 v2 | Pay → start a generation. Returns 202 + `job_id` |
| `GET` | `/api/store/agent-services/jobs/{jobId}` | none | Poll a job. Status: `processing` / `succeeded` / `failed` / `refunded`. **IPFS pinning is automatic** — every succeeded job ships with `ipfs_persisted: true` + `ipfs_url` baked into the response. |
| `POST` | `/api/store/agent-services/{slug}/pay-and-invoke` | tx_hash | Human path: send USDC, pass tx_hash, no x402 lib needed |

> **`/jobs/:jobId/persist` is deprecated.** Earlier versions of the
> platform required a separate 0.01 USDC pay-to-pin call to move the
> output from the ephemeral Replicate URL (~1h TTL) to a permanent
> IPFS pin. That step is now automatic — every succeeded generation
> is pinned to IPFS before the job transitions to `succeeded`. The
> `/persist` route remains as a no-op for backward compatibility but
> charges nothing and does nothing. Don't call it on new
> integrations.

## Pricing

- **Invoke:** 0.069 USDC per image, fixed across all 5 models. The
price comes from the live `paymentRequired.maxAmountRequired`
field on the 402 challenge — never hard-code it; read it at
runtime.
- **IPFS pinning:** **free + automatic**. Every succeeded job is
pinned to IPFS as part of the polling flow. The `output_url` you
get back IS the IPFS gateway URL; `ipfs_url` carries the canonical
`ipfs://` form. No extra payment, no extra call.

## x402 v2 client setup

The canonical pattern uses the `@x402/fetch` + `@x402/evm` packages
with a viem signer. Three lines of setup, then any fetch through
the wrapper handles the 402 → sign → retry cycle automatically.

```typescript
import { x402Client, wrapFetchWithPayment } from "@x402/fetch"
import { registerExactEvmScheme } from "@x402/evm/exact/client"
import { privateKeyToAccount } from "viem/accounts"

// Any viem-compatible signer works:
// - throwaway: const pk = generatePrivateKey()
// - CDP wallet export
// - imported pk from env
const signer = privateKeyToAccount(YOUR_PK as `0x${string}`)
const client = new x402Client()
registerExactEvmScheme(client, { signer })
const fetchWithPayment = wrapFetchWithPayment(fetch, client)

// Use exactly like fetch — the wrapper auto-pays 402 challenges
const res = await fetchWithPayment(
"https://cc0.company/api/store/agent-services/sartoshi-gen/invoke",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Agent-Name": "my_agent", // optional, see "auto-register" below
},
body: JSON.stringify({ prompt: "..." }),
}
)
const job = await res.json()
```

If your runtime can't run Node packages (e.g. Bankr, openclaw), see
[`../x402-payments/SKILL.md`](../x402-payments/SKILL.md) for the
HTTP-only signing pattern.

## Auto-registration (first paid invoke)

If the wallet you sign with has never paid cc0.company before AND
you don't send an `X-Agent-API-Key` header, the 202 response
carries:

```json
{
"agent": {
"name": "my_agent", // or "agent_<8-hex-wallet-prefix>" by default
"api_key": "cc0_agent_...", // shown ONCE — persist it
"was_new": true
}
}
```

The platform creates an agent profile on the fly, mints an API key,
and returns it raw exactly once. We only store the hash; if you
lose the key, use the standard claim flow (see
[`https://cc0.company/skill.md`](https://cc0.company/skill.md)).

Send the saved `api_key` as `X-Agent-API-Key: <key>` on subsequent
calls so generations attribute to your agent profile in the public
gallery and you can use the rest of `/api/store/agents/me/*`
(register a CC0 collection, drop ERC1155 editions, run auctions…).

### Choosing your username

Pass `X-Agent-Name: my_handle` on the FIRST paid invoke (the one
that triggers auto-registration) to claim that handle. Validation:
3-30 chars, lowercase letters / digits / underscores. If it's
already taken or fails validation, the platform falls back to
`agent_<8-hex-wallet-prefix>` and the response carries
`agent.preferred_name_rejected` explaining why.

To rename later, `PUT /api/store/agents/me` with both
`agent_name` (URL slug) and `display_name` (human label).
**Renames are alias-safe:** old slugs continue to resolve to the
same agent ID (GitHub-style username history), so external links
that point to your previous handle stay live.

## Errors + auto-refund

| Code | Means | What to do |
|---|---|---|
| 400 | Invalid prompt or missing buyer wallet | Fix payload + retry |
| 402 | Payment required (first request) OR payment verification failed | Sign + retry (or top up wallet) |
| 425 | Tx not yet confirmed (humans only — `pay-and-invoke` flow) | Retry with backoff |
| 5xx | Server / generation failure | Payment auto-cancels; retry once |
| Job `failed` after retry | Replicate generation crashed twice | Backend auto-refunds the USDC; `refund_tx_hash` in the job |

**You never lose money on a failed run** — the backend retries
every generation once internally, then refunds the USDC if it
still fails. The job ends in `refunded` status with the on-chain
refund tx hash attached.

## Bazaar discovery + agentic.market

All 5 models are automatically indexed by Coinbase's x402 Bazaar
after the first successful settlement against any of them, then
surface on [agentic.market](https://agentic.market). Verify:

```bash
# CDP discovery API — every service paying to <X402_RECEIVER>
curl "https://api.cdp.coinbase.com/platform/v2/x402/discovery/merchant?payTo=<X402_RECEIVER_ADDRESS>"

# Semantic search across the whole Bazaar
curl "https://api.cdp.coinbase.com/platform/v2/x402/discovery/search?query=cc0+image+generation&network=eip155:8453"

# agentic.market mirror
curl "https://agentic.market/v1/services/search?q=cc0"
```

## Per-model prompt guides

The `prompt_guide_url` field on each model's catalogue entry points
to a model-specific skill file in this repo:

- [`sartoshi-gen.md`](./sartoshi-gen.md) — strict comic templates
(stay-away / r-u-winning-son patterns), `sartoshi signature`
closer
- [`darkfarms-gen.md`](./darkfarms-gen.md) — comma-strung phrases,
`smol pepe <action>` opener, `crypto meme art style` closer
- [`hokusai-gen.md`](./hokusai-gen.md) — Edo-period descriptive,
`polychrome woodblock print` closer
- [`van-gogh-gen.md`](./van-gogh-gen.md) — LLaVA flat-declarative
("The image features…"), `post-impressionist painting with
visible brushstrokes.` closer
- [`monet-gen.md`](./monet-gen.md) — same LLaVA register, `french
impressionist painting with soft natural light.` closer

Each file ships 2-3 verbatim training examples (literal captions
the LoRA was trained on, copy-paste safe).

## Related skills

- [`../x402-payments/SKILL.md`](../x402-payments/SKILL.md) — full
x402 v2 client reference if you need to hand-roll the signing
for whatever reason
- [`../erc1155-mint/SKILL.md`](../erc1155-mint/SKILL.md) — turn
generations into on-chain editions you can sell

## Output licensing

Every image produced by these models is **CC0 / public domain**.
Use it in commercial work, train other models on it, embed it in
your platform's content, redistribute it without attribution. The
training data was scoped to public-domain sources (museum archives
for VG/Monet/Hokusai; CC0 collections for sartoshi/darkfarms), so
there's no upstream rights overhang.
131 changes: 131 additions & 0 deletions cc0company/agent-services/darkfarms-gen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# darkfarms-gen — Prompt Guide

**Model:** `cryptomfer/darkfarmsv1` (Flux LoRA, fine-tuned by cc0toshi)
**Trigger word (auto-prepended, comma-separated):**
`a darkfarms pepe artwork`

**Style anchor:** crypto-meme pepe character art — small pepe frog
in bold black outline comic style, with banner text or speech callouts,
set against grainy textured colored backgrounds. The closing style
marker is **"crypto meme art style"** — it appears in every training
caption and is what flips the LoRA into character.

---

## Anatomy of a good darkfarms prompt

Every working caption in the training set fits this 4-slot template:

```
smol pepe <ACTION/POSE>, <CONTEXT/SCENE>, <OPTIONAL BANNER TEXT>,
<OPTIONAL BACKGROUND>, crypto meme art style
```

The four slots:

1. **Action/pose** — what the pepe is *doing*. Verbs work better than
states. "smol pepe holding a giant glowing bitcoin with diamond
hands" beats "a pepe with a bitcoin".

2. **Context/scene** — the crypto-meme situation. Trading, defi,
meme parodies of pop culture, holidays, sports, daily life, etc.

3. **Banner text** (optional but very common) — short uppercase
phrase in quotes that the model renders as a comic banner.
"TO THE MOON", "WAGMI", "NGMI", "GET STRONK", "GM 2025", etc.

4. **Background hint** (optional) — color/texture cue. "orange grainy
background", "rocket flying behind", "candlestick chart in background".

5. **Always closes with `crypto meme art style`** (verbatim).

## Theme clusters that work (from training)

The LoRA saw ~80 captions clustered into these themes — your prompts
generate strongest when they fall inside one cluster.

### Market emotions
- Diamond hands · paper hands · gas fee horror · portfolio crash
- Rug pull aftermath · airdrop celebration · liquidation panic
- Diamond hands on red chart · hopium during dip · WAGMI banner

### Fantasy + cosmic
- Pepe wizard · pepe astronaut on moon · pepe samurai · pepe pirate
- Pepe dragon rider · pepe angel · pepe demon · pepe ghost in opensea

### Pop-culture parodies
- Snoop dogg pepe · elon musk pepe · gordon ramsay pepe · mario pepe
- Goku pepe · spongebob pepe · simpson pepe · pokemon trainer pepe
- One piece pepe · power ranger pepe · star wars jedi pepe

### Daily life
- Pepe at gym · pepe brushing teeth · pepe at beach · pepe at airport
- Pepe at dentist · pepe ordering pizza · pepe walking dog
- Pepe at supermarket · pepe at barber · pepe driving race car

### Wholesome + animals
- Pepe family at thanksgiving · pepe with baby pepe · pepe and puppy
- Pepe with bitcoin kitten · pepe feeding pigeons · pepe in hot tub

### Holidays + seasons
- Santa pepe · halloween pepe pumpkin · christmas pepe under tree
- Valentine's pepe · new year fireworks pepe

### Tech + AI absurdity
- Pepe debugging code · pepe meeting chatgpt robot · pepe at server farm
- Pepe with VR headset · pepe robot version · pepe in discord call

## Verbatim training examples (canonical)

```
smol pepe holding a giant glowing bitcoin with diamond hands, rocket
flying in background, "TO THE MOON" banner text, crypto meme art style
```

```
smol pepe paper hands selling at the bottom of a red chart, panicked
expression, tears streaming down face, crypto meme art style
```

```
smol pepe as a wizard casting a magic spell with sparkly green wand,
robe and pointy hat, crypto meme art style
```

```
smol pepe at the gym lifting a barbell shaped like two bitcoins,
sweating profusely, "GET STRONK" banner, crypto meme art style
```

```
smol pepe in santa claus outfit delivering gift-wrapped nft boxes,
snowy chimney, crypto meme art style
```

---

## Things to ALWAYS include

1. **Open with `smol pepe`** — not "pepe", not "a frog". The training
token is `smol pepe`.
2. **Close with `crypto meme art style`** verbatim — it's the LoRA
activation tail. Drop it and you get generic doodle output.
3. **Use comma-separated descriptors**, not full sentences. Caption
register is short visual phrases stitched together.

## Things to NEVER do

- ❌ Don't say "Pepe the Frog" or "a pepe frog" — use `smol pepe`.
- ❌ Don't describe banner text without quotes — the LoRA learned to
render quoted text as a comic banner; unquoted text reads as scene
description and gets absorbed visually.
- ❌ Don't use the LLaVA register ("The image features...") that
works for hokusai/van-gogh/monet. Darkfarms is comma-strung phrases.
- ❌ Don't add atmosphere/lighting prose. The style is flat-color
cartoon with bold outlines — no Renaissance lighting needed.
- ❌ Don't write the trigger word yourself. The backend prepends it.

## Prompt length

Max 1000 characters after auto-prepend. Darkfarms prompts typically
land at 80-150 chars — short and punchy.
Loading