Docs / API reference

API reference

The API follows the OpenAI Chat Completions format. Base URL: https://api.azet.io/v1

Authentication

Send your key as a bearer token: Authorization: Bearer azk_…. Keys start with azk_. We store only a hash of your key, so we cannot show it again — keep it safe. Lost or leaked key: email hello@azet.io and we move your balance to a new key.

Endpoints

POST/v1/chat/completions

Creates a model response for the conversation. Body as in OpenAI; set "stream": true for server-sent events — the final chunk carries usage.

modelrequired· string
A model id from GET /v1/models, for example deepseek-v4.1-flash.
messagesrequired· array
The conversation: objects with role (system, user, assistant) and content.
max_tokens· integer
Most output tokens to generate. Must be a positive integer; if omitted, up to 8,192. Credit for this many tokens is held while the request runs.
stream· boolean
Send the answer as server-sent events. The last event before [DONE] carries usage.
temperature, top_p, stop, tools· optional
Passed to the model as in OpenAI, where the model supports them.
n· integer
Number of answers, 1–8.

Reasoning models (for example Kimi) think before they answer, and those reasoning tokens count as output tokens. With a small max_tokens the answer can stop inside the reasoning (finish_reason: "length", empty content) — leave room, for example 1,000 tokens or more.

RequestcURL
curl https://api.azet.io/v1/chat/completions -H "Authorization: Bearer $AZET_API_KEY" -H "Content-Type: application/json" \
  -d '{"model": "deepseek-v4.1-flash", "stream": true, "messages": [{"role": "user", "content": "Write a haiku"}]}'
GET/v1/models

Lists available models with context length and price per 1M tokens (pricing.input_usd_per_1m, pricing.output_usd_per_1m).

GET/v1/models/{id}

One model, same fields as the list — what client.models.retrieve("deepseek-v4.1-flash") in the OpenAI SDK calls.

GET/v1/balance

Returns your remaining credit.

Response
{"balance_usd": 12.345678}
GET/v1/key

Balance and spend for your key in USD: balance_usd, usage (all time), usage_daily, usage_weekly, usage_monthly (UTC; weeks start Monday). Same shape as OpenRouter /api/v1/key.

GET/v1/activity

The last 30 days per date and model: requests, prompt_tokens, completion_tokens, usage (USD). The Usage page shows the same numbers and your invoices.

POST/v1/messages

Anthropic Messages format, for Claude Code and the Anthropic SDKs. Send the key as x-api-key or a bearer token. Text, images, tools (tool_use / tool_result) and streaming work; model reasoning comes back as thinking blocks. Billing is the same as chat completions.

POST/v1/responses

OpenAI Responses format, for Codex CLI. Stateless: send the whole history in input (previous_response_id and built-in tools such as web search are not supported). Function and custom tools and streaming work.

Coding tools

One command runs Claude Code, Codex or opencode on your AZET key. It only sets environment variables for that run and does not change the tool's own settings.

TerminalShell
npx azet-ai login azk_…          # saves the key to ~/.config/azet/key
npx azet-ai claude                # Claude Code
npx azet-ai codex                 # Codex CLI
npx azet-ai opencode              # opencode
npx azet-ai claude --model deepseek-v4.1-flash  # pick a model (default deepseek-v4.1-flash)
claude mcp add azet -- npx -y azet-ai mcp   # MCP server (also: codex mcp add azet -- npx -y azet-ai mcp)

The MCP server gives any MCP client (Claude Code, Codex, Cursor) tools to list models, ask a model and check your balance, billed to the same key.

Without the helper, Claude Code needs ANTHROPIC_BASE_URL=https://api.azet.io, ANTHROPIC_API_KEY=azk_… and ANTHROPIC_MODEL=deepseek-v4.1-flash. Codex needs a provider with base_url = "https://api.azet.io/v1" and wire_api = "responses". Any OpenAI-compatible tool (Cline, Aider, Continue) takes base URL https://api.azet.io/v1.

Billing

Each request costs prompt_tokens × input price + completion_tokens × output price, using the usage the model returns. Credit is kept to six decimal places (micro-USD). When credit reaches zero, requests return 402 until you add credit. Failed requests are not charged.

Auto top-up (off by default). Set it up under Buy credit: you choose a threshold ($1–$1,000), a top-up amount ($10, $25, $50 or $100) and a monthly limit. Stripe saves your card. We check balances every 10 minutes; when a key falls below the threshold we email you, and about 10 minutes later — if the balance is still below — charge the saved card the top-up amount plus the 5% payment fee and add the credit at once. Top-ups stop for the month once the next one would pass your monthly limit (we email you), and never take a key above the $2,000 balance limit. If a charge fails twice in a row, auto top-up turns itself off and we email you. Turn it off any time with the same form.

Errors

Error body: {"error": {"message": "…", "type": "insufficient_quota"}} — same shape as OpenAI.

StatusTypeMeaning
400invalid_request_errorBody is not valid JSON, or max_tokens / n is not a positive integer
401authentication_errorMissing or unknown API key
402insufficient_quotaNo credit left — add credit
402insufficient_quotaCredit is above zero but below the most this request could cost — lower max_tokens or add credit
404invalid_request_errorUnknown model — see GET /v1/models
429rate_limit_errorToo many requests for this key this minute or running at once, or daily capacity for an AZET-hosted model reached — see Retry-After or retry after 00:00 UTC
429api_errorThe model provider is busy — retry with backoff (for example 1 s, 2 s, 4 s)
451unavailable_for_legal_reasonsRequests from a comprehensively sanctioned region (Terms §9)
502api_errorThe model provider returned an error — retry; you are not charged for failed requests

Limits

Each key can send 120 chat requests per minute and run up to 5 requests at once on shared-capacity models (Qwen3-8B, Kimi K2.7 Code and GLM-5 family). Above that you get a 429 with a Retry-After header. Email hello@azet.io if you need more.

Before a request runs we hold the most it could cost (its prompt plus max_tokens) and release the rest when it finishes, so a long max_tokens needs that much credit. AZET-hosted models (azet/…) have daily per-model caps of 200 chat, 400 image and 2000 audio requests, plus per-key caps of 80, 120 and 300 respectively (UTC). Other models follow their provider’s rate limits. Need more? Email hello@azet.io with the model and volume.

Browser apps

The /v1 endpoints send CORS headers, so a web page can call them directly. Do not ship your key inside a public web page — anyone can read it there; call the API from your server instead.

AI-generated content

Responses carry the header x-ai-generated: true. If you publish model output, label it as AI-generated where the law of your users requires it (see Terms §4).

Support

Email hello@azet.io — we usually reply within 1–2 business days. Service status: /status.

Questions or a team account? hello@azet.io
Service status Status
Full reference API reference
Connect these docs to your AI llms.txt