Kolbo.AIKolbo.AI Docs
Kolbo Code

API Reference

HTTP reference for the Kolbo Code backend — chat completions, file uploads, credit balance, and model discovery.

Kolbo Code exposes an OpenAI-compatible HTTP API at https://api.kolbo.ai/api/kolbo/v1. You can call it directly with any OpenAI SDK, curl, or your own HTTP client — the Kolbo Code CLI uses exactly these endpoints under the hood.

Authentication

Every protected endpoint accepts either header format:

X-API-Key: kolbo_live_xxxxx

or

Authorization: Bearer kolbo_live_xxxxx

Create an API key at app.kolbo.ai. See Authentication for the full device-code login flow that Kolbo Code uses on your behalf.

Endpoints

MethodPathAuthPurpose
GET/api/kolbo/v1Health probe
GET/api/kolbo/v1/modelsList available chat models and pricing
POST/api/kolbo/v1/chat/completionsOpenAI-compatible chat completion (streaming + sync)
GET/api/kolbo/v1/balanceCheck remaining credit balance
POST/api/kolbo/v1/filesUpload a file for use in chat (images, audio, docs)

GET /api/kolbo/v1/balance

Returns the authenticated user's credit balance. Used by the CLI to display remaining credits before an expensive operation.

Request

curl https://api.kolbo.ai/api/kolbo/v1/balance \
  -H "X-API-Key: kolbo_live_xxxxx"

Response

{
  "available": 8340,
  "reserved": 0,
  "total": 8340
}
FieldTypeDescription
availablenumberCredits you can spend right now
reservednumberCredits currently held by in-flight generations (not yet charged)
totalnumberSum of all credit buckets (plan + credit pack + redemption)

Errors

StatusBodyCause
401{ error: { type: "auth_error", ... } }Missing or invalid API key
500{ error: { type: "server_error", ... } }Subscription service transient

POST /api/kolbo/v1/files

Upload a file for use as an attachment in a subsequent chat/completions call. Returns a file descriptor you reference by id or url in the chat request.

Rate limited separately from chat (60 requests/minute per user).

Request

Multipart form-data with a single field named file:

curl -X POST https://api.kolbo.ai/api/kolbo/v1/files \
  -H "X-API-Key: kolbo_live_xxxxx" \
  -F "file=@./screenshot.png"
FieldTypeRequiredDescription
filefileyesThe file to upload (any MIME type)

Limits

LimitValueNotes
Maximum file size500 MBHard cap — larger files return 413 with a clear error
Rate limit60 req/minPer user, separate from chat rate limit
Retention24 hoursFiles auto-expire from storage after 24h, links stop working

Automatic optimization

The server optimizes certain media types on the way in to keep chat turns fast and storage cheap:

  • Images (image/*) — resized to 8K max dimension, re-encoded as JPEG at 82% quality, capped at 10 MB. PNGs with transparency may be preserved when optimization can't beat the original.
  • Audio (audio/*) — transcoded to MP3 128 kbps / 44.1 kHz.
  • Everything else — uploaded as-is.

The filename and mime_type in the response reflect the final stored file, not the original.

Response

{
  "id": "file_64f8a21c1d2e3f4a5b6c7d8e",
  "object": "file",
  "filename": "screenshot.jpg",
  "bytes": 184320,
  "mime_type": "image/jpeg",
  "url": "https://media.kolbo.ai/kolbo-code/<user_id>/2026-04-11/9f2c3d-screenshot.jpg",
  "created": 1775912345,
  "expires_at": 1775998745,
  "deduplicated": false
}
FieldTypeDescription
idstringStable file handle. Prefix file_ + MongoDB ObjectId.
objectstringAlways "file" (OpenAI-compatible discriminator)
filenamestringFinal filename after optimization
bytesnumberFinal size in bytes
mime_typestringFinal MIME type
urlstringSigned HTTPS URL to fetch the file (valid until expires_at)
creatednumberUnix timestamp (seconds) when the upload completed
expires_atnumberUnix timestamp (seconds) when the file will be deleted
deduplicatedbooleantrue if the server recognized an identical prior upload and returned the existing record instead of storing a duplicate

Errors

StatusBodyCause
400{ error: { type: "validation_error", ... } }Missing file field, bad multipart payload
401{ error: { type: "auth_error", ... } }Missing or invalid API key
413{ error: { type: "validation_error", message: "File too large. Maximum size is 500MB." } }File exceeded 500 MB cap
429{ error: { type: "rate_limit", ... } }Upload rate limit exceeded (60/min)
500{ error: { type: "server_error", ... } }S3 / optimization pipeline failure

Using the file in a chat completion

Pass the url (or the full descriptor) as message content in /chat/completions. Vision-capable models will see the image directly:

{
  "model": "kolbo-cli",
  "messages": [
    {
      "role": "user",
      "content": [
        { "type": "text", "text": "What's in this screenshot?" },
        { "type": "image_url", "image_url": { "url": "https://media.kolbo.ai/kolbo-code/..." } }
      ]
    }
  ]
}

Audio files work the same way via audio_url content parts on audio-capable models.


GET /api/kolbo/v1/models

Lists the chat models available to Kolbo Code with pricing and capability metadata. No authentication required — the CLI uses this to populate its model picker before login.

Response (abbreviated)

{
  "object": "list",
  "data": [
    {
      "id": "kolbo-cli",
      "object": "model",
      "owned_by": "kolbo",
      "pricing": {
        "prompt": "...",
        "completion": "..."
      },
      "context_length": 200000,
      "supports_vision": true
    }
  ]
}

POST /api/kolbo/v1/chat/completions

OpenAI-compatible chat completions endpoint. Supports streaming (stream: true) and synchronous responses. See the OpenAI Chat Completions spec for the full request/response schema — Kolbo Code mirrors it.

Credit deduction happens on the completed request (streaming or not) against the paying user's balance. The amount is based on the chosen model's pricing and the final token usage returned by the provider.

Request

curl https://api.kolbo.ai/api/kolbo/v1/chat/completions \
  -H "X-API-Key: kolbo_live_xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kolbo-cli",
    "messages": [{"role": "user", "content": "Write a haiku about tomatoes"}],
    "stream": false
  }'