API documentation

Get started

The CLōD API is OpenAI compatible. Any OpenAI client works with this base URL. Send your API key as a Bearer token.

https://api.clod.io/v1
from openai import OpenAI

client = OpenAI(base_url="https://api.clod.io/v1", api_key="YOUR_API_KEY")
reply = client.chat.completions.create(
    model="MODEL_NAME",
    messages=[{"role": "user", "content": "Say hello."}],
)
print(reply.choices[0].message.content)

Use the model ID shown on each model page, such as clod/kimi-k3p1-pro. The full list is on the Models page and in the machine-readable catalog at /models.json.

Compatibility: chat completions, completions, responses, embeddings, images, audio, files and batches use the OpenAI request and response shapes, including streaming, tool calls, JSON mode and reasoning_content on reasoning models.

Models and pricing

Every model has a type, written as an input to output pair. A model can have more than one type. Models that read images, video or audio, or that have more than one type, are marked Multimodal.

TypeWhat it doesEndpoint
Text to textAnswers questions and writes text/chat/completions
Image to textReads images and answers in text/chat/completions
Text to imageCreates pictures from a prompt/images/generations
Image to imageChanges or edits a picture you give it/images/generations
Text to videoCreates short videos from a prompt/videos
Image to videoBrings a picture to life as a short video/videos
Speech to textTurns speech into text/audio/transcriptions
Text to speechTurns text into spoken audio/audio/speech
Text to embeddingsTurns text into numbers, for search and finding similar content/embeddings
RerankPuts search results in order of how well they match a question/rerank

Prices are per unit and shown in USD on every model page. Free models cost nothing.

Model typePrice unit
Text to text, Image to textPer 1M tokens in and out. Cached input has its own lower price
Text to embeddings, RerankPer 1M tokens in
Text to image, Image to imagePer image, or per megapixel
Text to video, Image to videoPer second of video, or per video
Speech to textPer minute of audio
Text to speechPer 1M characters

Batches cost 50% less than the same requests sent live. The machine-readable catalog at /models.json lists every public model with its types, context size, capabilities and prices.

Chat completions

POST /chat/completions. Messages in, one reply out. Set stream to true for server-sent events.

curl -X POST https://api.clod.io/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "MODEL_NAME",
  "messages": [
    {
      "role": "user",
      "content": "Say hello."
    }
  ]
}'

Reasoning models return their thinking in message.reasoning_content, next to the normal content. When you stream, it arrives in delta.reasoning_content before the answer. In a multi-turn chat, send each assistant turn back with its reasoning_content so the model keeps its train of thought.

{
  "choices": [
    {
      "message": {
        "role": "assistant",
        "reasoning_content": "The user greets me, so I greet back.",
        "content": "Hello!"
      }
    }
  ]
}

Tools (function calling) and JSON mode work on the models that list them as capabilities. Asking for a feature a model does not support returns a clear 400 error.

Completions

POST /completions. Plain text prompt in, text out.

curl -X POST https://api.clod.io/v1/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "MODEL_NAME",
  "prompt": "Once upon a time",
  "max_tokens": 50
}'

Responses

POST /responses. The Responses API shape. Takes input instead of messages.

curl -X POST https://api.clod.io/v1/responses \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "MODEL_NAME",
  "input": "Say hello."
}'

Embeddings

POST /embeddings. Turn text into a vector. Priced per 1M tokens in.

curl -X POST https://api.clod.io/v1/embeddings \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "EMBEDDING_MODEL",
  "input": "The quick brown fox"
}'

Rerank

POST /rerank. Sort documents by how well they match a query.

curl -X POST https://api.clod.io/v1/rerank \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "RERANK_MODEL",
  "query": "What is the capital of France?",
  "documents": [
    "Paris is the capital of France.",
    "Berlin is in Germany."
  ]
}'

Images

POST /images/generations. Make an image from a prompt. Image to image models edit a picture you send. Priced per image or per megapixel, as the model page says.

curl -X POST https://api.clod.io/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "IMAGE_MODEL",
  "prompt": "A lighthouse at sunrise",
  "size": "1024x1024"
}'

Video

