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_.

Header
Authorization: Bearer kb_live_xxxxxxxxxxxxxxxxxxxxxxxx

Keep keys server-side. A revoked key stops working immediately, as does removing API access from the account.

Async flow

  1. Submit a generation request. You receive a job id and the model id. Credits are charged at this point.
  2. Poll the status endpoint with that id until the status is a terminal value. A reasonable interval is 3 seconds.
  3. 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): an https:// URL or a data:image/ URI. Switches to edit mode.
  • aspectRatio (string, optional, default 1:1): one of 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 4:5, 5:4.
Request
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"}'
Response, 202
{
  "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.

Request
curl "https://klingobanana.com/api/v1/images/generations/$ID?model=fal-ai/gemini-3-pro-image-preview" \
  -H "Authorization: Bearer $KB_API_KEY"
Response, processing
{ "id": "rw:...", "status": "processing", "progress": 5 }
Response, completed
{
  "id": "rw:...",
  "status": "completed",
  "images": [{ "url": "https://firebasestorage.googleapis.com/...", "width": 1024, "height": 1280 }]
}
Response, failed (HTTP 410)
{ "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, default 9: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.
Request
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"}'
Response, 200
{
  "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.

Request
curl "https://klingobanana.com/api/v1/status?modelId=fal-ai/nano-banana-2&requestId=$REQUEST_ID" \
  -H "Authorization: Bearer $KB_API_KEY"
Response, processing
{ "status": "processing", "progress": 5, "queuePosition": null }
Response, done
{
  "status": "done",
  "results": [{ "url": "https://firebasestorage.googleapis.com/...", "mediaType": "image", "width": 1024, "height": 1280 }]
}
Response, failed (HTTP 410)
{ "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.

API error responses
StatusMessageWhen
400Invalid request bodyThe body is not valid JSON.
400First validation messageA 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/).
400Unknown model: {id} / Model not available: {id}The model id is not in the catalog, or is not enabled for new generations.
400Could not process reference image. Try re-uploading the image.The reference image could not be read.
400modelId and requestId are required / model query parameter is requiredA polling request is missing its query parameters.
401UnauthorizedNo Authorization header was sent at all.
401Missing or invalid API keyThe key does not start with kb_live_.
401Invalid or revoked API keyThe key is unknown or has been revoked.
402Insufficient creditsThe account balance is lower than the cost of the request. Nothing is generated.
403API access is not enabled for this accountThe account has not been granted API access. Checked on every call.
403ForbiddenThe job id belongs to another account.
404Generation job not found or expiredUnknown or already-consumed job id.
410Job failed (status: failed, error: ...)The generation failed. Credits are refunded automatically.
429Rate limit exceeded / Too many concurrent generations / Daily credit limit reachedThe key exceeded its request rate, concurrency or daily credit cap. Wait for the number of seconds in the Retry-After header, then retry.
502Generation failed: ... / Generation service unavailable for this model. Please try again.The upstream provider rejected or failed the job. Credits are refunded automatically.
503Generation 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:

Credits per request for the v1 images/generations model pair
ModelmodelIdCredits per image
Gemini 3 Profal-ai/gemini-3-pro-image-preview5
Gemini 3 Pro Editfal-ai/gemini-3-pro-image-preview/edit5

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).

Credits per image for models accepted by v1 generate/image
ModelmodelIdCredits per image
FLUX Schnellfal-ai/flux/schnell1
FLUX Kontext Devfal-ai/flux-kontext/dev1
Gemini 3 Profal-ai/gemini-3-pro-image-preview5
Gemini 3 Pro Editfal-ai/gemini-3-pro-image-preview/edit5
Nano Banana 2fal-ai/nano-banana-23
Nano Banana 2 Editfal-ai/nano-banana-2/edit3
SeedDream v4.5fal-ai/bytedance/seedream/v4.5/text-to-image1

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.