AI gateway
ai is a gateway at https://ai.xvii.network in front of the instance's subscription
accounts and official API keys. Tools talk to it in the API they already speak.
| API |
Base |
| OpenAI |
https://ai.xvii.network/v1 |
| Anthropic |
https://ai.xvii.network (/v1/messages) |
| Gemini |
https://ai.xvii.network/v1beta |
Get a key
xvii ai keys create --name laptop --own
xvii ai keys create --name bots --models 'claude-haiku*' --budget 20 --daily 500
A key (sk-xvii-…) is shown once. It is a team's key, or with --own your own key in a team. Each key has
allowed models (ids or * patterns) and limits: requests per minute and per day, tokens and dollars per
month. The team's ai.keys and ai.tokens limits apply on top. The panel's key dialog shows ready setup
lines for common clients.
Use it
export ANTHROPIC_BASE_URL=https://ai.xvii.network
export ANTHROPIC_AUTH_TOKEN=sk-xvii-…
claude
export OPENAI_BASE_URL=https://ai.xvii.network/v1
export OPENAI_API_KEY=sk-xvii-…
In opencode, add an OpenAI-compatible provider with that base URL.
curl https://ai.xvii.network/v1/chat/completions \
-H "Authorization: Bearer $AI_KEY" -H "Content-Type: application/json" \
-d '{"model":"claude-haiku-5-5","messages":[{"role":"user","content":"Hello"}]}'
The gateway reads the key wherever an SDK puts it (Bearer, x-api-key, x-goog-api-key, ?key=) and
answers refusals in the caller's API's error shape.
AI_KEY=sk-xvii-… xvii ai quota # what the key may still spend
xvii ai usage --days 7 # calls, tokens and cost by model and key
Model aliases
Superusers can define the instance's own model names, such as smart → an ordered list of models. The
gateway tries them in order and moves on while one answers 429, 404 or 5xx; the X-Xvii-Model response
header says which one answered. /v1/models lists the aliases.
Usage, logs and the playground
- Usage: every call with key, model, provider, account, tokens, latency and price (list prices with the
instance's overrides).
- Logs: a key can keep its calls' bodies for 1, 7 or 30 days; turning it off deletes them.
- Playground: a chat in the panel with streamed Markdown answers, regenerate or answer with another
model, images for vision models, image generation, saved conversations and a prompt library.
- Analytics: latency percentiles, time to first token, failures, cache hits and speed by model,
provider, key and account. Teams hear through notify when a key passes 80% of its budget.
Accounts (superusers)
xvii ai accounts add claude
opens the provider's sign-in (Claude, Codex, Antigravity, Kimi, xAI and others); official API keys
(Anthropic, Gemini, OpenAI-compatible) are added in the panel. Requests rotate across accounts. An account
can go out through its own proxy for a provider that refuses the server's region. Every five minutes the
gateway reads each account's quota windows, shows bars and a forecast, and pauses an account with under 2%
left until its window resets.
Provider quota windows and the gateway's metered limits are different things with different reset
times. Proxying consumer subscriptions may break a provider's terms; deciding that is the instance
owner's call.
Compression
Optionally, the gateway passes long conversations through a compression step before they go upstream,
keeping the prompt cache warm. It is off, audit-only or on for the instance; teams, keys, model rules and
the X-Xvii-Compress header choose below that. The Compression page shows what it saved.