POST /videos. Text to video and image to video. Creating a video is asynchronous: poll GET /videos/{id} until it is done. Priced per second of video or per video. Finished videos are shown for 7 days.

curl -X POST https://api.clod.io/v1/videos \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "VIDEO_MODEL",
  "prompt": "Waves on a beach at dusk"
}'

Audio

POST /audio/transcriptions. Speech to text: upload an audio file, get the transcript. Priced per minute of audio.

curl -X POST https://api.clod.io/v1/audio/transcriptions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F model="STT_MODEL" \
  -F [email protected]

Text to speech: POST /audio/speech turns text into an audio file. Priced per 1M characters.

{
  "model": "TTS_MODEL",
  "input": "Hello from CLōD.",
  "voice": "alloy"
}

Files

POST /files. Upload a JSONL file for batches or fine-tuning. Also GET /files, GET /files/{id}, GET /files/{id}/content and DELETE /files/{id}.

curl -X POST https://api.clod.io/v1/files \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F purpose="batch" \
  -F [email protected]

Batches

POST /batches. Run a file of requests in the background at 50% off. Also GET /batches, GET /batches/{id}, POST /batches/{id}/cancel and POST /batches/{id}/retry.

curl -X POST https://api.clod.io/v1/batches \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input_file_id": "file-abc123",
  "endpoint": "/v1/chat/completions",
  "completion_window": "24h"
}'

If a batch stalls or a model server fails, CLōD waits, then sends the batch again, up to 3 attempts, preferring servers that finished batches quickly. You can also call POST /batches/{id}/retry on a failed, expired or cancelled batch. A retry sends only the lines that did not finish, and you pay only for those lines.

Fine-tuning

Coming soon.

Rate limits and errors

Rate limits apply per API key. You can set a requests per minute limit and a tokens per minute limit on each key. A key with no limit set gets no x-ratelimit headers.

When you go over a limit, or when a model is at capacity right now, the API answers 429 at once and does not queue your request. Wait for the Retry-After header, then try again.

HeaderMeaning
x-ratelimit-limit-requestsRequests allowed per minute for your API key. Sent only when the key has a requests limit.
x-ratelimit-remaining-requestsRequests left in the current minute window. Sent only when the key has a requests limit.
x-ratelimit-reset-requestsTime until the requests window resets, such as 42s.
x-ratelimit-limit-tokensTokens allowed per minute for your API key. Sent only when the key has a tokens limit.
x-ratelimit-remaining-tokensTokens left in the current minute window. Sent only when the key has a tokens limit.
x-ratelimit-reset-tokensTime until the tokens window resets, such as 42s.
x-clod-fallbackSet when your request was served by a fallback model. The value names it.
x-clod-cachehit or miss, when Cache identical responses is on for the project.
x-clod-api-versionRequest header. Send 1 to get the older response shape on /v1/chat/completions and /v1/models.
retry-afterOn 429 and 503: seconds to wait before you retry.

Errors use the OpenAI format. 400 is a bad request, 401 a bad key, 402 no credit, 404 an unknown model or object, 429 a rate limit or a model at capacity, and 5xx a problem on our side. On 429 and 5xx, wait for retry-after and try again.

{
  "error": {
    "message": "clod/kimi-k3p1-pro is at capacity right now, retry shortly",
    "type": "rate_limit_error",
    "code": "model_at_capacity"
  }
}

If you still depend on the older response shape (503 instead of 429 at capacity), send the header x-clod-api-version: 1.

curl https://api.clod.io/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-clod-api-version: 1" \
  -H "Content-Type: application/json" \
  -d '{"model": "MODEL_NAME", "messages": [{"role": "user", "content": "Say hello."}]}'

Privacy and data retention

Zero retention: in Projects, open Settings, then Routing, and turn on Don't store prompts and responses. It applies to requests made with that project's keys and to Studio when that project is selected.

