Quickstart
caft serves an OpenAI-compatible API. Point any OpenAI SDK at https://api.caft.dev/v1 and use a caft API key.
- Create an account.
- Add credits under Billing (card or USDC on Base).
- 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
POST /v1/chat/completions: chat, streaming and non-streamingGET /v1/models: models available to your accountGET /v1/dashboard/billing/subscription: remaining balance
Errors
401: missing or invalid key402/403: out of credits, or model not enabled for your account429: rate limited; honourRetry-After5xx: upstream error; safe to retry with backoff