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_xxxxxor
Authorization: Bearer kolbo_live_xxxxxCreate an API key at app.kolbo.ai. See Authentication for the full device-code login flow that Kolbo Code uses on your behalf.
Endpoints
| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | /api/kolbo/v1 | — | Health probe |
| GET | /api/kolbo/v1/models | — | List available chat models and pricing |
| POST | /api/kolbo/v1/chat/completions | ✓ | OpenAI-compatible chat completion (streaming + sync) |
| GET | /api/kolbo/v1/balance | ✓ | Check remaining credit balance |
| POST | /api/kolbo/v1/files | ✓ | Upload 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
}| Field | Type | Description |
|---|---|---|
available | number | Credits you can spend right now |
reserved | number | Credits currently held by in-flight generations (not yet charged) |
total | number | Sum of all credit buckets (plan + credit pack + redemption) |
Errors
| Status | Body | Cause |
|---|---|---|
| 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"| Field | Type | Required | Description |
|---|---|---|---|
file | file | yes | The file to upload (any MIME type) |
Limits
| Limit | Value | Notes |
|---|---|---|
| Maximum file size | 500 MB | Hard cap — larger files return 413 with a clear error |
| Rate limit | 60 req/min | Per user, separate from chat rate limit |
| Retention | 24 hours | Files 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
}| Field | Type | Description |
|---|---|---|
id | string | Stable file handle. Prefix file_ + MongoDB ObjectId. |
object | string | Always "file" (OpenAI-compatible discriminator) |
filename | string | Final filename after optimization |
bytes | number | Final size in bytes |
mime_type | string | Final MIME type |
url | string | Signed HTTPS URL to fetch the file (valid until expires_at) |
created | number | Unix timestamp (seconds) when the upload completed |
expires_at | number | Unix timestamp (seconds) when the file will be deleted |
deduplicated | boolean | true if the server recognized an identical prior upload and returned the existing record instead of storing a duplicate |
Errors
| Status | Body | Cause |
|---|---|---|
| 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
}'Related
- Authentication — how to log in with
kolbo auth - Commands — the
kolboCLI command reference