TypeWith zero retention on
Text and embeddingsPrompts and answers are not stored. Only providers that keep no data serve the request. Identical answers are not cached.
ImagesReturned in the response. A copy is kept for one download only (up to 60 minutes, then deleted), with no prompt. Studio does not add them to Recent images. With response_format=url the API returns a one-time link on our servers, never a provider link.
VideoThe prompt is not stored. The file is deleted after your first download, or 60 minutes after it finishes, whichever is first. Videos are not listed in history.
AudioSpeech is returned in the response and a copy is kept for one download only (up to 60 minutes), with no text. Transcription files are not kept. Nothing is added to history.
Files and batchesThe input copy is removed when the batch completes. Output and error files are removed 24 hours after the batch ends.

Video is asynchronous, so the file must stay until you fetch it. It is deleted right after the first download of GET /v1/videos/{id}/content, or after the media window (60 minutes by default) once the job has finished.

Media retention: each project sets how long generated images, videos and speech are kept on our servers: 1 hour, 1 day, 3 days or 7 days (the default is 1 day), or 0 for not kept. Set it in Projects, Settings, Routing, Media retention, or with PATCH /projects/{id} and mediaRetentionHours (1, 24, 72, 168, or 0). After that time the file is deleted. A shorter setting also applies to items already saved; a longer one applies to new items only. API video objects return expires_at (Unix seconds). Studio uses the selected project, or the default when none is selected.

SettingWhat happens
Not kept (0)Nothing is stored in history and no prompt is kept. Images and speech come back in the response. A one-time download link works once, for up to 60 minutes, then the file is deleted. Same for zero-retention projects.
1 hourThe file stays on our servers for one hour.
1 day (default)Used when a project has no setting.
3 daysThe file stays for three days.
7 days (maximum)The longest a file is kept.
After the file expiresThe timeline keeps the record (model, cost, time, status, and the prompt unless zero retention is on) for 90 more days and shows "File expired". Billing and usage totals are not affected.

Downloads are your own copy and are never deleted by us. Billing and usage records (tokens, cost, time) are kept whatever you choose. Prompts follow the zero-retention switch, not the media setting. Storage is free for now; the stored size per team is reported by GET /playground/media-usage.

One-time files (zero retention, or a media retention of 0): POST /v1/images/generations returns the image inline by default. With response_format=url the item is { "url": "https://.../v1/images/one-time/{id}" }, a link on our servers that needs your API key, works once and expires after the media window (60 minutes by default), then answers 410. It is never a provider link.

Browser copy: Studio can also keep a copy of each image, video and speech you generate in this browser (IndexedDB) so it stays available after the server file expires. It is on by default, per user, can be switched off in the Studio panel How your files are kept, and is limited to 500 MB (oldest copies are removed first). Copies never leave your device and are not available in other browsers. It works with zero retention too, because the copy lives on your own device.

Save with caching

Keep the fixed part of your prompt first and identical on every request, such as the system message and examples. Put the part that changes at the end. Repeated prompt starts are billed at the cached input price.

Pass user to name your end user and metadata to tag a request. Both show in Activity, where you can filter and group by them.

For exact repeats, turn on Cache identical responses in Project settings, Routing. Identical requests with temperature 0 return the saved answer for free. The x-clod-cache response header says hit or miss.

Status API

GET /status lists each model and whether it is available right now. The same data is on the Status page. GET /models/{id}/stats gives latency, time to first token and tokens per second for the last 24 hours.

curl https://api.clod.io/status

Integrations

Any OpenAI-compatible library works. Point it at the CLōD base URL.

LangChain

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    base_url="https://api.clod.io/v1",
    api_key="YOUR_API_KEY",
    model="MODEL_NAME",
)
print(llm.invoke("Say hello.").content)

LlamaIndex

from llama_index.llms.openai_like import OpenAILike

llm = OpenAILike(
    api_base="https://api.clod.io/v1",
    api_key="YOUR_API_KEY",
    model="MODEL_NAME",
    is_chat_model=True,
)
print(llm.complete("Say hello."))

Vercel AI SDK

import { createOpenAI } from "@ai-sdk/openai";
import { generateText } from "ai";

const clod = createOpenAI({
  baseURL: "https://api.clod.io/v1",
  apiKey: "YOUR_API_KEY",
});

const { text } = await generateText({
  model: clod.chat("MODEL_NAME"),
  prompt: "Say hello.",
});