API · MCP · AI agents

Build with the
zfolio API

Generate images and videos across 28+ AI models programmatically. Use the REST API directly or connect through MCP for Claude, Cursor, and other AI tools.

01

Quick start

Three steps to your first generation. Get an API key, make a request, poll for results.

Step 1

Get an API key

Sign in at zfolio.xyz, go to Settings, and create an API key. Keys start with sk_live_ on mainnet.

Max 3 active keys per account. Keys are shown once at creation.

Step 2

Generate

POST to /v1/generate with your prompt, models, and aspect ratio. Returns a generation ID immediately.

Credits are deducted upfront. Cost depends on model and resolution.

Step 3

Poll for results

GET /v1/generate/status?ids=... until results complete. Images finish in 5-30s, videos in 30-180s.

MCP handles polling automatically with exponential backoff.

Generate an imagebash
curl -X POST https://api.zfolio.xyz/v1/generate \
  -H "Authorization: Bearer sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Cyberpunk city at sunset, neon reflections on wet streets",
    "mediaType": "image",
    "models": ["gpt-image-2", "gemini-3-pro-image-preview"],
    "aspectRatio": "16:9",
    "resolution": "2K"
  }'
Responsejson
// 202 Accepted
{
  "generationId": "cm2abc123",
  "cost": 16
}

// Then poll:
// GET /v1/generate/status?ids=cm2abc123
{
  "generations": {
    "cm2abc123": {
      "status": "completed",
      "results": [
        {
          "model": "gpt-image-2",
          "status": "completed",
          "imageUrl": "https://r2.zfolio.xyz/gen/abc.png",
          "cost": 4
        },
        {
          "model": "gemini-3-pro-image-preview",
          "status": "completed",
          "imageUrl": "https://r2.zfolio.xyz/gen/def.png",
          "cost": 12
        }
      ]
    }
  }
}
02

Authentication

All requests require a bearer token. Create API keys from your zfolio dashboard.

Authorization headerhttp
Authorization: Bearer sk_live_<key>

Key format

  • sk_live_ prefix on mainnet
  • sk_test_ prefix on Base Sepolia testnet
  • 64-character Base62 random suffix
  • Hashed on storage, shown once at creation
  • Max 3 active keys per account

Rate limits

TierGenerateBatchPoll
Free5/min25/min50/min
Creator15/min75/min150/min
Pro30/min150/min300/min

Rate-limited responses return 429 with a Retry-After header.

03

MCP server

Connect zfolio to Claude, Cursor, or any MCP-compatible AI tool. The server handles polling, auth, and result formatting.

claude_desktop_config.jsonjson
{
  "mcpServers": {
    "zfolio": {
      "command": "npx",
      "args": ["-y", "@zfolio/mcp"],
      "env": {
        "ZFOLIO_API_KEY": "sk_live_YOUR_KEY"
      }
    }
  }
}

5 tools available

  • generate_imageGenerate images across multiple models
  • generate_videoGenerate videos with duration control
  • get_generationCheck status of a previous generation
  • list_modelsGet available models and capabilities
  • get_balanceCheck credit balance and membership tier

Example prompt

“Generate a cyberpunk portrait using GPT Image 2 and Seedream 4.5 at 16:9, 2K resolution”

04

API reference

Base URL: https://api.zfolio.xyz/v1

POST/v1/generate

Submit a multi-model generation request. Returns immediately with a generation ID. Poll /v1/generate/status for results.

ParamTypeDescription
promptstring1-10,000 characters
mediaType"image" | "video"Generation type
modelsstring[]1-6 model IDs
aspectRatiostringe.g. "1:1", "16:9", "9:16"
resolutionstring"0.5K", "1K", "2K", "4K" (image) or "480p", "720p", "1080p" (video)
durationnumberSeconds. Required for video models.
referenceImageUrlsstring[]Up to 8 uploaded reference images
stylePassIdsstring[]Style pass IDs to apply
templateIdstringPrompt template ID
202 Accepted·400 Invalid input·402 Insufficient credits
GET/v1/generate/status

