8gifs agent api

8gifs API and MCP docs

Turn anything into a looping pixel-art GIF: a text brief, a tweet, an X profile, a YouTube video (with a ?t= timestamp), a photo, or any website. The AI director plans the motion, an image model draws the sprite sheet, and the server keys/slices/aligns and encodes a looping GIF.

Three surfaces, one pipeline

Every surface runs the same shared pipeline (classify source → AI director → sprite-sheet generation → server-side keying/slicing/alignment → GIF encoding). Pick by who is calling:

POST /api/agent/*platform edge agent tokenAutomatio agents on this platform
POST /api/v1/*8gifs API key (kg_...)any external agent or script
POST /api/mcpopen discovery; API key for tool callsMCP clients (Claude, ChatGPT, Cursor, ...)

Error convention: every REST endpoint answers HTTP 200 and carries the real outcome in the ok field of the JSON body (ok: false plus an error message on failure). Proxies rewrite 5xx bodies into HTML error pages, so a non-2xx status is never a reliable signal - always read the JSON body.

Auth & tiers

External callers request an API key from the site admin (minted via POST /api/admin/keys, admin session required). The plaintext key is shown ONCE; only its SHA-256 hash is stored.

headerAuthorization: Bearer kg_... or x-api-key: kg_...
free tier20 generations/day, 6/hour per key
free capswatermark forced ON, grid capped at 4x4
over quotaok: false with a 429-style message in-band plus a quota block
read-only endpoints/api/v1/presets verifies the key but never consumes quota

REST API: POST /api/v1/animate

The full home-page pipeline in one call. Same code as the composer UI./api/agent/animate is the same handler on the platform-token surface (it does not archive - the caller decides what belongs in the gallery).

subjecttext brief, e.g. "a grumpy cat with a permanent scowl" - OR inputUrl, one of the two is required
inputUrltweet URL, X profile URL/handle, YouTube (...?t=90), image URL, or any website URL. Auto-classified.
presetmotion preset name from GET /api/v1/presets, e.g. "tail wag"
promptfree-form motion steer; wins over preset
cols / rowssprite grid, default 4x4 (16 frames). Free tier caps at 4x4, paid up to 6x6
keepBackgroundkeep the painted scene (tweet/website sources default true)
watermarkstamp the 8gifs.com chip. Default true; paid tiers may disable
delayMsframe delay. Default 100
archivev1 only, default true: archive gif+sheet and return slug + pageUrl. false = raw bytes only
curl -X POST https://8gifs.com/api/v1/animate \
  -H "Authorization: Bearer kg_..." \
  -H "content-type: application/json" \
  -d '{ "inputUrl": "https://x.com/user/status/123", "preset": "tail wag" }'

Response (abridged):

{
  "ok": true,
  "gifBase64": "R0lGODlh...",
  "sheetBase64": "iVBORw0...",
  "sheetUrl": "https://.../sheet.png",
  "slug": "calm-amber-fox-3kq",
  "pageUrl": "https://8gifs.com/g/calm-amber-fox-3kq",
  "meta": { "frames": 16, "cols": 4, "rows": 4, "cellW": 208, "cellH": 208 },
  "model": "openai/gpt-image-2.5-flare",
  "quota": { "used": 1, "limit": 20, "tier": "free" }
}

GET /api/v1/presets

Keyed, read-only (no quota). The full motion-preset catalog with categories. Pass presets[i].name as preset to animate.

curl https://8gifs.com/api/v1/presets -H "x-api-key: kg_..."
-> { "ok": true, "count": 171, "presets": [ { "name": "moonwalk", "category": "iconic dances", "prompt": "..." }, ... ] }

GET /api/agent/describe

Read-only. Photo URL in, character brief out - the brief feeds straight back into sheet or animate as subject.

curl "https://8gifs.com/api/agent/describe?imageUrl=https://example.com/me.jpg"
-> { "ok": true, "description": "Short dark brown hair ... bomber jacket ..." }

POST /api/agent/sheet

Draws a sprite sheet or portrait from a text brief - no animation. For callers who slice the sheet themselves.

characterrequired, minimum 8 characters
style"sheet" (default) or "portrait"
aspectRatiodefault "1:1"
promptfull prompt override, skips the built-in template

Archive & gallery

POST /api/gifsmultipart gif, sheet, photo, meta, slug, replace - the gallery archive. Returns { ok: true, slug } naming the /g/[slug] share page
GET /api/gifs?limit=12recent gallery rows, keyset pagination via before=
GET /api/gifs/[slug]one gif's generation context - the data the remix flow reuses
GET /api/presetsunauthenticated preset list + archived example gifs per preset (used by the composer hover previews)

MCP server: POST /api/mcp

Stateless JSON-RPC 2.0 MCP server (streamable-HTTP-compatible: initialize → tools/list → tools/call, no session state). Point any MCP client at https://8gifs.com/api/mcp.initialize and tools/list are open; tools/call requires an API key (auth failures come back as JSON-RPC errors, code -32001).

animate_gifsubject or inputUrl (tweet/X/YouTube/image/website), optional preset, prompt, cols, rows, keepBackground, delayMs. Archives and returns the /g/<slug> share page URL
list_presetsthe 171-preset catalog with categories
describe_imageimageUrl - photo to character brief

x402 payments (no account, per-call)

POST /api/v1/animate accepts two ways in: an API key (free tier above) or an x402 payment - call without a key and the endpoint replies 402 Payment Required with a PAYMENT-REQUIRED header (Base64 JSON: price, USDC asset, network, receiving wallet). The client signs an EIP-3009 transferWithAuthorization, retries with PAYMENT-SIGNATURE, and the server verifies + settles AFTER the generation succeeds - a failed generation is never charged. Paid callers get FULL caps: grids up to 6x6, watermark optional.

price$0.05 per generation (X402_PRICE_USD)
networkbase - real mainnet USDC (X402_NETWORK)
facilitatorv2.facilitator.mogami.tech on mainnet (free, no account). x402.org facilitator is testnet-only
payer needsUSDC on Base and nothing else - the facilitator covers gas, USDC-only wallets work
disableX402_ENABLED=0 keeps the API-key path only

Remix

Every /g/[slug] page carries a remix this button. It opens the composer at /?remix=<slug>with the gif's character brief, grid and background setting already loaded, and its source image attached (the original photo when archived, otherwise the first frame of the sheet). The remixer adds their own motion and generates - the new gif carries meta.remixOf pointing at the parent, shown as one-level attribution on the page.

Roadmap (not yet live)

  • Paid API-key tiers: register + prepaid balance. The plumbing (tier field, caps in the pipeline) is already wired.
  • x402 on the MCP server: animate_gif currently requires a key; the same 402 gate can wrap tools/call once agent-side MCP clients ship built-in wallets.

Machine-readable version of this document lives in the repo: API.md. Questions - @kinder_grinder.

AutomatioBuilt with