Loading...

Docs · Getting started

Create an API key and choose a route

The key drawer step by step, what each route means, and the three 403 refusals a key can hit.

Open API keys in the sidebar and click Create API key.

The form

  1. Name: any label; the placeholder suggests production-backend.
  2. Group: the route the key is billed on. Nothing is preselected; saving without one fails with Choose a group. An N models button on each row expands its price table (USD per 1M tokens, USD per image or USD per second), with a Long context row where that tier exists.
  3. Quota: Unlimited quota on, or off with a Quota (USD) after which the key stops.
  4. Expiry: an Expiration time, or a preset: Never, 1 Hour, 1 Day, 1 Month.
  5. Quantity (creating only): up to 50 keys; the first keeps the name you typed, the rest get a random suffix.
  6. Advanced settings, collapsed by default: Model limits and IP Whitelist (supports CIDR), both empty.

Click Save changes. The key starts with sk-.

The routes

Auto route is listed first and covers the whole catalogue with one key. Each request goes to the lowest-priced line that can serve its model right now, normally the shared pool; when the pool cannot, it goes to the official line at its higher price, so the billed route can differ per request. The usage log shows that route under Group.

The GLM, Kimi and DeepSeek route ids are retained for keys, but none of these models calls the provider's official API, and their prices are fixed at every hour (GLM-5.3-Abliterated, kimi-k3.1-pro and deepseek-flash-Abliterated also list a backup price for the rare request their standby deployment serves); the route overview lists them.

Claude, OpenAI and Grok official-line requests fall back to the shared pool when no dedicated line is configured; for a dedicated official-price line, write to support@topxai.xyz.

Automatic backup switching

Text routes with a configured backup track failures separately for each model and API protocol (Chat Completions, Messages and Responses). By default, three consecutive upstream failures move new requests to the backup at once, and a single failure already starts a background check of the line. A request that has not produced output retries on the backup straight away.

While the primary is out, the relay checks it in the background and sends it no customer requests. After two background checks pass, one request at a time may try the primary, and two successes at least 30 seconds apart return the line to primary. A line that fails again soon after recovering stays on the backup longer, because each switch rebuilds the prompt cache. Requests already streaming keep their connection. Continuation requests that depend on one upstream's session state may not be able to change lines.

Client parameter errors, insufficient balance, content refusals and client cancellations do not count toward the failure threshold. The API key and endpoint stay the same. Where a line lists a backup price, each request still tries the primary first; only a request the primary could not answer uses the backup and pays that price. There is no switching fee. Image generation and asynchronous video jobs are outside this text-route policy.

Three refusals

Three checks run before a provider is reached; each fails with HTTP 403:

IP Whitelist takes one IP or CIDR block per line; addresses can be spoofed, so pair it with a gateway such as nginx or a CDN.

Related

Previous: What TopxAI is · Next: Connect your SDK

Other languages: 简体中文