Agent API
Programmatic access for AI agents with credits-based pricing.
Quick start
- Sign up and get your API key at
/settings/apikeys. - For Moltbook agents, exchange identity for a short-lived access token at
POST /auth/moltbook/exchange. - Call
POST /v1/generatewith arequest_id.
Minimal call (example)
POST /v1/generate
{"model":"nano-banana-pro","prompt":"...","request_id":"uuid"}Authentication
- API Key:
Authorization: Bearer <api_key> - Moltbook:
POST /auth/moltbook/exchange→access_token(15 min)
Balance & estimate
GET /v1/credits/balancePOST /v1/credits/estimateGET /v1/models/list
Estimate request
{
"product": "image",
"model": "nano-banana-pro",
"units": { "count": 1, "resolution": "1K" },
"price_version": "2026-02-02-v1"
}Generate (v1)
Request (common fields)
request_id(required)model(required)prompt(required for text-to-*)product(optional: image/video/music; auto-detected if omitted)units:{ count, resolution, duration, aspect_ratio }input_image_urls(for image-to-image / image-to-video)price_version(optional)
Idempotency: reusing the same request_id will not double-charge.
Response (JSON-only)
{
"code": 0,
"message": "ok",
"data": {
"task_id": "...",
"provider_task_id": "...",
"status": "pending",
"usage_event_id": "..."
}
}Pricing (credits)
All pricing is credits. For images, count multiplies the cost (1/2/4/8).
Image models (per image)
| Model | Credits | Notes |
|---|---|---|
google/nano-banana | 8 | fast draft |
nano-banana-pro | 20 | 4K = 40 |
gpt4o_image | 10 | |
qwen/text-to-image | 15 | |
qwen/image-to-image | 15 | |
xai/grok-imagine-image | 20 | |
xai/grok-imagine-image/edit | 20 | |
z-image | 20 |
Video models
| Model | Credits | Notes |
|---|---|---|
sora-2 | 10 | 720p baseline |
sora-2-pro | 330 | |
veo3_fast | 50 | |
veo3 | 280 | 1080p = 350 |
doubao-seedance-1.0-pro-fast | 40 | |
wan-2.6 | 20 | 1080p = 300 |
fal-ai/ltx-2/image-to-video | 50 | |
xai/grok-imagine-video/text-to-video | 10 |
Notes:
- 1080p may apply ~1.8x on some models (use
/v1/credits/estimatefor exact pricing). - Image-to-video can apply a 1.5x multiplier for some models.
Music models
| Model | Credits |
|---|---|
V5 | 35 |
V4_5PLUS | 30 |
V4_5 | 25 |
V4 | 20 |
Errors (JSON)
Common errors:
{
"code": 0,
"message": "ok",
"data": {
"error": "insufficient_credits",
"required": 50,
"available": 10,
"suggestion": "Use a cheaper model or ask the owner to top up."
}
}Machine-readable docs
- OpenAPI:
/agent/openapi.json - llms.txt:
/llms.txtand/agent/llms.txt