Authentication
All requests require a Bearer token in the Authorization header. Generate an API key from your billing dashboard.
Authorization: Bearer kat_live_••••••••••••••••
Base URL
All API calls go to the following base. The path structure mirrors the OpenAI API so existing SDKs require only a one-line change.
https://api.katama.ai/v1
To migrate, set base_url (Python) or baseURL (Node) to the URL above and swap your key.
Endpoints
Chat completions
stream: true. Credits deducted per output token.| Parameter | Type | Description |
|---|---|---|
| model | string | Model ID (see Models section) |
| messages | array | Array of {role, content} objects |
| stream | boolean | Return an SSE stream of token deltas |
| max_tokens | integer | Max tokens in the response (optional) |
| temperature | number | Sampling temperature 0–2 (default 1) |
Image generation
| Parameter | Type | Description |
|---|---|---|
| model | string | flux, gpt-image-1, image-nano-pro |
| prompt | string | Text description of the desired image |
| n | integer | Number of images (1–4) |
| size | string | 1024x1024, 1792x1024, 1024x1792 |
| quality | string | standard or hd |
Video generation
GET /v1/video/generations/{id} for status, or use webhooks.| Parameter | Type | Description |
|---|---|---|
| model | string | kling-2.1-pro, wan-2.1, minimax-video-01 |
| prompt | string | Scene description |
| duration | integer | Length in seconds (5 or 10) |
| image_url | string | Optional image-to-video reference frame |
Models
Katama routes your request to the best-fit provider. Featured models are highlighted in crimson.
Chat
Images
Video
Credit costs
Credits are deducted on each successful generation. 1 credit = €0.01. A hold is placed on submission and released if the job fails.
| Model | Task | Credits | Notes |
|---|---|---|---|
| flux | Image | 3 | Per image |
| gpt-image-1 | Image | 6 | Per image |
| image-nano-pro | Image | 17 | Per image |
| image-gpt-high | Image | 22 | Per image |
| kie-z-image | Image | 3 | Per image |
| kling | Video / second | see /api/models | Async job |
| kling-3-pro | Video / second | see /api/models | Async job |
| seedance | Video / second | see /api/models | Async job |
| seedance-2-fast | Video / second | see /api/models | Async job |
| seedance-2-5 | Video / second | see /api/models | Async job |
Code examples
The Katama API is fully OpenAI-compatible. Swap the base URL and key — your existing code works immediately.
from openai import OpenAI client = OpenAI( api_key="kat_live_••••••••••••••••", base_url="https://api.katama.ai/v1", ) response = client.chat.completions.create( model="auto", messages=[ {"role": "system", "content": "You are a creative director."}, {"role": "user", "content": "Write a tagline for a samurai-themed AI platform."}, ], ) print(response.choices[0].message.content)
import OpenAI from "openai"; const client = new OpenAI({ apiKey: "kat_live_••••••••••••••••", baseURL: "https://api.katama.ai/v1", }); const response = await client.chat.completions.create({ model: "claude-fable", messages: [{ role: "user", content: "Describe Katama in one line." }], stream: true, }); for await (const chunk of response) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); }
curl https://api.katama.ai/v1/chat/completions -H "Authorization: Bearer kat_live_••••••••" -H "Content-Type: application/json" -d '{ "model": "gpt-4o", "messages": [{ "role": "user", "content": "Hello, Katama." }] }'
Image generation
response = client.images.generate(
model="flux-pro-1.1",
prompt="A lone samurai at dawn, cinematic, 4K",
size="1024x1024",
quality="hd",
n=1,
)
print(response.data[0].url) # Signed URL, valid 24 h
Rate limits
Limits are per API key, sliding 60-second window. Exceeding returns 429 with a Retry-After header.
Video generation jobs are limited separately: 5 concurrent jobs per workspace regardless of plan.
Webhooks
Long-running jobs (video, upscale) emit webhook events so you don’t need to poll. Register a URL in the dashboard — we’ll POST to it on state transitions.
Payload shape
{
"event": "generation.succeeded",
"generation_id": "gen_01jxk••••",
"kind": "video",
"output_url": "https://cdn.katama.ai/out/••••.mp4",
"credits_charged": 50,
"created_at": "2025-06-09T12:00:00Z"
}
Events
| Event | Description |
|---|---|
| generation.queued | Job accepted and in queue |
| generation.running | Job is being processed |
| generation.succeeded | Job complete — output_url is set |
| generation.failed | Job failed — no credits charged |
Webhooks are signed with X-Katama-Signature (HMAC-SHA256). Verify against your webhook secret before processing.
Errors
The API uses standard HTTP status codes. Error bodies follow the OpenAI error shape for SDK compatibility.
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request_error | Missing or malformed parameter |
| 401 | authentication_error | Missing or invalid API key |
| 402 | insufficient_credits | Not enough credits to run the job |
| 403 | permission_error | Key lacks permission for this model |
| 404 | not_found | Generation ID not found |
| 429 | rate_limit_error | Too many requests — back off and retry |
| 500 | server_error | Internal error — try again shortly |
{
"error": {
"message": "Insufficient credits. Required: 50, available: 12.",
"type": "insufficient_credits",
"code": 402
}
}