API Reference

Katama API
OpenAI-compatible.

Drop-in compatible with any OpenAI SDK. Change the base URL, keep your code. Chat, images, video and more — all credit-billed.

v1 REST · JSON Bearer token OpenAI-compatible

Authentication


All requests require a Bearer token in the Authorization header. Generate an API key from your billing dashboard.

HTTP HEADER
Authorization: Bearer kat_live_••••••••••••••••
Keep your API key secret — never expose it in client-side code or public repos. Use environment variables or a secrets manager.

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.

BASE URL
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

POST/v1/chat/completions
Generate a chat completion. Supports streaming via stream: true. Credits deducted per output token.
ParameterTypeDescription
modelstringModel ID (see Models section)
messagesarrayArray of {role, content} objects
streambooleanReturn an SSE stream of token deltas
max_tokensintegerMax tokens in the response (optional)
temperaturenumberSampling temperature 0–2 (default 1)

Image generation

POST/v1/images/generations
Generate images from a text prompt. Returns signed URLs valid for 24 h. Credits deducted per image based on quality.
ParameterTypeDescription
modelstringflux, gpt-image-1, image-nano-pro
promptstringText description of the desired image
nintegerNumber of images (1–4)
sizestring1024x1024, 1792x1024, 1024x1792
qualitystringstandard or hd

Video generation

POST/v1/video/generations
Kick off an async video generation job. Poll GET /v1/video/generations/{id} for status, or use webhooks.
GET/v1/video/generations/{id}
Retrieve the status and output URL of a video generation job.
ParameterTypeDescription
modelstringkling-2.1-pro, wan-2.1, minimax-video-01
promptstringScene description
durationintegerLength in seconds (5 or 10)
image_urlstringOptional image-to-video reference frame

Models


Katama routes your request to the best-fit provider. Featured models are highlighted in crimson.

Chat

autoclaude-fableclaude-opusclaude-sonnetclaude-haikudeepseek-v4-flashkimi-k2glm-5.1llama-3.3deepseek-v4-progemini-progpt-5.5minimaxgrok-4.3

Images

fluxgpt-image-1image-nano-proimage-gpt-highkie-z-imageimage-nano-banana-2image-nano-bananaimage-flux-ultraimage-flux-devimage-recraft-v3image-ideogram-v2image-qwenimage-seedream-3kie-seedream-4

Video

klingkling-3-proseedanceseedance-2-fastseedance-2-5seedance-litewan-2.6veo-3-fastveo31hailuoltxsora-2kie-wan-2-5kie-hailuo-02kie-seedance-2kie-seedance-2-fastkie-seedance-2-minikie-seedance-litekling-25-turbokie-kling-3-turbokie-wan-2-6

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.

ModelTaskCreditsNotes
fluxImage3Per image
gpt-image-1Image6Per image
image-nano-proImage17Per image
image-gpt-highImage22Per image
kie-z-imageImage3Per image
klingVideo / secondsee /api/modelsAsync job
kling-3-proVideo / secondsee /api/modelsAsync job
seedanceVideo / secondsee /api/modelsAsync job
seedance-2-fastVideo / secondsee /api/modelsAsync job
seedance-2-5Video / secondsee /api/modelsAsync job
💡 Subscription plans include monthly credit grants at a better effective rate. View plans →

Code examples


The Katama API is fully OpenAI-compatible. Swap the base URL and key — your existing code works immediately.

PYTHON
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)
NODE.JS
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
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

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

Free
20
req / min
Rōnin
60
req / min
Shinobi
200
req / min
Samurai
600
req / min

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

JSON
{
  "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

EventDescription
generation.queuedJob accepted and in queue
generation.runningJob is being processed
generation.succeededJob complete — output_url is set
generation.failedJob 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.

StatusCodeMeaning
400invalid_request_errorMissing or malformed parameter
401authentication_errorMissing or invalid API key
402insufficient_creditsNot enough credits to run the job
403permission_errorKey lacks permission for this model
404not_foundGeneration ID not found
429rate_limit_errorToo many requests — back off and retry
500server_errorInternal error — try again shortly
ERROR RESPONSE
{
  "error": {
    "message": "Insufficient credits. Required: 50, available: 12.",
    "type": "insufficient_credits",
    "code": 402
  }
}