Poll generation results. Supports batch polling up to 50 IDs.

ParamTypeDescription
idsstringComma-separated generation IDs, max 50

Result statuses

pendingprocessingcompletedfailed
GET/v1/balance

Returns current credit balance and membership tier.

Responsejson
{
  "creditBalance": 2450,
  "membershipTier": "creator"
}

Other endpoints

MethodPathDescription
GET/v1/historyPaginated generation history
GET/v1/transactionsCredit transaction ledger
GET/v1/paymentsPayment history
GET/v1/passesBrowse style passes (paginated, filterable)
POST/v1/passesCreate a style pass
GET/v1/templatesBrowse prompt templates (paginated)
POST/v1/templatesCreate a prompt template
POST/v1/studio/reserveReserve credits for batch workflow
POST/v1/studio/settleSettle reserve, refund unused credits
POST/v1/upload-imageUpload reference image for generation
GET/v1/downloadDownload generation result
GET/v1/profile/analyticsCreator analytics (7d/30d)
GET/v1/profile/earningsRoyalty earnings summary
GET/v1/workflowsList saved Studio workflows
POST/v1/workflowsSave a workflow
POST/v1/api-keysCreate a new API key
GET/v1/api-keysList your API keys (prefixes only)
DELETE/v1/api-keys/:idRevoke an API key
05

Models

12 image models and 15 video models. Use list_models via MCP or browse below.

Image models

ModelIDCost
GPT Image 2gpt-image-22-6 cr
Imagen 4.0imagen-4.0-apimart12 cr
Nano Banana Progemini-3-pro-image-preview12-15 cr
Nano Banana 2gemini-3.1-flash-image-preview9-18 cr
Seedream 4.5doubao-seedream-4.58 cr
Seedream 5 Litedoubao-seedream-5-0-lite8 cr
Grok Imaginegrok-imagine-1.0-apimart5 cr
Qwen Image 2qwen-image-2.06 cr
Wan 2.7wan2.7-image7 cr
Nano Bananagemini-2.5-flash-image-preview4 cr
Z-Image Turboz-image-turbo3 cr
Seedream 4.0doubao-seedance-4-06 cr

Video models

ModelIDCost
VEO3 Qualityveo3.1-quality180 (8s) cr
VEO3 Fastveo3.1-fast24 (8s) cr
Sora 2sora-2-preview8 (any) cr
Kling v3kling-v3101-303 cr
Kling O1kling-video-o1101-202 cr
Seedance 2.0doubao-seedance-2.0109-327 cr
Hailuo 02minimax-hailuo-0230 cr
Wan 2.7wan2.7100-299 cr
Vidu Q3 Providuq3-pro144-576 cr
SkyReels V4skyreels-v4-fast132-396 cr
Grok Videogrok-imagine-1.0-video-apimart13-21 cr
Kling 2.6kling-v2-656-111 cr
Seedance 1.5doubao-seedance-1-5-pro66-132 cr
Wan 2.5wan2.5-preview100-200 cr
Vidu Q3 Turboviduq3-turbo58-231 cr
VEO3 Liteveo3.1-lite12 (8s) cr
06

Errors & status codes

All errors return a JSON object with an error field containing a human-readable message.

Error responsejson
{
  "error": "Insufficient credits. Need 24, have 12."
}
CodeMeaning
200Success
201Created
202Accepted (generation queued)
400Invalid input
401Missing or invalid API key
402Insufficient credits
404Not found
429Rate limited (check Retry-After header)
500Server error
07

Credits & pricing

1 credit = $0.01 USD. Buy credits at zfolio.xyz/pricing.

Starter1,000credits
$8
Creator3,000credits
$24
Pro6,000credits
$40

Payments settle on Base via x402 (USDC). No cards, no chargebacks.