caft/docs

Quickstart

caft serves an OpenAI-compatible API. Point any OpenAI SDK at https://api.caft.dev/v1 and use a caft API key.

  1. Create an account.
  2. Add credits under Billing (card or USDC on Base).
  3. Create a key under API Keys and export it as CAFT_API_KEY.
cURL
curl https://api.caft.dev/v1/chat/completions \
  --header "Authorization: Bearer $CAFT_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "glm-5.3-flash",
  "messages": [{ "role": "user", "content": "Hello" }],
  "max_tokens": 64,
  "stream": true
}'
Python
import os
from openai import OpenAI

client = OpenAI(base_url="https://api.caft.dev/v1", api_key=os.environ["CAFT_API_KEY"])

stream = client.chat.completions.create(
    model="glm-5.3-flash",
    messages=[{"role": "user", "content": "Hello"}],
    max_tokens=64,
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")
JavaScript
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.caft.dev/v1", apiKey: process.env.CAFT_API_KEY });

const stream = await client.chat.completions.create({
  model: "glm-5.3-flash",
  messages: [{ role: "user", content: "Hello" }],
  max_tokens: 64,
  stream: true,
});
for await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content ?? "");

Authentication

Send your key as Authorization: Bearer $CAFT_API_KEY. All keys on an account share its credits, prices and limits.

Endpoints

Errors