Developers
Klingobanana API
Generate and edit images from your own backend. Authenticate with an API key, submit a job, then read the result.
Overview
Base URL: https://klingobanana.com. All requests and responses are JSON.
An active subscription is required. There is no free tier and no free credits: every request spends credits, and credits come from a subscription plan or a top-up. API access is also enabled per account by our team; contact us to request it. Once enabled, create keys in your account under the API tab (up to 5 active keys).
The API covers images only. Video generation is not available through the API.
Authentication
Send your key as a bearer token in the Authorization header. Keys begin with kb_live_.
Authorization: Bearer kb_live_xxxxxxxxxxxxxxxxxxxxxxxxKeep keys server-side. A revoked key stops working immediately, as does removing API access from the account.
Async flow
- Submit a generation request. You receive a job id and the model id. Credits are charged at this point.
- Poll the status endpoint with that id until the status is a terminal value. A reasonable interval is 3 seconds.
- On success the response contains result URLs. Download them promptly and store your own copies.
Image jobs are produced while the submit request is open, so the submit call can take several seconds and the first poll will usually already return the result.
POST /api/v1/images/generations
Single-image generation or edit with a fixed model pair. Text-to-image by default; pass imageUrl to edit an existing image.
prompt(string, required): 1 to 2000 characters.imageUrl(string, optional): anhttps://URL or adata:image/URI. Switches to edit mode.aspectRatio(string, optional, default1:1): one of 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 4:5, 5:4.
curl -X POST https://klingobanana.com/api/v1/images/generations \
-H "Authorization: Bearer $KB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "A ceramic teapot on a linen cloth, soft window light", "aspectRatio": "4:5"}'{
"id": "rw:0b6f4e0e-5b1c-4c52-9a43-1f0a2f9b7c11",
"model": "fal-ai/gemini-3-pro-image-preview",
"status": "processing"
}GET /api/v1/images/generations/{id}
Poll a job created above. The model query parameter is required: pass back the model value from the submit response.
curl "https://klingobanana.com/api/v1/images/generations/$ID?model=fal-ai/gemini-3-pro-image-preview" \
-H "Authorization: Bearer $KB_API_KEY"{ "id": "rw:...", "status": "processing", "progress": 5 }{
"id": "rw:...",
"status": "completed",
"images": [{ "url": "https://firebasestorage.googleapis.com/...", "width": 1024, "height": 1280 }]
}{ "id": "rw:...", "status": "failed", "error": "..." }POST /api/v1/generate/image
Lower-level image endpoint where you choose the model. Poll with GET /api/v1/status.
prompt(string, required): 1 to 2000 characters.modelId(string, required): a model from the pricing tables below.referenceImageUrl,faceImageUrl(string or null, optional): reference images, used only by models that accept image input.aspectRatio(string, default9:16).numImages(integer 1 to 8, default 1).negativePrompt(string),numInferenceSteps(integer 1 to 100),seed(integer),sizeMultiplier(number 0.5 to 2, default 1): optional tuning fields.
curl -X POST https://klingobanana.com/api/v1/generate/image \
-H "Authorization: Bearer $KB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "Studio portrait, 85mm, shallow depth of field", "modelId": "fal-ai/nano-banana-2", "aspectRatio": "4:5"}'{
"requestId": "rw:0b6f4e0e-5b1c-4c52-9a43-1f0a2f9b7c11",
"modelId": "fal-ai/nano-banana-2"
}GET /api/v1/status
Query parameters modelId and requestId are both required.
curl "https://klingobanana.com/api/v1/status?modelId=fal-ai/nano-banana-2&requestId=$REQUEST_ID" \
-H "Authorization: Bearer $KB_API_KEY"{ "status": "processing", "progress": 5, "queuePosition": null }{
"status": "done",
"results": [{ "url": "https://firebasestorage.googleapis.com/...", "mediaType": "image", "width": 1024, "height": 1280 }]
}{ "status": "failed", "error": "..." }Rate limits
Limits apply per API key. Exceeding any of them returns 429 with a Retry-After header (seconds).
- 30 requests per minute, including status polling.
- 3 concurrent generations in flight at once.
- Daily credit cap (default 500 credits per UTC day).
Errors
Errors return a JSON body of the form { "error": "message" } with the HTTP status below.
| Status | Message | When |
|---|---|---|
| 400 | Invalid request body | The body is not valid JSON. |
| 400 | First validation message | A field fails validation (for example an empty prompt, a prompt over 2000 characters, an unsupported aspectRatio, or an imageUrl that is not https:// or data:image/). |
| 400 | Unknown model: {id} / Model not available: {id} | The model id is not in the catalog, or is not enabled for new generations. |
| 400 | Could not process reference image. Try re-uploading the image. | The reference image could not be read. |
| 400 | modelId and requestId are required / model query parameter is required | A polling request is missing its query parameters. |
| 401 | Unauthorized | No Authorization header was sent at all. |
| 401 | Missing or invalid API key | The key does not start with kb_live_. |
| 401 | Invalid or revoked API key | The key is unknown or has been revoked. |
| 402 | Insufficient credits | The account balance is lower than the cost of the request. Nothing is generated. |
| 403 | API access is not enabled for this account | The account has not been granted API access. Checked on every call. |
| 403 | Forbidden | The job id belongs to another account. |
| 404 | Generation job not found or expired | Unknown or already-consumed job id. |
| 410 | Job failed (status: failed, error: ...) | The generation failed. Credits are refunded automatically. |
| 429 | Rate limit exceeded / Too many concurrent generations / Daily credit limit reached | The key exceeded its request rate, concurrency or daily credit cap. Wait for the number of seconds in the Retry-After header, then retry. |
| 502 | Generation failed: ... / Generation service unavailable for this model. Please try again. | The upstream provider rejected or failed the job. Credits are refunded automatically. |
| 503 | Generation service unavailable for this model. | The model is not currently routable to a provider. |
Pricing
Each request is charged in credits when it is submitted, and refunded automatically if the job fails.
POST /api/v1/images/generations uses a fixed model pair, priced per request:
| Model | modelId | Credits per image |
|---|---|---|
| Gemini 3 Pro | fal-ai/gemini-3-pro-image-preview | 5 |
| Gemini 3 Pro Edit | fal-ai/gemini-3-pro-image-preview/edit | 5 |
POST /api/v1/generate/image accepts any of the models below via modelId. Cost is charged per image, multiplied by numImages (Gemini and GPT image models always produce one image).
| Model | modelId | Credits per image |
|---|---|---|
| FLUX Schnell | fal-ai/flux/schnell | 1 |
| FLUX Kontext Dev | fal-ai/flux-kontext/dev | 1 |
| Gemini 3 Pro | fal-ai/gemini-3-pro-image-preview | 5 |
| Gemini 3 Pro Edit | fal-ai/gemini-3-pro-image-preview/edit | 5 |
| Nano Banana 2 | fal-ai/nano-banana-2 | 3 |
| Nano Banana 2 Edit | fal-ai/nano-banana-2/edit | 3 |
| SeedDream v4.5 | fal-ai/bytedance/seedream/v4.5/text-to-image | 1 |
Credits come from your subscription: starter includes 100 per cycle, pro includes 300 per cycle, business includes 900 per cycle. Top-ups are available in the studio.