Quickstart
Your first request
01Credential
export ZAINO_API_KEY='zn-…' # shown once, at creation02Tier & endpoint
https://api.zaino-ai.com/v103Send itmodelfast
curl https://api.zaino-ai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ZAINO_API_KEY" \
-d '{
"model": "fast",
"messages": [
{ "role": "user", "content": "Hello from Zaino — reply in one sentence." }
]
}'Models
Four names. That's the whole catalog.
| Alias | Input | Output | Cache read | Included in | Best for |
|---|---|---|---|---|---|
fastCheapestHigh-volume work — drafts, classification, bulk transforms. | $1.00per 1M | $5.00per 1M | $0.10per 1M | Solo · Starter |
|
smartMost usedEveryday balanced tier — the default for most integrations. | $3.00per 1M | $15.00per 1M | $0.30per 1M | Every plan |
|
frontierProMythos-class reasoning for the hardest long-running workloads. | $15.00per 1M | $75.00per 1M | $1.50per 1M | Pro · Team · Business |
|
fableNewLongest-horizon reasoning — whole-task runs that other tiers drop. | $15.00per 1M | $75.00per 1M | $1.50per 1M | Pro · Team · Business |
|
Rates are per 1M blended tokens, listed on the alias. Your plan's multiplier (Starter ×1.30, Pro ×1.25) applies on top. Cache reads are billed separately at the rate shown. Every alias serves 1M context and 64k max output. Failed requests are never billed.
Retrieval
Embeddings & rerank
smart token, so a 50M pool is 1.5 billion embedding tokens.embed
Multilingual text embeddings for retrieval, clustering and deduplication. French, Arabic and English are first-class.
- Dimensions
- 384
- Query alias
- embed-query
- Per text
- ≤ 512 tokens
- Per request
- ≤ 64 inputs
- Rate
- $0.10 / Mtok
- Plans
- Every plan
rerank
A cross-encoder that rescoring a shortlist does better than cosine similarity alone — the step that decides whether RAG answers are actually relevant.
- Scores
- 0 – 1, sorted
- Per text
- ≤ 512 tokens
- Per request
- ≤ 50 documents
- Rate
- $0.05 / Mtok
- Plans
- Pro · Team · Business
Embed a batch
curl https://api.zaino-ai.com/v1/embeddings \
-H "Authorization: Bearer $ZAINO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "embed",
"input": ["first passage", "second passage"]
}'For the string you search WITH, call embed-query instead. E5 is trained with different prefixes for a query and a passage, and using one for the other costs recall — so the alias applies the right one for you.
Rerank a shortlist
import requests
# Retrieve ~50 candidates with embed, then let the cross-encoder order them.
r = requests.post(
"https://api.zaino-ai.com/v1/rerank",
headers={"Authorization": "Bearer zn-..."},
json={
"model": "rerank",
"query": "How do I rotate a key?",
"documents": candidates,
"top_n": 5,
},
).json()
for hit in r["results"]:
print(hit["index"], hit["relevance_score"])Rerank is the step that decides whether retrieval is useful. Dimensions, chunking and a worked RAG recipe are in the Embeddings section of the API reference.
Chunking that works with a 512-token window
- Split on structure first — headings, paragraphs, rows — not on a character count.
- Aim for ~400 tokens per chunk with 10–15% overlap, so a sentence split by a boundary survives in one of its two chunks.
- Embed chunks with
embed; embed the search text withembed-query. Mixing the two is the most common retrieval regression. - Store the model name and the 384 dimensions beside every vector. Re-embedding after a model change is required — vectors from two models are not comparable.
- Compare with cosine similarity (vectors are already unit-length) and rerank the top 30–50 before answering.
Errors these endpoints return
| Status | Code | Meaning |
|---|---|---|
| 400 | unknown_model | The model is not embed / rerank. |
| 400 | unsupported_dimensions | Requested a width other than 384. Vectors cannot be truncated. |
| 413 | batch_too_large | More than 64 inputs / 50 documents, or more than 32,768 tokens in one request. |
| 429 | rate_limited | Two requests from this key are already running. Honour Retry-After. |
| 403 | — | Out of pool for this period, or the plan does not include rerank. |
| 503 | engine_busy | The inference queue is full. Retry with backoff; do not fan out. |
Wire format
OpenAI-compatible chat
zn-… key. Streaming, tool calling, and the tool-result turn all work — verified end to end with agentic CLIs.from openai import OpenAI
client = OpenAI(
base_url="https://api.zaino-ai.com/v1",
api_key="zn-...", # or os.environ["ZAINO_API_KEY"]
)
resp = client.chat.completions.create(
model="fast",
messages=[{"role": "user", "content": "Hello from Zaino!"}],
)
print(resp.choices[0].message.content)POST /v1/chat/completions | Chat, tools, streaming — primary path |
|---|---|
GET /v1/models | Returns [fast, smart, …] per your plan |
POST /v1/responses | Translated to chat before metering (Codex) |
Wire format
Anthropic-compatible messages
/v1/messages — native upstream support, valid tool-use arguments, SSE framing, and the tool-result→answer turn all verified.import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://api.zaino-ai.com/v1",
apiKey: process.env.ZAINO_API_KEY, // zn-…
});
const msg = await client.messages.create({
model: "fast",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello from Zaino!" }],
});
console.log(msg);POST /v1/messages | Native messages incl. tool calling + SSE |
|---|---|
max_tokens ≥ 1024 | Reasoning models can spend small budgets on thinking |
Agent CLI
Run Codex on Zaino
01Declare the provider and the tiers
# ~/.codex/config.toml — Zaino as a Codex provider.
# Verified with codex-cli 0.156.1 (Responses API only).
[model_providers.zaino]
base_url = "https://api.zaino-ai.com/v1"
env_key = "ZAINO_API_KEY"
wire_api = "responses"
[models.fast]
model_provider = "zaino"
model_context_window = 1048576
model_max_output_tokens = 65536
[models.smart]
model_provider = "zaino"
model_context_window = 1048576
model_max_output_tokens = 65536
[models.frontier]
model_provider = "zaino"
model_context_window = 1048576
model_max_output_tokens = 65536
[models.fable]
model_provider = "zaino"
model_context_window = 1048576
model_max_output_tokens = 65536Without [models.*] Codex warns “Model metadata not found”. Context 1,048,576 · max output 65,536.
02Export the key and run with the override
export ZAINO_API_KEY='zn-…'
# The model override is REQUIRED — without it Codex sends its
# global default, which the gateway correctly rejects with 403.
codex -c model_provider=zaino -c model=fast-c model=fast is required — without it Codex sends its global default, rejected with 403.
- Prompt → tool call → answer
- Multi-step file read/write/exec
- Use max_output ≥ 1024
Agent CLI
Run Claude Code on Zaino
01Point Claude Code at the gateway
export ANTHROPIC_BASE_URL="https://api.zaino-ai.com/v1"
export ANTHROPIC_AUTH_TOKEN="zn-…"
# Pick the tier Claude Code should drive (Starter: fast | smart).
export ANTHROPIC_MODEL="fast"Starter drives fast or smart; frontier needs Pro — the gateway 403s anything outside your plan.
02Or pin it in settings.json (optional)
{
// ~/.claude/settings.json — point Claude Code at Zaino.
// Credentials come from the environment (ANTHROPIC_AUTH_TOKEN),
// never from this file.
"env": {
"ANTHROPIC_BASE_URL": "https://api.zaino-ai.com/v1",
"ANTHROPIC_MODEL": "fast"
}
}Keep the credential in ANTHROPIC_AUTH_TOKEN, never in the JSON file.
Operate
Keys, headers, and limits
zn- prefix, shown once at creation. The gateway rewrites the prefix at the edge and enforces budgets, rate limits, and plan tiers on every request.Auth headers
Authorization: Bearer zn-… # preferred
x-api-key: zn-… # equivalentBoth styles authenticate. Never log, commit, or embed a key in client-side code.
When a call is refused
401 | Missing, revoked, or wrong-door key |
|---|---|
403 | Tier outside your plan |
429 | Budget, RPM, or TPM ceiling hit |
402 | No live subscription (dashboard) |
One shared token pool
One shared pool per plan. Spend it on any model your plan includes, in any proportion — 30M on one and 20M on another, or all of it on a single model. When the pool is spent, every model on that plan pauses until the next period.
| Plan | Pool / month | Spendable on | Keys |
|---|---|---|---|
| Solo | 35M | fastsmart | 2 |
| Starter | 50M | fastsmart | 3 |
| Pro | 50M | smartfrontierfable | 15 |
| Team | 150M | smartfrontierfable | 30 |
| Business | 400M | smartfrontierfable | 100 |
Usage is summed over the billing period, not per day, and not per model. Cache reads and writes count toward the same pool. Failed requests are never billed.
Ready to make your first call?
Create an account, pick Starter or Pro, pay by D17 — your first key is seconds away.