# AtmoRouter > AtmoRouter is a prepaid, pay-as-you-go AI inference gateway. One AtmoRouter API key routes requests to models from multiple families. Supported inference surfaces include OpenAI-compatible Chat Completions and Anthropic-compatible Messages. A public reference for AI assistants, crawlers, and developers integrating AtmoRouter. Find current models, API contracts, usage data, and documentation in HTML or Markdown. - [For AI agents and developers](https://atmorouter.dev/for-ai): HTML directory with public model links, integration notes, and developer guides. - [Quickstart](https://atmorouter.dev/docs/quickstart): Send a first request through AtmoRouter. - [Complete documentation](https://atmorouter.dev/llms-full.txt): All public developer guides in one Markdown file. **Base URLs and credentials**. Use https://atmorouter.dev/v1 as the OpenAI SDK base URL and https://atmorouter.dev as the Anthropic SDK base URL. Send an AtmoRouter inference key with the protocol’s documented authentication header. Dashboard management uses an account session. Use a placeholder for credentials in generated examples. **Model selection**. Read the public model catalogue before writing integration code. Pass the model ID exactly as published, including the family prefix. A listed model can have limited capacity, and support for tool calls, structured output, streaming, or caching depends on the model and route. Private combo aliases are discoverable only with their owner’s API key. **Pricing and spending controls**. Input, output, and cached input can have separate USD rates per million tokens. Listed prices depend on available tiers. Use model and pricing pages for current rates, the calculator for estimates, and Budgets to verify how price ceilings and account controls affect routing. **Streaming and retries**. Read the complete stream, including terminal events and any usage or error records. Distinguish invalid credentials, insufficient balance, price-limit refusals, and temporary capacity failures. Retry only when the error guidance permits it and respect Retry-After when present. **Public rankings and citation**. Rankings describe observed usage after publication thresholds, aggregation, and rounding. Use the published UTC window and methodology when citing a figure. Live catalogue prices and model capabilities are maintained separately from usage rankings. --- # AtmoRouter — Quickstart Source: https://atmorouter.dev/docs/quickstart Send your first model request with one AtmoRouter key. Use the OpenAI or Anthropic client you already know, then check exactly what the request cost. [**API reference**Endpoints, fields and responses](https://atmorouter.dev/docs/endpoints)[**Connect an agent**Set up your existing coding client](https://atmorouter.dev/docs/helper) ## 1. Create a key and add credit Open [API Keys](https://atmorouter.dev/dashboard/keys) in your dashboard. Copy your new key while it is visible and save it in your server environment as `ATMOROUTER_API_KEY`. Add prepaid credit in [Deposit](https://atmorouter.dev/dashboard/deposit) before making a paid call. ## 2. Send your first request Choose a language below. For Python, install `openai` with pip. For JavaScript, install `openai` with npm and run the example in Node.js. Replace the example model with a current ID from the [model catalog](https://atmorouter.dev/models). POST`/v1/chat/completions` ``` curl -X POST 'https://atmorouter.dev/v1/chat/completions' \ -H "Authorization: Bearer $ATMOROUTER_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "model": "cbcn/glm-5.3", "messages": [ { "role": "user", "content": "Hello!" } ], "max_tokens": 128 }' ``` Using the Anthropic SDK? Set its base URL to `https://atmorouter.dev`. The [API reference](https://atmorouter.dev/docs/endpoints#createMessage) includes a Messages example. ## 3. Check the result and cost A successful chat response contains the answer in `choices[0].message.content`. To see the input tokens, output tokens, and amount charged for that call, open its billing receipt in [Usage](https://atmorouter.dev/dashboard/usage). A paid model may have a minimum charge per request. Set price limits in [Budgets](https://atmorouter.dev/docs/budgets), read responses incrementally with [Streaming](https://atmorouter.dev/docs/streaming), or look up an HTTP error in [Errors & retries](https://atmorouter.dev/docs/errors). --- # AtmoRouter — Authentication Source: https://atmorouter.dev/docs/authentication Only endpoints that intentionally differ from the standard API carry a chip; the chip links to the note that explains the difference. Pass your key as a bearer token. The `x-api-key` header is also accepted for clients that prefer it. `/api/dashboard/register` `/api/dashboard/login` `/api/dashboard/keys` `/api/dashboard/keys/{id}` Atmo keys stay on Atmo. Atmo keys carry the `ar-` prefix. An Atmo key works only here — keys are not portable to other gateways, and a key issued by another gateway does not work here. Two credentials for two surfaces. Inference takes a Bearer `ar-` key (or `x-api-key`); the dashboard uses a session cookie instead. An `ar-` key never acts as a session, and a session cookie never authenticates inference. http ``` Authorization: Bearer ar-xxxxxxxxxxxx # or x-api-key: ar-xxxxxxxxxxxx ``` ## Key properties | Property | Meaning | | --- | --- | | prefix | Every key starts with ar- so it is easy to spot in logs and secret scanners. | | rate_limit | Requests per minute for your whole account, counted across all your keys together. Omit the field and the key gets 500; an explicit value must be between 1 and 1000. Any other value (including 0 and negatives) is rejected with 400. | | allowed_models | Optional allowlist of model ids. Calls to any other model are rejected with 403. | | enabled | Keys carry no enable toggle: revoking deletes the key immediately (DELETE below), and the next call with it returns 401. There is no grace window. | ## Rate limits Inference, playground and webhook limits renew every minute and answer `429` when spent. Inference limits are enforced per account, not per key — creating extra keys never multiplies your budget. A missing `rate_limit` becomes 500, while an explicit value must be between `1` and `1000`. Any other value (including `0` and negatives) is rejected with `400`; legacy keys still storing 0 or a negative are throttled at the 500 default. | Surface | Limit | Scope | When exceeded | | --- | --- | --- | --- | | Inference (/v1/*) | Your key's rate_limit (default 500, valid 1..1000) | Per account, all keys combined | 429 without Retry-After, back off exponentially | | Playground chat | 20 requests/min | Per signed-in user | 429 without Retry-After, back off exponentially | | Webhooks (provider callbacks) | 30 requests/min | Per client IP | 429 with Retry-After, wait the stated seconds | | Login and step-up checks | 20 tries per IP + 8 per account, each 15-min window | Per IP and per account; locks out 15 min | 429 with Retry-After, wait the stated seconds | | Concurrency at low balance | Balance up to $0.05: 1 in flight; up to $0.25: 3 | Per account | 429 without Retry-After, let requests finish or top up | ## Managing keys from the API The dashboard calls the same JSON API you can call yourself: log in once to fill a cookie jar, then create, list, check balance, and revoke. These endpoints take the session cookie (the login token also works as a bearer); API keys never work here. bash ``` # 1. Log in (the jar keeps the session cookie) curl -c jar.txt https://atmorouter.dev/api/dashboard/login -H "Content-Type: application/json" -d '{"email":"you@example.com","password":"..."}' # 2. Create a key (omit rate_limit for the 500/min default; explicit values must be 1..1000, anything else answers 400) curl -b jar.txt https://atmorouter.dev/api/dashboard/keys -H "Content-Type: application/json" -d '{"name":"prod-app","rate_limit":500}' # -> {"id":"...","key":"ar-...","message":"key created"} — save the key now, it is shown in full exactly once # 3. List keys (previews only, never full secrets) curl -b jar.txt https://atmorouter.dev/api/dashboard/keys # 4. Check balance (for automation) curl -b jar.txt https://atmorouter.dev/api/dashboard/balance # -> {"balance":12.5} # 5. Revoke a key (immediate; an unknown id, or one owned by someone else, answers 404) curl -b jar.txt -X DELETE https://atmorouter.dev/api/dashboard/keys/{id} # -> {"status":"ok"} ``` `POST` generates `ar-` plus 48 hex characters from 24 secure random bytes and returns the full secret once: lose it and you revoke and recreate, since `GET` only ever returns a 12-character preview per key. `DELETE` removes the key for your account immediately and answers `404` when the id is unknown or belongs to someone else, while a malformed id answers `400`. There is no rotate endpoint: to rotate, create the replacement first, then delete the old key. ## Good practice Create one key per application rather than sharing a single key. Each request records which key made it, so separate keys let you revoke one without disrupting the others. The dashboard usage view aggregates per account today; a per-key cost breakdown is planned. Never commit a key to source control or ship it in client-side code. Anyone holding it can spend your balance. What usage tracking records. The server stores the key id with each keyed request, but `GET /api/dashboard/usage` and `GET /api/dashboard/usage-stats` aggregate per account, with breakdowns by model and provider. Requests through the playground carry no key id by design. A key is shown in full exactly once, at creation. If you lose it, revoke it and create a new one; we cannot recover the original value. No rotation, revoke and recreate. There is no key-rotation endpoint: rotation with a 24-hour grace window is not available on Atmo today. You revoke the old key (`DELETE /api/dashboard/keys/{id}`) and create a new one; the old key stops working immediately, with no grace window. ## Account and session These endpoints back signup, sign-in state, and account management in the dashboard. They use the session cookie, not an `ar-` key. `POST /api/dashboard/resend-verification` — Re-sends the signup verification email. `POST /api/dashboard/complete-registration` — Completes signup with the emailed token and a new password; returns no session, sign in afterwards. `GET /api/dashboard/me` — Returns the session's user id, email, and balance. `POST /api/dashboard/reset-password` — Changes the password with the current one; requires a signed-in session. `POST /api/dashboard/logout` — Destroys the session. POST only; other methods return 405. `POST /api/dashboard/delete-account/request` — Starts the three-step account-deletion flow with your password; the confirmation token follows by email. `POST /api/dashboard/delete-account/confirm` — Confirms deletion with the emailed token. Malformed or wrong tokens answer 400; the endpoint also carries a per-address and global hourly budget, so sustained attempts answer 429 with `Retry-After` and a `retry_after_seconds` field. `POST /api/dashboard/delete-account/cancel` — Cancels a pending deletion and restores the account and keys. --- # AtmoRouter — API reference Source: https://atmorouter.dev/docs/endpoints Explore request fields, response examples, errors, and copyable SDK samples. All examples are illustrative; discover current model IDs and prices from the catalog. [Download inference OpenAPI 3.1](https://atmorouter.dev/openapi.json)[Compatibility matrix](https://atmorouter.dev/docs/compatibility) Base URL: `https://atmorouter.dev`. Use `/v1` for OpenAI SDKs and the bare host for Anthropic SDKs. Dashboard APIs require a separate login session. Browser apps can list models and stream chat completions or messages from another origin. For bring-your-own-key apps, send the user's key in `Authorization` or `x-api-key` and use `credentials: 'omit'`. Keep shared application keys on your server. **POST /v1/chat/completions** ## Create a chat completion OpenAI Chat Completions passthrough with account billing. Additional fields are forwarded; support depends on the selected model. An OpenAI-compatible API does not imply support for the Responses API. Authentication: Bearer ar- key or x-api-key | Request field | Type | Description | | --- | --- | --- | | modelRequired | string | Enabled model ID from GET /v1/models, or a private combo/ alias owned by the API key account. Normal member permissions, budgets, pricing, and balance checks apply. | | messagesRequired | array | Conversation messages. Content blocks and tools depend on the model. | | max_tokens | integer | Requested output limit. Affordability and context caps apply; upstream enforcement varies. | | stream | boolean | Return OpenAI-format SSE, ending with data: [DONE]. | | stream_options | object | See the request schema. | | temperature | number | Sampling setting forwarded to the model; support varies. | | top_p | number | Nucleus sampling setting; support varies. | | stop | Union | Stop sequence(s), when supported. | | tools | array | OpenAI function definitions; model must support tools. | | tool_choice | Union | Tool selection policy, if supported. | | response_format | object | Structured output settings forwarded to the upstream; capability is model-specific. | curl example ``` curl -X POST 'https://atmorouter.dev/v1/chat/completions' \ -H "Authorization: Bearer $ATMOROUTER_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "model": "cbcn/glm-5.3", "messages": [ { "role": "user", "content": "Hello!" } ], "max_tokens": 128 }' ``` 200 response example ```json { "id": "chatcmpl-example", "object": "chat.completion", "model": "cbcn/glm-5.3", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello!" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 9, "completion_tokens": 2, "total_tokens": 11, "cached_tokens": 0, "cost": 0.00002 } } ``` **Full request schema** ```json { "type": "object", "properties": { "model": { "type": "string", "description": "Enabled model ID from GET /v1/models, or a private combo/ alias owned by the API key account. Normal member permissions, budgets, pricing, and balance checks apply." }, "messages": { "type": "array", "minItems": 1, "description": "Conversation messages. Content blocks and tools depend on the model.", "items": { "type": "object", "properties": { "role": { "type": "string", "description": "Message role." }, "content": { "description": "Text or model-supported content blocks.", "oneOf": [ { "type": "string" }, { "type": "array", "items": { "type": "object", "additionalProperties": true } } ] } }, "required": [], "additionalProperties": true } }, "max_tokens": { "type": "integer", "minimum": 1, "description": "Requested output limit. Affordability and context caps apply; upstream enforcement varies." }, "stream": { "type": "boolean", "default": false, "description": "Return OpenAI-format SSE, ending with data: [DONE]." }, "stream_options": { "type": "object", "properties": { "include_usage": { "type": "boolean", "description": "Request usage frames. The gateway enables this when stream_options is omitted." } }, "required": [], "additionalProperties": true }, "temperature": { "type": "number", "description": "Sampling setting forwarded to the model; support varies." }, "top_p": { "type": "number", "description": "Nucleus sampling setting; support varies." }, "stop": { "description": "Stop sequence(s), when supported.", "oneOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ] }, "tools": { "type": "array", "items": { "type": "object", "additionalProperties": true }, "description": "OpenAI function definitions; model must support tools." }, "tool_choice": { "description": "Tool selection policy, if supported.", "oneOf": [ { "type": "string" }, { "type": "object" } ] }, "response_format": { "type": "object", "description": "Structured output settings forwarded to the upstream; capability is model-specific.", "additionalProperties": true } }, "required": [ "model", "messages" ], "additionalProperties": true } ``` **Response schema** ```json { "type": "object", "properties": { "id": { "type": "string" }, "object": { "type": "string" }, "model": { "type": "string" }, "choices": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "usage": { "$ref": "#/components/schemas/OpenAIUsage" } }, "required": [], "additionalProperties": true } ``` ### HTTP outcomes **200** Completed JSON response or SSE stream. Examples are illustrative; upstream-specific fields can vary. **400** Invalid request: inspect the body and correct it. **401** Missing, invalid, revoked, or ineligible API key. **402** Local balance, affordability, or promotional eligibility gate. Inspect the message; only payment eligibility issues are resolved by a top-up. **403** The key does not allow this model. **404** The model is not enabled or priced for inference. **405** Method not allowed; use POST. **424** Billing settlement pending. Generation may have completed; do not automatically resend. Check Usage first. X-Should-Retry: false. Error code billing_settlement_pending; retryable: false. **429** Account rate limit, concurrency limit, quota, or upstream rate limit. Back off; use Retry-After when supplied. **500** Gateway error. Record the request ID when available and contact support if it persists. **502** Upstream request failed. Retry conservatively before output only. Incomplete or invalid model billing metadata uses billing_metadata_unavailable and is not charged. **503** Temporary service or upstream availability failure. **POST /v1/messages** ## Create an Anthropic-format message Use https://atmorouter.dev as the Anthropic SDK base URL; raw HTTP uses the full /v1/messages path. The model must support the requested features. Authentication: Bearer ar- key or x-api-key | Request field | Type | Description | | --- | --- | --- | | modelRequired | string | Enabled model ID from GET /v1/models, or a private combo/ alias owned by the API key account. Normal member permissions, budgets, pricing, and balance checks apply. | | max_tokensRequired | integer | Required positive integer. Context and affordability caps apply. | | messagesRequired | array | Conversation messages. Content blocks and tools depend on the model. | | system | Union | System prompt text or Anthropic content blocks. | | stream | boolean | Native Anthropic SSE ending in message_stop. | | tools | array | Anthropic tool definitions, when supported. | | tool_choice | object | Anthropic tool selection, when supported. | | temperature | number | Forwarded sampling setting; model-specific. | | stop_sequences | array | Forwarded stop sequences; model-specific. | curl example ``` curl -X POST 'https://atmorouter.dev/v1/messages' \ -H "Authorization: Bearer $ATMOROUTER_API_KEY" \ -H 'Content-Type: application/json' \ -H 'anthropic-version: 2023-06-01' \ -d '{ "model": "cbcn/glm-5.3", "messages": [ { "role": "user", "content": "Hello!" } ], "max_tokens": 128 }' ``` 200 response example ```json { "id": "msg-example", "type": "message", "role": "assistant", "model": "cbcn/glm-5.3", "content": [ { "type": "text", "text": "Hello!" } ], "stop_reason": "end_turn", "usage": { "input_tokens": 9, "output_tokens": 2 } } ``` **Full request schema** ```json { "type": "object", "properties": { "model": { "type": "string", "description": "Enabled model ID from GET /v1/models, or a private combo/ alias owned by the API key account. Normal member permissions, budgets, pricing, and balance checks apply." }, "max_tokens": { "type": "integer", "minimum": 1, "description": "Required positive integer. Context and affordability caps apply." }, "messages": { "type": "array", "minItems": 1, "description": "Conversation messages. Content blocks and tools depend on the model.", "items": { "type": "object", "properties": { "role": { "type": "string", "description": "Message role." }, "content": { "description": "Text or model-supported content blocks.", "oneOf": [ { "type": "string" }, { "type": "array", "items": { "type": "object", "additionalProperties": true } } ] } }, "required": [], "additionalProperties": true } }, "system": { "description": "System prompt text or Anthropic content blocks.", "oneOf": [ { "type": "string" }, { "type": "array", "items": { "type": "object" } } ] }, "stream": { "type": "boolean", "default": false, "description": "Native Anthropic SSE ending in message_stop." }, "tools": { "type": "array", "items": { "type": "object" }, "description": "Anthropic tool definitions, when supported." }, "tool_choice": { "type": "object", "description": "Anthropic tool selection, when supported." }, "temperature": { "type": "number", "description": "Forwarded sampling setting; model-specific." }, "stop_sequences": { "type": "array", "items": { "type": "string" }, "description": "Forwarded stop sequences; model-specific." } }, "required": [ "model", "messages", "max_tokens" ], "additionalProperties": true } ``` **Response schema** ```json { "type": "object", "properties": { "id": { "type": "string" }, "type": { "type": "string" }, "role": { "type": "string" }, "model": { "type": "string" }, "content": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "stop_reason": { "type": [ "string", "null" ] }, "usage": { "type": "object", "properties": { "input_tokens": { "type": "integer" }, "output_tokens": { "type": "integer" } }, "required": [], "additionalProperties": true } }, "required": [], "additionalProperties": true } ``` ### HTTP outcomes **200** Completed JSON response or SSE stream. Examples are illustrative; upstream-specific fields can vary. **400** Invalid request: inspect the body and correct it. **401** Missing, invalid, revoked, or ineligible API key. **402** Local balance, affordability, or promotional eligibility gate. Inspect the message; only payment eligibility issues are resolved by a top-up. **403** The key does not allow this model. **404** The model is not enabled or priced for inference. **405** Method not allowed; use POST. **424** Billing settlement pending. Generation may have completed; do not automatically resend. Check Usage first. X-Should-Retry: false. Error code billing_settlement_pending; retryable: false. **429** Account rate limit, concurrency limit, quota, or upstream rate limit. Back off; use Retry-After when supplied. **500** Gateway error. Record the request ID when available and contact support if it persists. **502** Upstream request failed. Retry conservatively before output only. Incomplete or invalid model billing metadata uses billing_metadata_unavailable and is not charged. **503** Temporary service or upstream availability failure. **GET /v1/models** ## List the retail model catalog Public retail catalog and pricing in USD per million tokens. A valid owner API key also includes that account’s private combo/ aliases. Unauthenticated responses contain ordinary models only. Catalog presence does not guarantee every model modality or feature can be called. Authentication: Public; no key required curl example ``` curl 'https://atmorouter.dev/v1/models' ``` 200 response example ```json { "object": "list", "data": [ { "id": "cbcn/glm-5.3", "object": "model", "owned_by": "atmorouter", "family": "CodeBuddy CN", "pricing": { "input": 0.1, "output": 0.2, "cached_input": 0.01 }, "context_length": 128000, "max_output_tokens": 8192, "modality": "text", "supports_cache": true } ] } ``` **Response schema** ```json { "type": "object", "properties": { "object": { "type": "string", "const": "list" }, "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "object": { "type": "string" }, "owned_by": { "type": "string" }, "family": { "type": "string" }, "pricing": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cached_input": { "type": "number" } }, "required": [], "additionalProperties": true }, "context_length": { "type": "integer", "description": "Total context window in tokens (input + reserved output headroom)." }, "max_input_tokens": { "type": "integer", "description": "Maximum INPUT tokens, published only for families whose upstream reports a distinct input budget (currently cx). Omitted when unknown; do not derive it from context_length minus max_output_tokens." }, "max_output_tokens": { "type": "integer", "description": "Maximum OUTPUT tokens the model can generate in one response." }, "modality": { "type": "string" }, "supports_cache": { "type": "boolean" } }, "required": [], "additionalProperties": true } } }, "required": [], "additionalProperties": true } ``` ### HTTP outcomes **200** Current catalog. Values below are illustrative, not live prices. **500** Catalog unavailable. ## Dashboard & public endpoint directory Follow an endpoint for its detailed parameters and examples. Session credentials are separate from inference keys. - [POST /api/dashboard/playground/chat](https://atmorouter.dev/docs/observability) Dashboard session authentication; same inference and billing core · Login session - [POST /api/dashboard/register](https://atmorouter.dev/docs/management-api#post-api-dashboard-register) Email-first signup; verification required before sign-in · Public - [POST /api/dashboard/login](https://atmorouter.dev/docs/management-api#post-api-dashboard-login) Sign in and receive an HttpOnly session cookie · Public - [POST /api/dashboard/resend-verification](https://atmorouter.dev/docs/account-security) Request another verification email; cooldown applies · Public - [POST /api/dashboard/complete-registration](https://atmorouter.dev/docs/account-security) Complete signup with token and password; sign in separately · Public - [GET/PUT /api/dashboard/ranking-app](https://atmorouter.dev/docs/management-api#get-api-dashboard-ranking-app) Read, submit, or withdraw the app listing for an owned API key · Login session - [GET/POST /api/dashboard/keys](https://atmorouter.dev/docs/management-api#get-post-api-dashboard-keys) Rate limit 1..1000; default 500 when omitted · Login session - [GET/PUT/DELETE /api/dashboard/budgets](https://atmorouter.dev/docs/budgets#get-api-dashboard-budgets) Model rate caps for the account and individual API keys; current per-request minimum · Login session - [PUT/DELETE /api/dashboard/budget-rules](https://atmorouter.dev/docs/budgets#put-api-dashboard-budget-rules) Percentage-off official rate caps for all models, a family, or a model; optional API key scope · Login session - [DELETE /api/dashboard/keys/{id}](https://atmorouter.dev/docs/management-api#delete-api-dashboard-keys) Immediate revocation; see C-no-rotate · Login session - [GET /api/dashboard/usage](https://atmorouter.dev/docs/management-api#get-api-dashboard-usage) Account-scoped request history; see C-usage · Login session - [GET /api/dashboard/usage-stats](https://atmorouter.dev/docs/management-api#get-api-dashboard-usage-stats) Account totals by model and family; see C-usage · Login session - [GET /api/dashboard/catalog](https://atmorouter.dev/docs/management-api#get-api-dashboard-catalog) Public read filter; see C-catalog · Public - [GET /api/dashboard/market](https://atmorouter.dev/docs/management-api#get-api-dashboard-market) Public JSON snapshot, not SSE; see C-market · Public - [GET /api/dashboard/balance](https://atmorouter.dev/docs/management-api#get-api-dashboard-balance) Prepaid account balance in USD · Login session - [GET /api/dashboard/deposits](https://atmorouter.dev/docs/management-api#get-api-dashboard-deposits) Combined deposit history; see Billing · Login session - [GET/POST/DELETE /api/dashboard/combos](https://atmorouter.dev/docs/combos) Manage private callable combos; dashboard CRUD only; see C-behavior-hardening · Login session - [POST /api/dashboard/reset-password](https://atmorouter.dev/docs/account-security) Current password required; revokes other sessions and all API keys · Login session - [POST /api/dashboard/forgot-password](https://atmorouter.dev/docs/management-api#get-api-dashboard-forgot-password) Request a 15-minute single-use reset link; the response is identical whether or not the account exists · Public - [POST /api/dashboard/reset-password/confirm](https://atmorouter.dev/docs/account-security) Redeem an emailed reset token; revokes all sessions and all API keys · Public - [POST /api/dashboard/logout](https://atmorouter.dev/docs/account-security) Destroy the current session and clear its cookie; no credential is required to log out · Public - [GET /api/dashboard/me](https://atmorouter.dev/docs/management-api#get-api-dashboard-me) Session identity, account status, and balance · Login session - [POST /api/dashboard/delete-account/request](https://atmorouter.dev/docs/account-security) Password confirmation and a time-limited email token · Login session - [POST /api/dashboard/delete-account/confirm](https://atmorouter.dev/docs/account-security) Confirm account deletion; seven-day cancellation window · Public - [POST /api/dashboard/delete-account/cancel](https://atmorouter.dev/docs/account-security) Cancel pending deletion and receive a fresh session · Login session - [GET /api/dashboard/export](https://atmorouter.dev/docs/account-security) Account data, redacted key previews, and recent usage · Login session - [GET /api/dashboard/deposit/voucher/settings](https://atmorouter.dev/docs/management-api#get-api-dashboard-deposit-voucher-settings) Current global voucher availability; unavailable settings fail closed · Login session - [POST /api/dashboard/deposit/voucher/preview](https://atmorouter.dev/docs/management-api#get-api-dashboard-deposit-voucher-preview) Preview a deposit voucher without reserving quota or moving balance · Login session - [GET /api/dashboard/deposit/info](https://atmorouter.dev/docs/management-api#get-api-dashboard-deposit-info) Available payment methods and current limits · Login session - [POST /api/dashboard/deposit/epusdt/create](https://atmorouter.dev/docs/management-api#post-api-dashboard-deposit-epusdt-create) Create a hosted cryptocurrency checkout order · Login session - [GET /api/dashboard/deposit/epusdt/status](https://atmorouter.dev/docs/management-api#get-api-dashboard-deposit-epusdt-status) Read and reconcile an order; see Billing · Login session - [GET /api/dashboard/deposit/epusdt/list](https://atmorouter.dev/docs/management-api#get-api-dashboard-deposit-epusdt-list) Recent hosted checkout orders · Login session - [POST /api/dashboard/topup/qris](https://atmorouter.dev/docs/management-api#post-api-dashboard-topup-qris) Create a QRIS invoice in IDR · Login session - [POST /api/dashboard/topup/fiat](https://atmorouter.dev/docs/management-api#get-api-dashboard-topup-fiat) Create a QRIS invoice in IDR · Login session - [GET /api/dashboard/topup/status](https://atmorouter.dev/docs/management-api#get-api-dashboard-topup-status) Read the stored QRIS invoice status · Login session - [GET /api/dashboard/topups](https://atmorouter.dev/docs/management-api#get-api-dashboard-topups) Recent QRIS invoices · Login session - [GET/POST /api/dashboard/affiliate](https://atmorouter.dev/docs/affiliate) Referral summary, payout requests, referrals, and ledger · Login session - [GET /api/dashboard/affiliate/summary](https://atmorouter.dev/docs/affiliate) Share link, three balances, program rules, recent activity · Login session - [GET /api/dashboard/affiliate/payouts](https://atmorouter.dev/docs/affiliate) Withdrawal history · Login session - [POST /api/dashboard/affiliate/payouts](https://atmorouter.dev/docs/affiliate) Parks a withdrawal and emails a confirmation link · Login session - [GET /api/dashboard/affiliate/referrals](https://atmorouter.dev/docs/affiliate) Referred accounts and their status · Login session - [GET /api/dashboard/affiliate/ledger](https://atmorouter.dev/docs/affiliate) Commission ledger · Login session - [POST /api/dashboard/affiliate/payouts/confirm](https://atmorouter.dev/docs/affiliate) Confirms a parked withdrawal using the single-use token from the emailed link; no session required · Public - [POST /api/dashboard/affiliate/payouts/resend](https://atmorouter.dev/docs/affiliate) Re-sends the confirmation email, replacing the previous link; rate limited · Login session - [GET /api/public/family-usage](https://atmorouter.dev/docs/management-api#get-api-public-family-usage) Aggregate billed requests and tokens by model family · Public - [GET /api/public/stats](https://atmorouter.dev/docs/management-api#get-api-public-stats) Aggregate statistics for the public website · Public - [GET /api/public/rankings/models](https://atmorouter.dev/docs/management-api#get-api-public-rankings-models) Period leaderboard when public rankings are enabled · Public - [GET /api/public/rankings/market-share](https://atmorouter.dev/docs/management-api#get-api-public-rankings-market-share) Weekly request share when public rankings are enabled · Public - [GET /api/public/rankings/apps](https://atmorouter.dev/docs/management-api#get-api-public-rankings-apps) Approved app rankings when public rankings are enabled · Public - [GET /api/public/rankings/categories](https://atmorouter.dev/docs/management-api#get-api-public-rankings-categories) Request context distribution when public rankings are enabled · Public - [GET /api/public/rankings/performance](https://atmorouter.dev/docs/management-api#get-api-public-rankings-performance) Measured stream throughput and first-byte timing when public rankings are enabled · Public - [GET /api/public/rankings/history](https://atmorouter.dev/docs/management-api#get-api-public-rankings-history) Model activity history when public rankings are enabled · Public - [GET /api/public/rankings/summary](https://atmorouter.dev/docs/management-api#get-api-public-rankings-summary) Top five qualifying models when public rankings are enabled · Public - [GET /api/public/status](https://atmorouter.dev/docs/management-api#get-api-public-status) Overall and upstream availability with measured timing samples · Public - [GET /api/announcement](https://atmorouter.dev/docs/management-api#get-api-announcement) Current public website announcement · Public ## Compatibility notes Use an AtmoRouter ar- key; credentials are not interchangeable across providers. Create a replacement key, update your clients, then revoke the old key. No rotation grace period is built in. The Anthropic SDK base is https://atmorouter.dev. Raw HTTP still calls /v1/messages. Retry transient 429/502/503 failures with backoff before output. Retrying a partial answer can duplicate work and charges. Failed requests before output are refunded. Interrupted requests can be billed for processed tokens. Inference uses ar- keys; dashboard APIs use a login session. Public catalog/status endpoints need no credential. Usage is account-scoped. Duration, first byte, and first answer text measure different points in the response. Available payment methods, exchange rates, and eligibility come from the dashboard; inspect the invoice before paying. The catalog can list non-text modalities. Image/video generation and embeddings endpoints are not implemented here. The catalog all=1 parameter is a read filter, not a way to enable a model. Market data is a public JSON snapshot, not an SSE subscription. Combo management supports GET/POST/DELETE only. Call private combo/ aliases through Chat Completions or Messages with an owner API key. --- # AtmoRouter — Compatibility Source: https://atmorouter.dev/docs/compatibility AtmoRouter is a metered gateway with two inference protocols. Match your client to an implemented protocol before changing its base URL. Examples use illustrative model IDs; check the live catalog before deploying. ## Protocol support | Capability | Contract | | --- | --- | | OpenAI Chat Completions | POST /v1/chat/completions: JSON, SSE, and model-dependent tools/structured output. | | Anthropic Messages | POST /v1/messages: JSON and native SSE. max_tokens is required. | | Model discovery | GET /v1/models: public retail catalog; a valid owner API key also includes that account’s callable combo/ IDs. The public response alone does not validate a key. | | OpenAI Responses API | No public /v1/responses endpoint. The helper offers an explicit localhost Codex bridge for a limited stateless text and function-tool subset. | | Embeddings, image/video/audio generation | No dedicated generation or embeddings endpoints. Catalog metadata is not a promise of callable modality support. | | MCP and publisher management | No public AtmoRouter MCP server or publisher API. | | Combos | Private combo/ IDs work in Chat Completions and Anthropic Messages with an owner API key. Choose round-robin, failover, or cheapest; member eligibility and normal billing still apply. | | Provider-specific extensions | Unknown inference fields may be forwarded; support and behavior depend on the upstream model. | ## Client compatibility is more than a base URL Select a Chat Completions-compatible provider in your agent. For OpenCode use `@ai-sdk/openai-compatible`. The helper configures Claude Code, OpenCode, Oh My Pi, and Continue, guides supported IDE settings, and can explicitly launch a local Codex bridge. Token-counting endpoints, built-in Responses tools, stateful sessions, and other provider extensions can remain incompatible. Agent features depend on the client and model. ## Migration checklist 1. Create an AtmoRouter key; provider keys are not portable. 2. Choose an enabled model with the features your application needs. 3. Set the protocol-specific base URL and send a short bounded request. 4. Check text/tool behavior, streaming completion, recorded usage, and cost. 5. Move traffic gradually; keep the previous configuration available for rollback. --- # AtmoRouter — Models & pricing Source: https://atmorouter.dev/docs/models Only endpoints that intentionally differ from the standard API carry a chip; the chip links to the note that explains the difference. Model ids use the form `family/model`, for example `cbcn/glm-5.3` or `cc/claude-opus-5`. The prefix identifies which upstream family serves the model. Call `GET /v1/models` for the live catalogue, or browse `Dashboard → Models & pricing` with prices attached. `/v1/models` `/api/dashboard/catalog` With a valid owner API key, `GET /v1/models` also includes your private `combo/` aliases. Unauthenticated catalog responses contain ordinary models only. See [Combos](https://atmorouter.dev/docs/combos) for routing, permissions, and billing. Image and video are visible, not callable. Image and video models appear in the catalogue but cannot be called: the gateway exposes no `/v1/images`, `/v1/videos` or generations endpoint — inference is chat and messages only. `modality` is a catalogue label passed through from upstream (upstream/), not a capability gate: nothing in the inference path checks it. What decides a call is priced plus enabled plus your key allowlist. Catalogue filter, not a toggle. `GET /api/dashboard/catalog?all=1` is a read filter that includes unpriced models; there is no user-facing toggle to enable or disable catalogue entries. Enabling stays operator-side. Some models answer on one protocol only. A listed model is not automatically callable on both surfaces. Some entries are served on the OpenAI-compatible surface only: `POST /v1/messages` for such an id returns `404 not_found_error` before any hold or charge, while the same id keeps working on `POST /v1/chat/completions`. Use the error type rather than assuming every catalogue entry is reachable from both endpoints. bash ``` curl https://atmorouter.dev/v1/models \ -H "Authorization: Bearer ar-xxxxxxxxxxxx" ``` json ```json { "object": "list", "data": [ { "id": "cbcn/glm-5.3", "object": "model", "owned_by": "atmorouter", "family": "CodeBuddy CN", "pricing": { "input": 0.42, "output": 2.1, "cached_input": 0.042 }, "context_length": 200000, "max_output_tokens": 8192, "modality": "text", "supports_cache": true } ] } ``` ## Pricing fields Marketplace prices are variable. A “From” price is the lowest advertised offer in the latest snapshot, not a fixed rate promised for every request. Offer tiers show final retail input and output rates in USD per million tokens. Availability counts offers in that snapshot; it does not promise free slots or count unique publishers. An offer whose rate would exceed the model's official list rate is not offered at all, so every tier you see is at or below official. Your charge uses the actual selected offer rate, subject to your budget. Use [Budgets](https://atmorouter.dev/docs/budgets) to require a minimum percentage off official input and output rates. `pricing.input` and `pricing.output` are USD per million tokens and are billed separately. Output is normally several times more expensive than input, so a chatty completion costs more than a long prompt. `pricing.cached_input` is the advertised cache-hit input rate. Use the selected offer's applicable cache rate when reconciling usage. Cached-input savings do not replace the input and output rate caps or the paid-request minimum. ## Prompt caching Models with `supports_cache: true` can reuse a repeated prompt prefix on second-and-later turns of the same conversation. Cached input tokens are reported in the usage block and bill at the selected offer's cache rate, so you can see the effect. Caching is a property of the upstream model, not something you enable per request. ## Catalogue changes The catalogue and its prices are refreshed continuously from live upstream capacity, so models can appear, disappear, or change price. A model priced above its own official list rate is not listed: it is not a premium offer and does not appear in `/v1/models`. Read the model list at startup rather than hardcoding it, and handle HTTP 404 for a model that is no longer available. ## Resolution: exact id, no aliases, no fallback The model string is looked up by exact id against the enabled catalogue. There is no alias mechanism, no bare-name resolution, and no fallback: a short name, a typo, a disabled entry, or an id that was never priced all answer the same way — HTTP 404 with `model_not_found`. Read `GET /v1/models` at startup and send the id verbatim. json ```json { "error": { "message": "model \"cbcn/glm-5.3\" not available", "type": "model_not_found" } } ``` Order matters when several checks could fire: a key allowlist miss answers 403 `model_not_allowed` before the catalogue is even consulted, and the 404 itself fires before any balance check. A 404 therefore never means your balance is empty — it means the id did not resolve. Image and video models are visible in the catalogue but not callable through any endpoint: the gateway exposes no image or video endpoint. Only chat and messages endpoints accept a model id today. --- # AtmoRouter — Tool calling & JSON Source: https://atmorouter.dev/docs/tool-calling Tool calling is passed through to the selected model. AtmoRouter does not execute your functions. Your application validates arguments, runs its own function, and returns the result in the next message. ## OpenAI function-calling round trip python ``` import json, os from openai import OpenAI client = OpenAI(api_key=os.environ["ATMOROUTER_API_KEY"], base_url="https://atmorouter.dev/v1") messages = [{"role": "user", "content": "What is the weather in Paris?"}] tools = [{"type": "function", "function": { "name": "get_weather", "description": "Get weather for a city", "parameters": {"type": "object", "properties": { "city": {"type": "string"}}, "required": ["city"]} }}] first = client.chat.completions.create(model="YOUR_MODEL_ID", messages=messages, tools=tools, max_tokens=256) message = first.choices[0].message messages.append(message.model_dump(exclude_none=True)) for call in message.tool_calls or []: if call.function.name != "get_weather": raise ValueError("Unexpected tool") args = json.loads(call.function.arguments) if not isinstance(args.get("city"), str): raise ValueError("Invalid city") # Replace this demo result with your weather service. result = {"city": args["city"], "temperature_c": 18, "demo": True} messages.append({"role": "tool", "tool_call_id": call.id, "content": json.dumps(result)}) if message.tool_calls: final = client.chat.completions.create(model="YOUR_MODEL_ID", messages=messages, tools=tools, max_tokens=256) print(final.choices[0].message.content) else: print(message.content) ``` Some models return a normal answer instead of tool calls. Handle both. Streamed tool names and arguments can be split across chunks: collect by tool-call index, wait for completion, then parse JSON and validate it. Never evaluate model-generated code. ## JSON and schema output python ``` response = client.chat.completions.create( model="YOUR_MODEL_ID", messages=[{"role":"user", "content":"Return a JSON object with a city field."}], response_format={"type":"json_object"}, max_tokens=128, ) value = json.loads(response.choices[0].message.content) if not isinstance(value.get("city"), str): raise ValueError("Unexpected result schema") ``` `response_format`, strict schemas, tool choice, vision input, and reasoning controls are model-dependent. A forwarded parameter is not a gateway guarantee. Anthropic tools use the native `tools`, `tool_use`, and `tool_result` shapes instead of OpenAI tool messages. --- # AtmoRouter — Streaming Source: https://atmorouter.dev/docs/streaming Only endpoints that intentionally differ from the standard API carry a chip; the chip links to the note that explains the difference. Set `stream: true` for server-sent events in exactly OpenAI's format. Chunks arrive as `data:` lines and the stream ends with `data: [DONE]`. `/v1/chat/completions` python ``` stream = client.chat.completions.create( model="cbcn/glm-5.3", messages=[{"role": "user", "content": "Count to five"}], stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if chunk.choices else None if delta: print(delta, end="", flush=True) ``` ## Usage on the final frame When stream_options is omitted, the gateway requests usage reporting. Providers may send usage before the final event, and interrupted or unsupported streams may omit it. Set stream_options.include_usage to true explicitly when your client needs usage frames; do not assume the last data frame always contains usage. text ``` data: {"choices":[{"delta":{"content":"1"}}],"object":"chat.completion.chunk"} data: {"choices":[],"usage":{"prompt_tokens":9,"completion_tokens":25,"total_tokens":34}} data: [DONE] ``` ## Cancelling a stream Disconnecting cancels the gateway request. How quickly the provider stops and reports usage depends on the upstream. An interrupted request can be billed for processed tokens; check its settled usage row. If you sit behind a reverse proxy, disable response buffering for this endpoint or chunks will be held back and appear to arrive all at once. We send `X-Accel-Buffering: no` to help nginx do the right thing. Retry only what is transient. Retry `429`, `502` and `503` with exponential backoff. `402` means your balance is empty, so top up instead of retrying. Never retry `400`, `401`, `403` or `404`. Interrupted stream billing. An explicit upstream stream error before output is refunded. Partial responses can be charged for processed tokens. Use the settled usage log rather than estimating cost from visible text. ## Anthropic streaming Messages uses named events and ends with `message_stop`, rather than OpenAI's `[DONE]` marker. Use the native SDK parser for this protocol. python ``` import os from anthropic import Anthropic client = Anthropic(api_key=os.environ["ATMOROUTER_API_KEY"], base_url="https://atmorouter.dev") with client.messages.stream( model="YOUR_MODEL_ID", max_tokens=256, messages=[{"role":"user", "content":"Count to five"}], ) as stream: for text in stream.text_stream: print(text, end="", flush=True) ``` text ``` event: content_block_delta data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"}} event: message_delta data: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":1}} event: message_stop data: {"type":"message_stop"} ``` ## Partial output and errors after HTTP 200 HTTP headers may already have been sent when an upstream fails. Inspect OpenAI `error` frames or Anthropic `event: error`, and detect a missing terminal event. Do not interpret HTTP 200 alone as a complete answer. Replaying after output can duplicate generated text, tool actions, and charges. A network chunk is not an SSE event: JSON, tool arguments, and UTF-8 characters can span multiple chunks. Buffer complete events or use a protocol-aware SDK. Reasoning, keepalive, and metadata may arrive before the first answer text; see [Usage & request timing](https://atmorouter.dev/docs/observability). --- # AtmoRouter — Usage & request timing Source: https://atmorouter.dev/docs/observability Use the dashboard Usage page or `GET /api/dashboard/usage?range=24h` with a login session. Responses contain the latest 200 requests in the selected range, newest first. An inference key does not grant access to dashboard history. ## Timing fields and units **latency_ms** Total server-side duration through settlement and logging. This is not the browser’s full network time. **ttft_ms** Time to the first streaming bytes flushed by the gateway. Metadata or keepalive bytes can arrive before text. **inference_metrics.first_output_ms** Time to the first answer, reasoning, or tool-output delta. **inference_metrics.first_content_ms** Time to the first answer-text delta, excluding reasoning. **inference_metrics.first_reasoning_ms** Time to the first reasoning delta, when present. **inference_metrics.before_upstream_ms** Time spent before starting the upstream request. **inference_metrics.upstream_header_wait_ms** Cumulative wait for response headers across upstream attempts. **inference_metrics.response_ms** Time until the gateway finishes reading the response, before final settlement. **inference_metrics.upstream_attempts** How many upstream attempts the request made. **inference_metrics.terminal_event** Whether a complete protocol terminal event was observed. Inspect this when investigating truncated streams. ## Effective throughput `output_tokens × 1000 / latency_ms` gives effective tokens per second for a successful request with a positive duration. It includes waiting and reported reasoning tokens. It is not generation-only TPS. Partial/error rows do not get a throughput value in the dashboard. ## Older requests and unknown measurements Older rows may have `inference_metrics: null`. First-byte timing can also be null on non-streaming requests. Missing values mean no measurement, not zero speed. A recorded zero-millisecond offset is valid and should remain zero. ## Request correlation and billing Record `X-Atmorouter-Request-Id` when supplied. Share the request ID, UTC timestamp, model, protocol, and client version with support; do not send keys or customer prompts. Settled usage history is the reconciliation source. A final-charge HTTP header cannot be added after an SSE response has begun; consume reported stream usage and check the settled log. ## Playground and service status `POST /api/dashboard/playground/chat` uses your login session and the same inference billing core, with no API key ID. `GET /api/public/status` reports request-weighted service availability; quiet windows are not synthetic uptime measurements. Family differences remain available under upstream details. ## Read a request’s billing receipt Open a request in Usage to inspect its Billing receipt, Request price limits, and Failure details. New receipts are recorded prospectively at request time. Older requests may show historical billing receipts or rule details as unavailable; current catalogue prices are never used to reconstruct a historical bill. The total charged is the recorded settlement amount. A verified aggregate total does not establish separate input, cached-input, or output rates: a receipt with `basis: verified_total` leaves those component rates unreported. Separate rates and component costs appear only when recorded and supported by the billing basis. An effective blended rate divides the total by billed tokens and can include minimum charges and rounding; it is not an actual component token price. The recorded minimum request charge is a threshold, not the actual total charged. Its presence does not mean a charge occurred. The receipt identifies when the settled charge equals that minimum. Read the total charged independently of the response status: a failed or interrupted response and its billing outcome are separate records. Request price limits retain the effective caps, pricing snapshot, and applied catalogue, account, API-key, and request rules captured for that request. These are immutable request-time snapshots; editing a budget later does not change the historical receipt. Percentage rules show their recorded discount and resulting caps when available. Missing historical rules remain unavailable. ## Interpret a failure and its source Failure details show a canonical reason and source when evidence is available; an unknown reason remains unavailable. For example, `provider_balance_unavailable` describes model-provider billing capacity, not your customer account balance. A customer-facing `insufficient_balance` refusal instead calls for reviewing your account’s Billing page. Do not infer either cause from a generic HTTP status alone. The What you can do section suggests a next step based on the recorded failure. For capacity or price-limit failures, the recorded rules identify whether the catalogue ceiling, a stricter saved budget, client price headers, or both constrained the request. A saved rule that did not tighten the catalogue ceiling is not a reason to raise your budget. Creating or increasing a budget cannot raise the catalogue ceiling. If historical rules are unavailable, the page does not guess which setting to change. Retry temporary capacity failures after a short delay or choose another model. Follow `Retry-After` when provided. Review any partial output and the recorded charge before resending an interrupted request: a new request can repeat work and incur another charge. Usage is request history, not a complete audit of every preflight rejection. Authentication, customer balance, or price-limit refusals made before forwarding may not appear in Usage. Preserve the client error and request identifier for diagnosis. See [Errors & retries](https://atmorouter.dev/docs/errors) for the next action. --- # AtmoRouter — Rate limits Source: https://atmorouter.dev/docs/rate-limits Only endpoints that intentionally differ from the standard API carry a chip; the chip links to the note that explains the difference. Every budget below renews on a fixed window and answers `429` when spent. Find your number in the table, check whether that `429` carries a `Retry-After` header, and react accordingly. A `402` is never a rate limit — it means your balance is empty, so top up instead of retrying. `/v1/chat/completions` `/api/dashboard/playground/chat` `/api/dashboard/login` ## Your budgets at a glance | Surface | Limit | Scope | When exceeded | | --- | --- | --- | --- | | Inference (OpenAI + Anthropic) | Your key's rate_limit per minute (default 500; explicit 1..1000, anything else 400) | Per account — all keys combined | 429, no Retry-After; back off or ask support to raise it | | Playground chat (dashboard session) | 20 requests/min | Per signed-in user | 429, no Retry-After | | Concurrent requests at low balance | Up to $0.05: 1 in flight; up to $0.25: 3; above $0.25: unbounded | Per account | 429, no Retry-After; let requests finish or top up | | Free-model fair-use (atmo/* promo) | 100M lifetime tokens per account; $1 lifetime deposits to unlock (both admin-configurable) | Per account | 429 naming the remedy; paid models unaffected | | Sign-in + password step-up | 20 tries per IP + 8 per account per 15 min; 15-min lockout | Per IP and per account | 429 with Retry-After; wait the stated seconds | | Signup email sends | 3 per email/hour; 20 per IP/hour; 90 global/day; 2700 global/month; 1-min resend cooldown (defaults) | Per email / IP / global | 429 code rate_limited with Retry-After + retry_after_seconds | | Signup completion | 30 per IP/hour; 120 global/hour (defaults) | Per IP / global | Same 429 shape as email sends | | Provider webhooks | 30/min per IP on every callback | Per client IP | 429 with Retry-After | Your inference budget belongs to your account, not to any single key: every request counts against the owning user's per-minute window, so minting extra keys never multiplies it. Omit `rate_limit` when creating a key and it resolves to 500; an explicit value must be between `1` and `1000` — anything else (including `0` and negatives) is rejected with `400`. The catalogue read (`GET /v1/models`) carries no per-minute budget. ## What a 429 looks like Inference refusals quote your account's own limit back at you. On the OpenAI surface: json ```json { "error": { "message": "rate limit exceeded: 500 requests/min for your account (all keys combined) — wait a minute or contact support to raise it", "type": "rate_limit_exceeded" } } ``` The Anthropic surface carries the same message in its own envelope: json ```json { "type": "error", "error": { "type": "rate_limit_error", "message": "rate limit exceeded: 500 requests/min for your account (all keys combined) — wait a minute or contact support to raise it" } } ``` Playground refusals are shorter (`rate limit exceeded` with type `rate_limit_exceeded`), and tired-balance refusals say `too many concurrent requests for current balance — wait for in-flight requests to complete or top up`. Free-model refusals carry the promo message with type `rate_limit_exceeded` and code `free_tier_quota_exceeded` on the OpenAI surface (`rate_limit_error` on Anthropic). Signup refusals use code `rate_limited`. | Who answers 429 | Retry-After? | Body signal | | --- | --- | --- | | Inference, playground, low-balance concurrency, free-model quota, upstream passthrough | No — back off exponentially | OpenAI envelope (Anthropic envelope on /v1/messages) | | Sign-in, password step-up, account-deletion confirm | Yes — wait the stated seconds | {"error": "..."} string plus the header | | Signup register / resend / complete | Yes, plus retry_after_seconds in the body | {"error": {"code": "rate_limited", ...}} | | Provider webhooks (sumopod, epusdt) | Yes — wait the stated seconds | {"error": "too many webhook calls"} | We send no `X-RateLimit-*` headers. The `429` itself — plus `Retry-After` where the table above says so — is the only rate signal. ## Staying under Honor `Retry-After` wherever it is present; otherwise back off exponentially — the full retry pattern lives under [Errors](https://atmorouter.dev/docs/errors) and is not repeated here. Keep concurrent requests serialized while your balance is thin, or top up past $0.25 to lift the concurrency cap entirely. Paid models are never gated by the free-model quota: a free-model `429` names its own remedy in the message. Retry only what is transient. Retry `429`, `502` and `503` with exponential backoff. `402` means your balance is empty, so top up instead of retrying. Never retry `400`, `401`, `403` or `404`. Inference, playground, sign-in and webhook budgets are counted in memory per gateway process: a restart clears them, and replicas do not share them. Signup email quotas live in the database and survive restarts. Signup quota defaults shown here are operator-configurable via environment. ## Where these numbers come from These are the live gateway defaults; if one changes, this page changes with it. | Number | | --- | | Sliding 1-min window; legacy limits ≤ 0 fall back to the 500 default | | 500 default on omit; explicit 1..1000, anything else → 400 | | Per-user enforcement (all keys combined) | | Playground 20/min | | Concurrency 1 / 3 / unbounded | | Sign-in 20 + 8, 15-min window + lockout | | Retry-After senders (auth, signup, webhooks) | | Signup quotas + 429 shape | | Free-model quota + refusal shape | | Upstream 429 passthrough | --- # AtmoRouter — Errors & retries Source: https://atmorouter.dev/docs/errors Only endpoints that intentionally differ from the standard API carry a chip; the chip links to the note that explains the difference. For paid requests, a zero rate cap, a 100% minimum discount, missing official rates under an applicable percentage rule, unavailable offers within your caps, or a fixed-price model listed above your cap can refuse a request without charge. See [Budgets](https://atmorouter.dev/docs/budgets) before loosening limits or retrying. Routing wait is separate from generation time. Each surface below names its own envelope: inference answers typed envelopes, dashboard and affiliate answer a plain-string error, webhooks mix JSON acks with plain-text bodies. Match the surface before parsing. `/v1/chat/completions` `/v1/messages`[Differs from standard](https://atmorouter.dev/docs/errors#C-anthropic-base) json ```json { "error": { "message": "balance too low for this request: top up to continue", "type": "insufficient_balance" } } ``` ## OpenAI surface — `POST /v1/chat/completions` Envelope `{"error":{"message","type"}}`: typed, except the message-only rows noted below. The session playground path shares this shape. | Status | Type | What it means | | --- | --- | --- | | 405 | (message only) | "method not allowed" — only POST serves this path. | | 400 | (message only) | "failed to read body" / "invalid JSON" — unreadable payload. | | 400 | invalid_request | "model is required". | | 400 | invalid_request | "messages must be a non-empty array" — empty arrays are rejected locally so no foreign upstream envelope leaks. | | 400 | invalid_request_error | "max_tokens must be a positive integer" — present but below 1 or not a number. | | 401 | invalid_api_key | "missing or invalid API key" (no ar- prefix) / "invalid API key" (unknown or revoked). | | 402 | insufficient_balance | Available balance cannot cover the reservation. Add funds or reduce the prompt or output cap. | | 402 | insufficient_quota (+code) | Free atmo/ model without $1.00 lifetime deposits — "free model requires at least $1.00 in lifetime deposits". | | 403 | model_not_allowed | This key has an allowlist that excludes the model. | | 404 | model_not_found | Unknown model id. | | 429 | rate_limit_exceeded | Per-account per-minute budget spent, or "too many concurrent requests…" under a thin balance. No Retry-After — back off. | | 429 | balance_temporarily_reserved | Other requests are temporarily reserving the balance. Wait for them to finish, then retry; this does not establish that a top-up is required. | | 429 | rate_limit_exceeded (+free_tier_quota_exceeded) | Promo token quota spent; watch the spelling, tier not free-tier. | | 429 | rate_limit_error | "upstream rate limit exceeded, please retry shortly" — provider-side limit, retry with backoff. | | 502 | upstream_error | "upstream unavailable" / "upstream provider error" / "upstream service error" — hold refunded, nothing billed. | | 503 | upstream_error | "service temporarily unavailable" — a provider 402 mapped here, never a billing state. | | 503 | availability_error + code: price_limit_unavailable | No qualifying offer was available within your price limits. This rejected request is not charged. Review Budgets or retry later; limits are never raised automatically. | | 429 / 503, or an SSE error inside HTTP 200 | no_capacity / capacity_saturated | Providers within the effective price ceilings are busy. Follow Retry-After or error.retry_after_seconds. error.retryable is false if the stream has already produced output. | | 503 | model_route_cooling_down | Repeated connection failures pause the model route. Repeated capacity refusals pause its effective price scope. Follow Retry-After and error.retry_after_seconds. The rejected request is not forwarded or charged. | | 503 | availability_error + code: pricing_unavailable | Fresh pricing cannot be verified, including official rates needed by a percentage rule. This rejected request is not charged. Retry later; adding funds does not resolve pricing availability. | | 424 | upstream_error + code: billing_settlement_pending | Generation may already have completed. Accounting is recovering; do not automatically resend. Check Usage before sending another request. X-Should-Retry is false. | | 502 | upstream_error + code: billing_metadata_unavailable | The model response had incomplete or invalid billing metadata. This response is not charged. | | 500 | (message only) | "streaming unsupported" — client cannot flush SSE. | Other upstream 4xx pass through with their original status after sanitization: provider names and hostnames are replaced with neutral wording, and key-like strings become `sk-***`. Streaming errors use the same error codes inside SSE events after HTTP headers have been sent. A billing_settlement_pending event must not trigger an automatic replay; inspect Usage first. ## Anthropic surface — `POST /v1/messages` Envelope `{"type":"error","error":{"type","message"}}` so Anthropic SDKs parse it. SDK base URL is the bare host, no `/v1` suffix. json ```json { "type": "error", "error": { "type": "authentication_error", "message": "missing or invalid API key" } } ``` | Status | Type | What it means | | --- | --- | --- | | 405 | invalid_request_error | "method not allowed" — only POST serves this path. | | 400 | invalid_request_error | Unreadable body, bad JSON, missing model, empty messages, or a missing/non-positive max_tokens — max_tokens is required here, unlike the OpenAI path. | | 401 | authentication_error | "missing or invalid API key" / "invalid API key". | | 402 | invalid_request_error | Available balance cannot cover the reservation. Add funds or reduce the request size. | | 403 | permission_error | "model not allowed for this key" — note the type differs from the OpenAI 403. | | 404 | not_found_error | Unknown model id — note the type differs from the OpenAI 404. | | 429 | rate_limit_error | Per-account per-minute budget, thin-balance concurrency, promo-quota refusal message, or upstream limit — all share this type on this surface. | | 424 | api_error + code: billing_settlement_pending | Generation may already have completed. Accounting is recovering; do not automatically resend. Check Usage before sending another request. X-Should-Retry is false. | | 502 | api_error + code: billing_metadata_unavailable | The model response had incomplete or invalid billing metadata. This response is not charged. | | 500 | api_error | "streaming unsupported" — client cannot flush SSE. | | 502 | api_error | "upstream unavailable" / "upstream provider error" / "upstream service error" — hold refunded, nothing billed. | | 503 | api_error | "service temporarily unavailable". | | 503 | api_error + code: model_route_cooling_down | Follow Retry-After or error.retry_after_seconds. Capacity pauses follow the effective input/output ceilings, with customer limits isolated by account. The rejected request is not charged. | | 503 | api_error + code: price_limit_unavailable / pricing_unavailable | Read error.code to distinguish no offer within your limits from unavailable fresh pricing. Review Budgets for the former; retry later for either. Neither rejection is charged. | | 429 | rate_limit_error + code: balance_temporarily_reserved | Other requests temporarily reserve your balance. Wait for them to finish before retrying. | Other upstream 4xx are re-emitted with their original status: scrubbed text wrapped in this envelope, or cleaned JSON passed through unchanged. ## Dashboard and Management API — `/api/dashboard/…` Envelope `{"error":"…"}`: a plain string, except the nested signup envelope below. An `ar-` inference key never works here and answers `401`; unknown API paths answer the plain-text `404 page not found`. | Status | Body | What it means | | --- | --- | --- | | 405 | "method not allowed" | Wrong method on a dashboard route — login, keys, logout, topup status, epusdt webhook/status, sumopod webhook. | | 400 | "invalid JSON" / "invalid body" / "unreadable body" | Unparseable dashboard or webhook body. Combos create reports "invalid body" only after auth passes. | | 400 | "invalid key id" | Key DELETE with a malformed id — not UUID-shaped. | | 404 | "key not found" | Key DELETE with a well-formed id that is unknown or owned by someone else — scoped DELETE answers identically so ids cannot be probed. | | 400 | "user_id required" / "invalid id" | Missing user scope or a non-numeric QRIS invoice id. | | 404 | "topup not found" | Well-formed QRIS invoice id that is unknown or owned by someone else — the scoped read answers identically so ids cannot be probed. | | 400 | "invalid combo id" | DELETE id not UUID-shaped. | | 404 | "combo not found" | Well-formed DELETE id that is unknown or owned by someone else — scoped DELETE answers identically so ids cannot be probed. | | 401 | "invalid credentials" | Login: wrong password, unknown email, or unverified account — identical either way, with a dummy bcrypt comparison so timing matches. | | 401 | "not authenticated" | Missing or expired session; an ar- Bearer presented as a session cookie is rejected. | | 401 | "not authenticated" (401, account lookup failed) | Session cookie holds an id that no longer resolves to an account. | | 403 | "account is pending deletion" (+type) | Session is valid but the account is in the 7-day grace window — cancel deletion to continue. | | 403 | "current password incorrect" / "password incorrect" | Reset-password or delete-account confirm with the wrong password. | | 403 | "QRIS payment is disabled" / "affiliate program is disabled" | Admin kill-switch off for that rail or program. | | 409 | "you already have a withdrawal awaiting processing" | One affiliate payout in flight per user, any method. | | 410 / 415 / 413 / 403 (signup nested) | {"error":{"code","message"}} | Register/verify only: verification_invalid on expired links, unsupported_media_type, request_too_large, origin_rejected. Signup 429s carry a Retry-After header plus retry_after_seconds. | | 429 | "too many sign-in attempts …" | Login flood guard spent — 20 per IP plus 8 per account per 15 minutes; Retry-After says when to retry. | | 429 | "too many webhook calls …" | Provider-callback throttle: 30/min per IP, Retry-After attached. | | 429 | "wallet withdrawals are limited to … per day" | usdt only, counted per UTC day excluding rejected requests — a rejected request returns its reservation, so a same-day retry is allowed; api_balance is never limited. The number is policy-live (default 1) — the current value is rendered into the body. | | 500 | "could not start session" / "internal error" / "failed to generate secure key" | Session-store or store failure across the dashboard surface: login, keys list/create/delete (entropy included), usage, deposits, combos create/delete, payouts, topup and epusdt order reserve. Duplicate combo slugs return 409 (the slug is unique per account). | | 502 | "failed to create payment order" / "failed to create payment" | Provider order creation failed; the reserved order is marked failed — re-create and pay only the newest invoice. | | 503 | "… not configured …" | Rail checked before field validation: Epusdt, QRIS, or the signup service. | Deposit and payout shapes beyond errors live where they belong: order lifecycle and idempotency under Billing, payout validation under Affiliate §6. ## Webhooks — provider callbacks, not user API These routes take provider signatures, never user credentials. Integrators only need the non-2xx rows (your server never calls these); the 200 rows matter to webhook operators deciding whether a delivery will be retried. Unknown networks and tokens are terminal non-credits — acked so the provider does not loop the same payload. | Status | Body | What it means | | --- | --- | --- | | 405 | {"error":"method not allowed"} | Non-POST on a webhook path. | | 429 | {"error":"too many webhook calls …"} | Epusdt/Sumopod throttle: 30/min per IP with Retry-After. | | 401 | {"error":"bad signature"} / {"error":"unauthorized"} | Epusdt HMAC mismatch — never logged with the expected value; Sumopod Svix/token rejection. | | 400 | {"error":"invalid JSON"} | Unparseable Epusdt callback body. Sumopod answers 200 ignored parse_failed instead; see Billing for the full ack matrix. | | 200 | {"status":"ignored"/"rejected"} or plain ok | Epusdt: settleable callbacks ack plain-text ok; non-payable answer 200 JSON with no credit. QRIS answers 200 JSON with a named reason. | | 500 | {"order_id","status","error"} / {"ok":false,…} | Transient settlement failure — the provider retries. Deterministic rejects stay 200 so the provider does not loop. | ## Affiliate — `/api/dashboard/affiliate/…` Envelope `{"error":"…"}`: the same plain string as dashboard. Full validation order and policy numbers live in Affiliate §6 — this table pins the error surface only. Check `pending_payout` and `pending_verification` in the summary before requesting: either one means a withdrawal is already live. | Status | Body | What it means | | --- | --- | --- | | 401 | {"error":"not authenticated"} | Missing session, or an ar- key presented as session — only POST creates a payout; other methods return the list, not 405. | | 400 | {"error":"invalid request"} | Unparseable payout body (4 KB cap). | | 400 | {"error":"invalid payout method" / "invalid amount"} | Method not usdt/api_balance (trimmed, case-folded); amount ≤ 0, NaN, or infinite. | | 400 | "minimum withdrawal is … USDC" | Below the live minimum for the selected method — usdt uses min_withdraw, api_balance uses min_withdraw_api_balance (default 0, no minimum) — at the request or re-checked at the confirmation. | | 400 | "a valid Solana wallet address is required" | usdt address outside 32–44 chars — length only, never verified real. | | 400 | {"error":"insufficient affiliate balance"} | No wallet, or the atomic reserve found too little — at the request, or the balance fell between the request and the confirmation. | | 400 | {"error":"invalid or expired payout token"} | Confirmation only: the token is wrong, expired, or already used — one message for all three, deliberately. | | 400 | {"error":"token is required"} | Confirmation only: the body carried no token. | | 403 | {"error":"affiliate program is disabled"} | Program kill-switch off. | | 404 | {"error":"not found"} | Unknown sub-path after auth. | | 409 | "you already have a withdrawal awaiting processing" | One in-flight payout per user, any method. The request answers it while a payout is in flight; the confirmation answers it when one was created in between. | | 429 | "wallet withdrawals are limited to … per day" | usdt daily quota per UTC day, evaluated at the confirmation step — rejected requests excluded, so a same-day retry after a reject is allowed; api_balance never limited. | | 500 | "could not …" | Store failure: prepare referral code, load referrals/payouts/ledger, start or record payout. | ## Retry guidance Retry `429`, `502` and `503` with exponential backoff. When a `429` carries a `Retry-After` header (login, step-up checks and webhooks send one), wait that many seconds instead of guessing. Inference and playground `429`s carry no such header, so back off there. Do not retry `400`, `401`, `403` or `404`, as they will fail identically until you change the request. Treat `402` as an alert to top up rather than a transient fault. python ``` import time from openai import OpenAI, APIStatusError def call(**kw): for attempt in range(5): try: return client.chat.completions.create(**kw) except APIStatusError as e: if e.status_code in (429, 502, 503) and attempt < 4: # Honor Retry-After where the gateway sends one; otherwise back off. time.sleep(float(e.response.headers.get('Retry-After', 2 ** attempt))) continue raise ``` A failed upstream request costs you nothing. We only deduct balance once a request settles with a usage report. Anthropic errors use a different envelope. The table above shows the OpenAI envelope. The Anthropic surface instead returns `{"type":"error","error":{...}}` so Anthropic SDKs parse it, and its base URL carries no `/v1` suffix. Retry only what is transient. Retry `429`, `502` and `503` with exponential backoff. `402` means your balance is empty, so top up instead of retrying. Never retry `400`, `401`, `403` or `404`. Failed requests are never billed. Upstream failures (`502` / `503`) settle with no usage report, so no balance is deducted. Billing happens only for requests that settle with token counts. --- # AtmoRouter — SDKs & agents Source: https://atmorouter.dev/docs/sdks Install the SDK for your selected protocol, choose an enabled model from the catalog, and keep your AtmoRouter key in `ATMOROUTER_API_KEY`. Do not put a real secret in source control. bash ``` python -m pip install openai anthropic\n# JavaScript projects:\nnpm install openai @anthropic-ai/sdk ``` ## OpenAI Python python ``` import os from openai import OpenAI client = OpenAI( api_key=os.environ["ATMOROUTER_API_KEY"], base_url="https://atmorouter.dev/v1", ) response = client.chat.completions.create( model="cbcn/glm-5.3", max_tokens=128, messages=[{"role": "user", "content": "Hello!"}], ) print(response) ``` ## OpenAI JavaScript javascript ``` import OpenAI from "openai"; const client = new OpenAI({ apiKey: process.env.ATMOROUTER_API_KEY, baseURL: "https://atmorouter.dev/v1", }); const response = await client.chat.completions.create({ "model": "cbcn/glm-5.3", "messages": [ { "role": "user", "content": "Hello!" } ], "max_tokens": 128 }); console.log(response); ``` ## Anthropic Python python ``` import os from anthropic import Anthropic client = Anthropic( api_key=os.environ["ATMOROUTER_API_KEY"], base_url="https://atmorouter.dev", ) response = client.messages.create( model="cbcn/glm-5.3", max_tokens=128, messages=[{"role": "user", "content": "Hello!"}], ) print(response) ``` ## Claude Code Set the bare host as the Anthropic base URL and select a model suited to the agent’s tool-use requirements. Restart the agent after changing its environment. bash ``` export ANTHROPIC_BASE_URL="https://atmorouter.dev" export ANTHROPIC_AUTH_TOKEN="$ATMOROUTER_API_KEY" export ANTHROPIC_MODEL="YOUR_MODEL_ID" claude ``` ## OpenCode Use the Chat Completions adapter and an environment reference for the secret: json ```json { "$schema": "https://opencode.ai/config.json", "provider": { "atmorouter": { "npm": "@ai-sdk/openai-compatible", "name": "AtmoRouter", "options": { "baseURL": "https://atmorouter.dev/v1", "apiKey": "{env:ATMOROUTER_API_KEY}" }, "models": { "YOUR_MODEL_ID": { "name": "YOUR_MODEL_ID" } } } }, "model": "atmorouter/YOUR_MODEL_ID" } ``` [The setup helper](https://atmorouter.dev/docs/helper) generates these settings with backups. See [Compatibility](https://atmorouter.dev/docs/compatibility) before configuring a Responses-based client. Agent versions and model capabilities can change independently of the gateway. ## Upstream client references - [OpenAI Chat Completions reference](https://developers.openai.com/api/reference/python/resources/chat/subresources/completions/methods/create) - [Claude Code gateway documentation](https://code.claude.com/docs/en/llm-gateway) - [OpenCode custom providers](https://opencode.ai/docs/providers/) --- # AtmoRouter — Setup helper Source: https://atmorouter.dev/docs/helper Use the official AtmoRouter helper to configure coding agents, get IDE setup instructions, find model IDs, and check an API key without running inference. It previews automatic configuration changes and backs up existing settings. The optional Codex bridge runs only when explicitly started and forwards normal paid inference. ## Run the helper Install Node.js 22 or newer, then run this command in your terminal. No npm account or repository access is required. bash ``` npx @atmorouter/helper ``` The official npm package is [`@atmorouter/helper`](https://www.npmjs.com/package/@atmorouter/helper). Version 0.2.4 is available on npm and in the website archive below, with capacity cooldown and bounded retry guidance. [Download the package](https://atmorouter.dev/downloads/atmorouter-helper-0.2.4.tgz) · [SHA-256 checksum](https://atmorouter.dev/downloads/atmorouter-helper-0.2.4.tgz.sha256) ## Choose a model and preview a connection Replace `YOUR_MODEL_ID` with an ID returned by the models command: bash ``` npx @atmorouter/helper@0.2.4 models --search claude npx @atmorouter/helper@0.2.4 configure --target opencode --model YOUR_MODEL_ID npx @atmorouter/helper@0.2.4 configure --target claude --model YOUR_MODEL_ID --write ``` The wizard lists live text models and previews a plan. Configuration files are written only after confirmation or an explicit `--write --yes`. Existing JSON or YAML settings are merged and changed files get a timestamped backup. Malformed documents, JSONC, and ambiguous existing configuration require a manual merge. ## Keep credentials in your environment The helper does not print or save your API key. Set `ATMOROUTER_API_KEY` using your shell or secret manager. OpenCode reads that variable. For Claude Code, also set `ANTHROPIC_AUTH_TOKEN` to the same key before launching the agent. bash ``` # POSIX shell; set ATMOROUTER_API_KEY privately first export ANTHROPIC_AUTH_TOKEN="$ATMOROUTER_API_KEY" # PowerShell $env:ANTHROPIC_AUTH_TOKEN = $env:ATMOROUTER_API_KEY # Optional zero-inference key check (uses the environment, never a key argument) npx @atmorouter/helper@0.2.4 check-key ``` `GET /v1/models` has a public catalog response and adds private combos for a valid owner key; ordinary catalog entries alone cannot validate a key. The explicit key check sends an empty Chat Completions body: a valid active key is rejected locally with HTTP 400 “model is required”, before model lookup, billing, or upstream inference. An invalid key returns 401. A 429 is inconclusive; wait and try later. ## Troubleshooting and restoring settings Use `--version` to check the installed version and `--help` to list commands. A network error means the catalog or gateway could not be reached. Invalid JSON, JSONC, or existing credential settings require a manual merge; the helper leaves those files unchanged. To undo an applied change, stop the agent and restore its timestamped `.atmorouter-backup-*` file after preserving any later edits. For support, share the helper version, agent version, model ID, and error message; never share a key or an unredacted settings file. ## Automatic configuration Targets `claude`, `opencode`, `omp` (Oh My Pi), and `continue` merge their JSON or YAML configuration. Oh My Pi uses `~/.omp/agent/models.yml` with `api: openai-completions` and an environment variable name for the key. Continue uses `~/.continue/config.yaml`; manually set its `ATMOROUTER_API_KEY` secret in `~/.continue/.env` for the IDE. The helper writes a secret reference and never writes the key. Targets `openai` and `anthropic` print shell snippets. bash ``` npx @atmorouter/helper@0.2.4 targets npx @atmorouter/helper@0.2.4 configure --target omp --model YOUR_MODEL_ID npx @atmorouter/helper@0.2.4 configure --target continue --model YOUR_MODEL_ID ``` ## Guided IDE setup Targets `cursor`, `vscode`, `cline`, and `roo` print steps for your client UI. Cursor custom keys apply to Chat, not Tab completion; use its OpenAI base URL override where available. In VS Code Copilot Chat, use Manage Language Models → Add Models → Custom Endpoint; the older OpenAI Compatible setting is deprecated. Cline and Roo use OpenAI Compatible, and Roo requires native tool calling from the model. Enter credentials in each client's own settings. `antigravity` prints an unsupported-integration diagnostic. Antigravity's native IDE has no documented custom endpoint or authenticated SDK path suitable for this helper; it is not listed as compatible. ## Codex through a local bridge The public gateway does not implement `/v1/responses`. The optional helper bridge listens on localhost and translates a limited Responses subset to Chat Completions. Set `ATMOROUTER_API_KEY`, then explicitly launch it: bash ``` # Print setup instructions only npx @atmorouter/helper@0.2.4 configure --target codex --model YOUR_MODEL_ID # Launch your installed Codex CLI with a temporary localhost bridge npx @atmorouter/helper@0.2.4 codex --model YOUR_MODEL_ID # Or start a standalone bridge and follow its printed instructions npx @atmorouter/helper@0.2.4 bridge --port 43187 ``` The bridge supports stateless text, function tools, and streaming. Unsupported built-in tools and stateful Responses features are rejected; complete Responses compatibility, images, and audio are not promised. The launcher disables hosted web search for this run and preserves Codex permission defaults. Reasoning summaries and encrypted reasoning output are unavailable. Calls are billed normally to your AtmoRouter key. Previewing `configure --target codex` does not start a server or write settings. ## Client documentation [Cursor API keys](https://cursor.com/help/models-and-usage/api-keys) · [VS Code language models](https://code.visualstudio.com/docs/agent-customization/language-models) · [Oh My Pi](https://github.com/can1357/oh-my-pi) · [Continue secrets](https://docs.continue.dev/customize/deep-dives/secrets) · [Cline](https://docs.cline.bot/provider-config/openai-compatible) · [Roo Code](https://docs.roocode.com/providers/openai-compatible) ## Set a price budget before using your client The setup helper configures your client; it does not create or change price budgets. After automatic setup, a preview, manual IDE configuration, or bridge setup, open [Budgets dashboard](https://atmorouter.dev/dashboard/budgets). Select the actual API key used by the client and save an all-model percentage rule for broad coverage. Illustrative examples only: 20% below official rates or 50% below official rates; review the rates and choose your own limit. A family or exact-model rule provides narrower coverage. Account and key rules both apply; the strictest input and output limits win. Client setup and key checks do not prove that an offer is currently available within your limits. Market prices and tiers vary. A “From” price is a snapshot of the cheapest advertised offer, not a guaranteed execution price. Routing can wait up to 30 seconds for capacity within your caps. This wait is fixed; generation time is additional. Allow time for both in your client timeout. The local bridge defaults to a 120-second total timeout. ## Handle waiting and retries in your harness For 429 or temporary availability failures, honor `Retry-After` when present; otherwise use bounded exponential backoff with jitter. Avoid blind retries and duplicate in-flight requests. After a timeout or interrupted stream, review the client outcome and usage before deciding to resend. Never raise price caps automatically. Correct invalid requests before retrying. For authentication errors, check the key and account eligibility. For insufficient balance, review Billing; adding funds does not fix pricing availability. A `price_limit_unavailable` refusal calls for waiting for capacity within your caps or deliberately reviewing your budget. See [Budgets](https://atmorouter.dev/docs/budgets) for price limits and [Errors & retries](https://atmorouter.dev/docs/errors) for error-specific actions. --- # AtmoRouter — API keys Source: https://atmorouter.dev/docs/api-keys Only endpoints that intentionally differ from the standard API carry a chip; the chip links to the note that explains the difference. Two credentials for two surfaces. Inference takes a Bearer `ar-` key (or `x-api-key` header); the dashboard takes a session cookie. An `ar-` key never acts as a session, and a session cookie never authenticates inference. `/api/dashboard/keys` `/api/dashboard/keys/{id}` ## Key lifecycle without support Create keys with `POST /api/dashboard/keys` under your session. The key secret is shown in full exactly once at creation (prefixed with `ar-` followed by 48 hex characters) — save it immediately. Listing keys with `GET /api/dashboard/keys` returns a 12-character preview only. Revoking with `DELETE /api/dashboard/keys/{id}` immediately and permanently deletes the key. Only the SHA-256 digest and the non-usable display prefix are stored — the plaintext is not stored, so a database dump, backup, or replica never yields a usable key. Authentication looks up the digest; list and export read the prefix verbatim. No rotation, revoke and recreate. There is no key-rotation endpoint: rotation with a grace window is not available on Atmo today. You revoke the old key (`DELETE /api/dashboard/keys/{id}`) and create a new one; the old key stops working immediately, with no grace window. There is no read-only or config key kind — every user key is a full inference key. Grace rotation and read-only keys are not available today; treat them as roadmap, not as features, and rotate with manual overlap. ## Lifecycle operations | Action | Endpoint | Auth | Effect | | --- | --- | --- | --- | | Create | POST /api/dashboard/keys | Session | 201; full ar- key shown exactly once | | List | GET /api/dashboard/keys | Session | Key entries with a prefix-only preview, never the full secret | | Revoke | DELETE /api/dashboard/keys/{id} | Session | Immediate hard delete | | Revoke, bad id | DELETE /api/dashboard/keys/{id} | Session | 400 invalid key id | | Revoke, unknown id | DELETE /api/dashboard/keys/{id} | Session | 404 key not found | ## Key properties | Field | Meaning | | --- | --- | | name | Your label for the key. | | rate_limit | Requests per minute for your whole account (all keys combined). Absent: 500/min. Explicit: 1..1000 — anything else (including 0 and negatives) is rejected with 400. | | allowed_models | Optional allowlist of model IDs. Calls to any model outside the list are rejected with 403. | | enabled | Keys carry no toggle: revoking deletes the key immediately, and subsequent calls return 401. | | requests, last_used, created_at | Read-only telemetry returned by list. | ## Set price limits for one key Create a key, store its secret, then follow Set price budget beside the new key or Manage price budgets in [API Keys](https://atmorouter.dev/dashboard/keys). Budgets opens with that key selected. Choose All models for coverage across eligible paid models, or choose a family or exact model for narrower coverage, set a minimum discount, and save. Creating a key does not create a budget automatically. The key summary counts account limits and that key’s limits separately, including percentage rules and fixed model rates. A model-only rule does not cover the rest of the key’s traffic. All matching account and key limits intersect; the strictest input and output ceilings win. With no saved rules, catalogue price limits still apply. Budgets limit token rates, not total spend; the paid-request minimum still applies. The session-authenticated Playground uses account rules only. It does not exercise a particular API key’s budgets. Test key-specific behavior through your client using that key. Read [Budgets](https://atmorouter.dev/docs/budgets) for API examples and [Setup helper](https://atmorouter.dev/docs/helper) for client configuration. ## Roadmap, not features | Capability | Status | Operation today | | --- | --- | --- | | Grace-window rotation | Absent — delete is immediate and hard | Manual overlap: create new key, shift traffic, then delete old key | | Read-only / config-scoped keys | Absent — only allowed_models exists | Separate keys per app, narrow each allowlist | | Automated balance-check + key-creation snippets | Not yet offered | Use the dashboard, or adapt the curl examples on this page | --- # AtmoRouter — Budgets Source: https://atmorouter.dev/docs/budgets Budgets limit the input and output rates you accept for paid requests, in USD per million tokens. They are not a monthly spending allowance. Open [Dashboard → Budgets](https://atmorouter.dev/dashboard/budgets) to choose your target and minimum discount. ## Estimate tokens before setting limits Use the [Token Calculator](https://atmorouter.dev/calculator) to compare a hypothetical USD amount across current model price tiers. Choose input only, output only, or a mix by token count. Each estimate uses the input and output prices from one actual tier, with uncached input. The calculator does not make inference requests, deduct credit, or create budgets. Saved account and key rules are not included in its estimates. The lowest listed tier may have no free capacity. Expand a model to compare other tiers, then set your own rate limits in Budgets. Minimum charges per paid response, cached tokens and actual request sizes can change your effective token count. Free models remain subject to eligibility and quota; estimates are not context or output limits. ## From API key to saved budget In [API Keys](https://atmorouter.dev/dashboard/keys), choose Manage price budgets beside your key, or Set price budget immediately after creating it. The key is preselected in Budgets. Choose All models, a family, or an exact model, enter your minimum discount, review the price preview, and save. A draft has no effect until saved. Choose the account scope to apply a rule across your keys instead. The session Playground applies account rules only; it does not use a selected API key. A successful Playground request cannot verify that key’s rules. Use the key in your client for that check. The [setup helper](https://atmorouter.dev/docs/helper) configures clients and does not manage budgets. ## Choose all models, a family, or a model | Target | Scope fields | Applies to | | --- | --- | --- | | All models | scope_type: all; scope_value: empty string | Every paid model. | | Family | scope_type: family; scope_value: model-ID prefix, for example cb | Models sharing the first segment of the model id before /. The displayed family name is not accepted. | | Model | scope_type: model; scope_value: cbcn/glm-5.3 | One exact catalog model id. | | API key | Optional api_key_id on any target | Only that owned key; omit for an account rule. Key rules still intersect account rules. | ## How minimum discounts work A minimum discount of 25% accepts input and output rates at most 75% of that model's current official input and output rates, calculated independently. For illustrative official rates of $2 input and $8 output, the caps are $1.50 and $6 per million tokens. Percentage rules follow current official rates rather than a snapshot's cheapest offer. text ``` input_cap = official_input_rate × (1 − discount_percent / 100) output_cap = official_output_rate × (1 − discount_percent / 100) ``` Every matching account and API key rule applies, including all-model, family, and model rules. Exact model rate caps, request price headers, and catalog limits also apply. The lowest input cap and lowest output cap win independently. A broader or key-specific rule cannot loosen another limit. Removing a rule leaves every other applicable limit in place. The percentage must be finite and between 0 and 100. A 0% rule caps rates at official prices; it does not remove the rule. A 100% rule disables paid requests: it does not make paid models free. If an applicable percentage rule cannot be evaluated because official rates are missing or invalid, the paid request is refused without charge. For a fixed-price model, the listed rate is the only offer. A cap below that rate refuses the request; there is no cheaper capacity to wait for. Raise the cap (use a smaller discount) if you want the model to remain available. ## Routing wait, offers, and minimum charge Routing may wait up to 30 seconds for capacity within your caps. This duration is fixed; generation time is additional. Allow time for both routing and generation in your client timeout. If no qualifying offer is available, or a fixed-price model is listed above your cap, the request is refused without a charge. A “From” price is the cheapest advertised snapshot offer, not a guaranteed execution price. Availability counts offers, not free capacity. Every advertised tier is at or below the model's official list rate; offers that would exceed it are not listed. The paid-request minimum still applies to both holds and settled charges, including cached-input requests. Rate caps are not a cap on the total request cost. Read the current final USD minimum from `minimum_charge`; the amounts in these examples are illustrative. With no saved limits, marketplace requests remain bounded by catalog tiers; stale pricing fails closed. See [Billing](https://atmorouter.dev/docs/billing) for settlement. ## GET /api/dashboard/budgets Requires a dashboard login session; an inference API key cannot authenticate this API. Returns exact model rate caps in `budgets`, percentage rules in `rules`, and the current `minimum_charge`. bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/budgets ``` json ```json { "budgets": [{"model":"cbcn/glm-5.3","max_input_price":1,"max_output_price":3,"queue_wait_seconds":30}], "rules": [{"scope_type":"family","scope_value":"cb","discount_percent":25,"queue_wait_seconds":30}], "minimum_charge":0.000001 } ``` ## PUT /api/dashboard/budget-rules Create or replace a percentage rule for the same target and optional owned API key. Requires your dashboard session. Use `scope_type`, `scope_value`, and `discount_percent`. Omit `api_key_id` for the account rule. Queue wait accepts only 30 seconds, defaulting to 30 when omitted. bash ``` curl -b jar.txt -X PUT https://atmorouter.dev/api/dashboard/budget-rules \ -H 'Content-Type: application/json' \ -d '{"scope_type":"all","scope_value":"","discount_percent":25,"queue_wait_seconds":30}' ``` To target a family, use `{"scope_type":"family","scope_value":"cb","discount_percent":25}`. Use the first segment of the model id before `/`, for example `cb` for `cb/model-name`. To target one model and key, use the exact model id with `scope_type: model` and add the owned key's `api_key_id`. ## DELETE /api/dashboard/budget-rules Remove only the matching target and optional API key rule using the dashboard session. Send the same `scope_type` and `scope_value`, plus `api_key_id` if the saved rule belongs to a key. Discount and wait fields are not needed. bash ``` curl -b jar.txt -X DELETE https://atmorouter.dev/api/dashboard/budget-rules \ -H 'Content-Type: application/json' \ -d '{"scope_type":"all","scope_value":""}' ``` ## PUT /api/dashboard/budgets: exact rate caps Existing exact-rate budgets remain supported. Send an exact `model`, finite nonnegative `max_input_price` and `max_output_price`, optionally an owned `api_key_id`, and optionally `queue_wait_seconds: 30`. Zero on either rate disables paid requests. These caps intersect percentage rules. bash ``` curl -b jar.txt -X PUT https://atmorouter.dev/api/dashboard/budgets \ -H 'Content-Type: application/json' \ -d '{"model":"cbcn/glm-5.3","max_input_price":1,"max_output_price":3,"queue_wait_seconds":30}' ``` ## DELETE /api/dashboard/budgets Using your dashboard session, send `{"model":"cbcn/glm-5.3"}` and optionally `api_key_id` to remove one exact-rate budget. This does not delete percentage rules. ## Per-request price headers `x-max-input-price` and `x-max-output-price` express final retail USD per million tokens. They can tighten saved limits but cannot raise them. Zero disables paid requests locally. For example, add the headers below to an authenticated inference call; they cap the rates, while the paid-request minimum still applies. bash ``` -H 'x-max-input-price: 1' \ -H 'x-max-output-price: 3' ``` --- # AtmoRouter — Billing & deposits Source: https://atmorouter.dev/docs/billing Only endpoints that intentionally differ from the standard API carry a chip; the chip links to the note that explains the difference. You hold a prepaid balance in USD. Each settled request deducts its cost immediately; there is no invoice, no subscription and no seat count. `/api/dashboard/usage` `/api/dashboard/usage-stats` `/api/dashboard/balance` Prepaid dollars, two rails in. Balance is prepaid USD, deducted per settled request with a small per-request floor. Money arrives over two rails: QRIS invoices in rupiah with automatic credit and a hosted Epusdt checkout in USDT/USDC. The price applied is the live price at serve time, recorded in your usage log. ## How cost is computed text ``` token_cost = ((input_tokens − cached_tokens) × selected_input_rate + cached_tokens × selected_cached_input_rate + output_tokens × selected_output_rate) / 1,000,000 cost = max(token_cost, minimum_charge) ``` Token counts come from the upstream usage report, never from character estimation. Rates are the final retail rates of the actual selected offer. Cached input uses that offer's cache rate; cache-capable models with a 10% cache rate charge that fraction of the input rate. A per-request minimum applies to paid holds and settled charges. Read the current final USD amount from`minimum_charge` in `GET /api/dashboard/budgets`. Your usage log records the settled charge. If billing metadata cannot be verified, the request is not charged. ## Budgets and request price caps Budgets limit input and output rates rather than total monthly spend. Set minimum percentages off official rates for all models, a family, or one model, or use exact model rate caps. Set an account default and optionally a stricter budget for an individual API key. Both apply: each effective rate cap is the lower saved cap. Request headers `x-max-input-price` and `x-max-output-price` use final retail USD per million tokens and can only tighten those limits. Raising a header cannot bypass a saved budget. See [Budgets](https://atmorouter.dev/docs/budgets) for scope selection, percentage calculations, and saving or deleting limits. With no saved cap, marketplace requests remain bounded by the highest advertised catalog tier. These defaults refresh at least every 30 seconds; requests fail closed if the pricing snapshot is more than 120 seconds old. Static and free `atmo/` models use their own pricing rules. Routing may wait up to 30 seconds for capacity. Generation time is additional, so this is not a hard overall request timeout. A zero input or output cap disables paid requests for that budget. ## How a request reserves and settles A paid request reserves temporary spending headroom before forwarding, while your displayed balance stays unchanged until the request settles. The reservation is estimated from prompt size plus the output token limit — when neither `max_tokens` nor `max_completion_tokens` is provided on `/v1/chat/completions`, the gateway caps the injected output limit at 16,384 tokens (or lower if the model output limit, context window, or available balance is smaller) — with a small per-request minimum. A reservation that exceeds available funds answers 402 (or 429 when concurrent requests are holding funds) and nothing is forwarded. Once usage completes, the reservation is released and your balance is deducted once for the exact final charge without going below zero. For non-streaming completions, the exact charge is returned in the `X-Atmorouter-Cost` header. ## Deposit vouchers When deposit vouchers are enabled, enter a voucher on the Deposit page and select Apply before creating your invoice. A discount reduces the payment while preserving the deposit credit: a $10 deposit with a 20% discount costs $8 before fees and adds $10 to your balance. A $2 bonus on a qualifying $10 deposit costs $10 before fees and adds $12. Minimum deposits, dates, account limits, campaign limits and promotion budgets apply. Only one code can apply to an invoice. Payment method minimums still apply after discount; processing and network fees are separate. Fiat discounts round the payment up to a whole rupiah at the invoice exchange rate. Turning voucher entry off prevents new voucher invoices; issued invoices retain their saved promotion. Only one unpaid voucher invoice is allowed per account across campaigns, and five voucher checkouts per 10 minutes limit repeated attempts. Apply is an estimate, not a reservation. Availability is checked again when the invoice is created. The Deposit page also confirms the payment and credit you applied: if those terms change, apply the code again before continuing. The invoice saves its promotion; later edits or expiry of the campaign do not remove it. Balance and promotional credits are added together only after verified payment. An underpaid voucher invoice does not receive promotional credits. Check the invoice before paying again, and contact support if a payment needs reconciliation. Never send funds to an expired checkout. Custom deposit clients can include `voucher_code` and the unchanged preview as `voucher_quote` when creating a payment to require those exact terms. Without the optional preview, current terms apply at invoice creation. Submitted preview values never override the calculated payment or credit. `/api/dashboard/deposit/voucher/preview` `/api/dashboard/deposit/voucher/settings` | Voucher response | Meaning | What to do | | --- | --- | --- | | 403 · vouchers_disabled | Voucher entry is turned off. | Use an already issued invoice, or review the standard total before continuing without a voucher. | | 409 · voucher_quote_changed | The current payment or promotional credit differs from the applied offer. | Apply the code again and review the new total. No payment was created for this rejected request. | | 409 · voucher_pending | Another voucher invoice is awaiting payment or reconciliation. | Check payment history and resolve that invoice before creating another. | | 429 · voucher_rate_limited | Five voucher checkout reservations were made in 10 minutes. | Wait for Retry-After. A repeat attempt is not proof that a payment failed. | | 400 · voucher_unavailable | The offer does not meet its rules or a campaign limit has been reached. | Check the minimum deposit and voucher terms; do not pay an older invoice again. | ## Deposits `/api/dashboard/deposit/info` `/api/dashboard/deposit/epusdt/create` `/api/dashboard/topup/qris` `/api/dashboard/deposits` `/api/dashboard/topups` | Method | Notes | | --- | --- | | USDT / USDC | Pay with USDT or USDC via hosted checkout on Solana, BNB Chain, or Polygon. Each order gets its own amount and address and expires automatically. | | QRIS | Pay in rupiah with any Indonesian bank or e-wallet app. Balance is credited automatically once the payment confirms, at the rate shown before you pay. | ## Deposit lifecycle: create to reconcile A deposit moves through six stages: create an order, watch its expiry, wait for the provider webhook to credit it, poll order status, read history, then reconcile spend. The two rails differ at exactly one stage — polling — so read the asymmetry row before building any status loop. | Stage | What happens | | --- | --- | | 1. Create | Epusdt: POST /api/dashboard/deposit/epusdt/create, $1.00–$100,000. QRIS: POST /api/dashboard/topup/qris, floor from live settings (default 10,000 IDR) with a 2,000,000 IDR ceiling. An unconfigured rail answers 503 before field validation — read deposit/info enabled first. | | 2. Expiry | Epusdt expiry is provider-driven. QRIS invoices expire 2 hours after creation and the timestamp is renewed when the provider invoice issues (expires_in 7200). Stale pending orders expire automatically every minute and expiry never settles anything; the Epusdt reconcile window covers the last 24 hours, newest 50. | | 3. Confirmation and credit | A confirmed provider payment credits an order once. QRIS uses its signed webhook. Hosted crypto checkout can also reconcile payment through provider verification. Read the order status and balance to confirm payment. | | 4. Poll — the asymmetry | GET /api/dashboard/deposit/epusdt/status?order_id= re-verifies a pending order against the provider inline when a trade id exists and the rail is configured — status 2 settles to credited, 3 marks expired. Polling Epusdt can settle money. GET /api/dashboard/topup/status?id= only reports the stored state — Sumopod exposes no status endpoint, expiry never settles, and only the signed webhook credits. A retired QRIS order answers retired. | | 5. History | Per-rail histories: GET .../deposit/epusdt/list (newest 20) and GET .../topups (newest 50). GET .../deposits is the live combined history across both rails — every settle writes exactly one entry. It is not deprecated: never write “use topups/epusdt/list instead”. Current caveat: created_at can scan to an empty string and only the newest entry is returned, so treat timestamps as unreliable and the list as newest-first-truncated until the read path is fixed. | | 6. Reconcile | Read the X-Atmorouter-Cost header per request, pull /api/dashboard/usage for the full log, and compare against official list prices in usage-stats (by_provider groups by catalogue family). | ## Webhook idempotency and validation contract Each confirmed order can credit the balance once. QRIS confirmation arrives through a signed webhook; hosted crypto checkout can also settle through provider reconciliation. Create first, pay second, and check status before considering another payment. | Rule | What happens | | --- | --- | | Create, then pay | Epusdt reserves the order, calls the provider, then writes the provider invoice into it and answers 201; when provider creation fails the reserved order is marked failed and the call answers 502. The finalize write is error-checked too — if it fails the reserved order is marked failed and the call answers the same 502 with no order credentials, so a just-created order_id that answers 404, or any 5xx, means re-create and pay only the newest invoice or address. QRIS works the same way: a provider failure marks the order failed and answers 502, with order details saved before the 201 — and here the save is error-checked. | | Exactly-once credit | Both rails claim the order with a single atomic status flip, so only the first delivery credits and a repeat can never double-credit. On a repeated delivery, check order status instead of paying again: Epusdt status re-verifies a pending order against the provider inline, while QRIS status only reports the stored state. | | Ack shapes | A settleable paid Epusdt callback is acked plain-text ok. Anything non-payable is answered 200 JSON with no credit: ignored for unpaid status, rejected for an unknown network or a non-USDT/USDC token. A paid callback that carries no usable amount (actual_amount absent or zero) is a provider malfunction signal and settles as mismatch with no credit — only the amount-less status poller may credit on status alone. Deterministic rejects ack ok so the provider does not loop on the same payload; transient errors answer 500 so the provider retries. QRIS answers 200 JSON: completed settles, failed/expired events mark the invoice expired, and unmatchable bodies are ignored with a named reason. A non-ok 200 may be re-delivered by the provider — treat a repeat as a status check, not a second payment. | | QRIS 2-hour expiry | QRIS invoices expire 2 hours after issue, and the timestamp is renewed when the provider invoice finalizes (expires_in 7200). Settle reads status only: once a stale pending order passes its expiry, a payment completed after expiry answers expired and credits nothing — the webhook alone cannot credit it, so it needs operator assistance. A missed webhook before expiry is recovered by re-sending it from the Sumopod dashboard; expiry only closes stale orders and never settles. | | Live config surface | The live QRIS surface is SUMOPOD_API_KEY, with callbacks at /webhook/sumopod; Epusdt callbacks land at /webhook/epusdt. An unconfigured rail answers 503 before field checks; an unknown webhook path answers 404. | | Pay the exact network and token | Pay on the exact network and token shown on the invoice: a network/token-mismatched paid callback is a terminal non-credit, acked ok so it is not retried. Chain naming normalizes bsc to binance on the wire at create and at settle. Switching chain or token at pay time risks a payment the gateway cannot match — open support with the new trade_id if you switched. | | Invoice binds to its provider payment | Invoices opened after the payment-binding change are bound to their provider payment id, and a signed callback for a different payment is ignored instead of paired. The id is stored at create and looked up per callback. Earlier invoices predate the binding. No integrator action is needed. | | Validation math and gates | QRIS credits only the exact invoiced rupiah inside a 2,000,000 IDR ceiling enforced at create and at the webhook. Epusdt orders span $1–$100,000, tolerate 1% underpayment, and credit min(paid, ordered). Both rails verify before settling — Epusdt HMAC over sorted params, Sumopod Svix with a 5-minute replay window and auth before parsing — and throttle callbacks at 30/min per IP with Retry-After. | ## Why a request answers 402 (or 429) | Signal | What it means | | --- | --- | | 402 empty balance | Balance is zero — top up to continue. | | 402 input exceeds balance | The prompt alone costs more than the balance holds — top up to continue. | | 402 output cap exceeds balance | The requested max_tokens asks for more output than the balance can afford; lower it or top up. | | 402 zero output affordable | The balance cannot fund any output token — top up to continue. | | 402 insufficient_balance | The available balance cannot cover the reservation. Add funds or reduce the request size. | | 429 balance_temporarily_reserved | Other requests are temporarily reserving your balance. Wait for them to finish before retrying. | | 503 price_limit_unavailable | No offer within your caps. The rejected request is not charged; review Budgets or retry later. | | 502 upstream_unreachable | The gateway could not confirm the outcome of a forwarded request. Check Usage before resending and avoid automatic retries for an ambiguous outcome. | | 503 model_route_cooling_down | Wait for Retry-After or error.retry_after_seconds. Three capacity refusals before output within one minute pause the affected model, protocol and effective price ceilings for 15 seconds. Customer-specific limits are isolated by account. One request tests recovery, with 30-second and then 60-second pauses if capacity remains unavailable. Changing a ceiling creates a separate capacity scope. Connection failures can pause the entire model route. | | 503 pricing_unavailable | Fresh pricing cannot be verified. The rejected request is not charged; retry later. Adding funds does not resolve this error. | | 429 thin-balance concurrency | Balance ≤ $0.05 admits 1 in-flight request, ≤ $0.25 admits 3, above that unbounded. Wait for in-flight requests or top up past $0.25 to lift the cap — this is the concurrency guard, not the minute-rate budget (see Rate limits). | | 424 billing_settlement_pending | The generation may have completed while accounting is recovering. Do not automatically resend. Check Usage before submitting another request. | | 502 billing_metadata_unavailable | Incomplete or invalid billing metadata. This response is not charged. | | Closed stream | An interrupted response is charged only from valid reported usage and cost, within its price limits. A response without billable output or verifiable billing metadata is not charged. Check Usage before retrying. | For an explicit capacity rejection before any output, wait at least the indicated retry delay, add a small random jitter, and allow at most three automatic retries. Without a delay hint, use waits of 2, 4, then 8 seconds plus jitter. Both API formats can receive capacity errors inside an HTTP 200 SSE stream. Inspect each error event and use `error.retry_after_seconds` there because HTTP headers have already been sent. If output has arrived or the outcome is uncertain, review Usage and any executed tools before sending a new request. Do not automatically increase price limits. ## Free-model event A request is free when it names an `atmo/` model whose catalogue rates are both zero. Free traffic skips the balance hold entirely but still passes two gates: the account must hold at least $1.00 in lifetime completed deposits or the call answers 402, and per-account free tokens must remain or it answers 429. The free family defaults to the `atmo/` prefix with a 100,000,000-token lifetime quota; promo edits take effect within 30 seconds. Billing on the free path settles to zero. Operators may set a per-account quota: empty means the global 100M applies, `0` blocks free models for that account, and any larger value is that account's exact budget. Past the budget the gateway answers 429 with type `rate_limit_exceeded` and code `free_tier_quota_exceeded` on the OpenAI surface (`rate_limit_error` on Anthropic). Watch for the spelling in the JSON: it is `free_tier_quota_exceeded` (tier), not free-tier. ## Reconciling spend Read the `X-Atmorouter-Cost` response header per request, or pull `/api/dashboard/usage` for the full log. The Usage page also shows what the same traffic would have cost at official list prices, so you can see the saving directly. `/api/dashboard/deposit/epusdt/status` `/api/dashboard/deposit/epusdt/list` `/api/dashboard/topup/status` `/api/dashboard/affiliate` Order-status polling and history live on these endpoints: `GET /api/dashboard/deposit/epusdt/status` — Poll one Epusdt order by order id. `GET /api/dashboard/deposit/epusdt/list` — List past Epusdt orders. `GET /api/dashboard/topup/status` — Poll one QRIS invoice by id. `GET /api/dashboard/topups` — List past QRIS invoices. `GET /api/dashboard/deposits` — Combined deposit history. `GET /api/dashboard/affiliate` — Atmo-native referrals: summary, referrals, payouts, and ledger. What usage tracking records. The server stores the key id with each keyed request, but `GET /api/dashboard/usage` and `GET /api/dashboard/usage-stats` aggregate per account, with breakdowns by model and provider. Requests through the playground carry no key id by design. Failed requests are never billed. Upstream failures settle with no usage report, so no balance is deducted. Billing happens only for requests that settle with token counts. A stream that ends with zero completion tokens and no usage frame settles to zero too — its counts and cost are zeroed before settle, so the whole hold is refunded. Prices track live upstream capacity and can change. The price applied to a request is the price at the moment it is served, and it is recorded in your usage log. --- # AtmoRouter — Dashboard API Source: https://atmorouter.dev/docs/management-api Behavior differences. Only endpoints that intentionally differ from the standard API carry a chip; the chip links to the note that explains the difference. Automate the dashboard without guessing. The reference below describes the dashboard endpoints available on this host. Dashboard calls take the session cookie (log in once, reuse the jar); inference keys never work here. Public rows need no credential. Combo management API limits. Combo management supports create, list, and delete. Other methods return 405. Listing storage failures return 503. Call private combo aliases through Chat Completions or Messages using an owner API key. See [Combos](https://atmorouter.dev/docs/combos) for routing and permissions. `/api/dashboard/register` `/api/dashboard/login` `/api/dashboard/keys` `/api/dashboard/keys/{id}` `/api/dashboard/usage` `/api/dashboard/usage-stats` `/api/dashboard/catalog` `/api/dashboard/balance` `/api/dashboard/deposit/info` `/api/dashboard/deposit/epusdt/create` `/api/dashboard/topup/qris` `/api/public/stats` Success answers a flat object or a named collection wrapper; failure answers `{"error": "..."}` with a plain string — except `POST /api/dashboard/register`, which nests `{"error": {"code": "...", "message": "..."}}` so signup clients can branch on codes. Authenticated endpoints take the session cookie from login (the login token also works as a `Bearer` header); an `ar-` inference key never works here and answers `401`. Examples use illustrative values. ## GET /api/dashboard/budgets List exact account and API key model budgets, percentage rules, and the current final per-request minimum in USD. Requires your dashboard session. See [Budgets](https://atmorouter.dev/docs/budgets) for target selection and how limits intersect. bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/budgets ``` json ```json { "budgets": [{"model":"cbcn/glm-5.3","max_input_price":1,"max_output_price":3,"queue_wait_seconds":30}], "rules": [{"scope_type":"all","scope_value":"","discount_percent":25,"queue_wait_seconds":30}], "minimum_charge":0.000001 } ``` The amount above is illustrative; always use the returned minimum. An omitted `api_key_id` means the account default for that model. An entry with a key id applies only to that owned key, together with the account budget. ## PUT /api/dashboard/budgets Create or replace one budget using the same fields as a listed entry. This operation requires your dashboard session. | Field | Contract | | --- | --- | | model | Required model id. | | api_key_id | Optional id of an API key owned by your account. Omit for the account default. | | max_input_price / max_output_price | Required finite, nonnegative final retail rates in USD per million tokens. Zero disables paid requests. | | queue_wait_seconds | Optional; only 30 is accepted and omission defaults to 30. Up to 30 seconds of routing wait; generation time is additional. | bash ``` curl -b jar.txt -X PUT https://atmorouter.dev/api/dashboard/budgets \ -H "Content-Type: application/json" \ -d '{"model":"cbcn/glm-5.3","max_input_price":1,"max_output_price":3,"queue_wait_seconds":30}' ``` Account and API key budgets intersect: the lower input cap and lower output cap apply independently. A request price header may tighten a saved cap, but cannot raise it. ## DELETE /api/dashboard/budgets Delete one budget with a JSON body containing `model` and optionally `api_key_id`. Omit the key id to delete the account default. Other applicable caps still apply; removing a saved cap returns to the catalog-bounded default where no other cap exists. Requires your dashboard session. bash ``` curl -b jar.txt -X DELETE https://atmorouter.dev/api/dashboard/budgets \ -H "Content-Type: application/json" \ -d '{"model":"cbcn/glm-5.3"}' ``` ## PUT /api/dashboard/budget-rules Save a percentage-off official rate rule with `scope_type` (all, family, or model), `scope_value` (empty string, the model-ID prefix before /, or an exact model id), finite `discount_percent` from 0 to 100, and optionally an owned `api_key_id`. Queue wait is fixed at 30 seconds. Requires a dashboard session. See [Budgets API examples](https://atmorouter.dev/docs/budgets#put-api-dashboard-budget-rules). ## DELETE /api/dashboard/budget-rules Remove one percentage rule by its `scope_type`, `scope_value`, and optional `api_key_id`. Requires a dashboard session. Other rules and exact rate caps continue to apply. ## POST /api/dashboard/register Start registration with an email address. A verification link is sent to the email to set password. Public endpoint, no authentication required. | Parameter | Type | Description | | --- | --- | --- | | email | string | Required user email address. | | ref | string | Optional referral code (unknown codes are ignored at completion). | | source | string | Optional first-touch attribution from the landing URL. | | utm_source | string | Optional campaign attribution, stored as provided. | | utm_campaign | string | Optional campaign attribution, stored as provided. | | landing_path | string | Optional landing path attribution, stored as provided. | bash ``` curl https://atmorouter.dev/api/dashboard/register \ -H "Content-Type: application/json" \ -d '{"email":"you@example.com"}' ``` json ``` // HTTP 202 — check the inbox, then complete registration { "status": "verification_requested", "retry_after_seconds": 60 } ``` | Status | Error code | What it means | | --- | --- | --- | | 202 | verification_requested | Verification email queued. Complete with POST /api/dashboard/complete-registration using the emailed token plus a new password, then sign in. | | 400 | invalid_email | A valid email address is required. | | 400 | invalid_request | Malformed JSON, an unknown field, or a bare null body — the parser is strict. | | 403 | origin_rejected | Browser Origin header does not match the app origin. Plain curl without Origin is unaffected. | | 405 | method_not_allowed | POST only. | | 413 | request_too_large | Body over 4 KB. | | 415 | unsupported_media_type | Content-Type must be application/json. | | 429 | rate_limited | Signup quota spent. Retry-After header plus retry_after_seconds say when to retry. | | 503 | signup_unavailable / service_unavailable | Registration disabled or the mail path is down. | ## POST /api/dashboard/login Authenticate with email and password to receive a session token and `Set-Cookie: atmo_session` cookie (HttpOnly, 30-day expiry). Public endpoint, no authentication required. Flood guard: 20 per IP plus 8 per account per 15 minutes. | Parameter | Type | Description | | --- | --- | --- | | email | string | Registered account email (verified accounts only). | | password | string | Account password. | bash ``` curl -c jar.txt https://atmorouter.dev/api/dashboard/login -H "Content-Type: application/json" -d '{"email":"you@example.com","password":"..."}' ``` json ``` // HTTP 200 — jar.txt now holds the atmo_session cookie (HttpOnly, 30-day expiry) { "user_id": "00000000-0000-4000-8000-000000000001", "email": "you@example.com", "token": "<64-hex session token — shown once>", "message": "login successful" } ``` | Status | Error | What it means | | --- | --- | --- | | 200 | login successful | Session created. Reuse the jar (-b jar.txt) for every authenticated row below; the token field also works as an Authorization: Bearer header. | | 400 | invalid JSON | Malformed request body. | | 401 | invalid credentials | Wrong password, unknown email, or unverified account — the response is identical either way so accounts cannot be enumerated. | | 405 | method not allowed | POST only. | | 429 | too many sign-in attempts … | Flood guard spent (20 per IP + 8 per account per 15 minutes). Retry-After says when to retry. | | 500 | could not start session | Session store failure; retry or report. | ## GET / POST /api/dashboard/keys List existing keys or create a new API key. Requires active session cookie. Full lifecycle and properties are documented in [API keys](https://atmorouter.dev/docs/api-keys). | Parameter (POST) | Type | Description | | --- | --- | --- | | name | string | Optional key label (defaults to empty). | | rate_limit | integer | Optional per-minute request limit (omit for 500; explicit 1..1000, anything else 400). | | allowed_models | string[] | Optional model allowlist (defaults to empty = all models). | bash ``` # Create (POST 201) — full secret once; list (GET 200) — previews only curl -b jar.txt https://atmorouter.dev/api/dashboard/keys -H "Content-Type: application/json" -d '{"name":"prod-app","rate_limit":500}' curl -b jar.txt https://atmorouter.dev/api/dashboard/keys ``` json ``` // POST 201 — save "key" now, it is shown in full exactly once { "id": "00000000-0000-4000-8000-000000000000", "key": "ar-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "message": "key created" } // GET 200 — per-key: 12-char preview, rate_limit, allowed_models, requests, last_used { "data": [{ "id": "00000000-0000-4000-8000-000000000000", "key": "ar-xxxxxxxxx…", "name": "prod-app", "rate_limit": 500, "allowed_models": [], "enabled": true, "requests": 0, "last_used": "0001-01-01T00:00:00Z", "created_at": "..." }]} ``` | Status | Error | What it means | | --- | --- | --- | | 201 / 200 | key created / data list | POST mints ar- + 48 hex chars from 24 secure random bytes; GET lists newest-first scoped to your account. | | 400 | invalid JSON | Malformed POST body. | | 400 | rate_limit must be 1..1000 | Omit the field for the 500 default; any explicit value outside 1..1000 (including 0 and negatives) is rejected. | | 401 | not authenticated | Missing, expired, or ar- key presented as session — Bearer ar- never works here. | | 409 | key limit reached | The account already holds the maximum number of keys (50 by default). Delete a key you no longer use, then retry — there is no rotation endpoint, so revoke-then-create is the intended path. | | 500 | failed to generate secure key / internal error | Entropy or store failure; retry, and if it persists report with a timestamp. | ## DELETE /api/dashboard/keys/{id} Revoke an API key by ID. Revocation is immediate and permanent (hard delete scoped to your account). Unknown or unauthorized key ID returns `404`; malformed ID returns `400`. bash ``` curl -b jar.txt -X DELETE https://atmorouter.dev/api/dashboard/keys/00000000-0000-4000-8000-000000000000 ``` json ``` // HTTP 200 — the key stops working immediately, no grace window { "status": "ok" } ``` | Status | Error | What it means | | --- | --- | --- | | 200 | ok | Key deleted for your account. The next inference call with it answers 401. | | 400 | invalid key id | ID is not UUID-shaped (36 chars, hex groups). Check for truncation when copying. | | 401 | not authenticated | Session missing or expired — log in again. | | 404 | key not found | Unknown ID, or an ID owned by someone else: both answer identically so key IDs cannot be probed. | No rotation, revoke and recreate. There is no key-rotation endpoint: rotation with a grace window is not available on Atmo today. You revoke the old key (`DELETE /api/dashboard/keys/{id}`) and create a new one; the old key stops working immediately, with no grace window. ## GET /api/dashboard/usage Query request history and per-request token usage for your account. The latest 200 entries in the selected range are returned, newest first. Timing fields latency_ms and ttft_ms may be null; inference_metrics is null for older requests. New request-time billing receipts and applied-rule snapshots are prospective; historical details may be unavailable. Failures expose a canonical reason and source when known. Preflight refusals before forwarding may not appear in this history. See [Usage billing receipts](https://atmorouter.dev/docs/observability#usage-billing-receipts) for definitions. Requires a login session. bash ``` curl -b jar.txt "https://atmorouter.dev/api/dashboard/usage?range=7d" ``` json ``` // HTTP 200 — newest first, capped at 200 entries; unknown range falls back to all time { "data": [{ "model": "cbcn/glm-5.3", "input_tokens": 9, "output_tokens": 7, "cached_tokens": 0, "cost": 0.0000231, "status": "success", "latency_ms": 1200, "ttft_ms": 200, "inference_metrics": {"request_id":"example-request-id","first_content_ms":450,"upstream_attempts":1,"terminal_event":true}, "created_at": "2026-10-11T08:13:18.951407+07:00" }]} ``` | Query Parameter | Type | Description | | --- | --- | --- | | range | string | Time window filter: 24h → 24 hours, 7d → 7 days, 30d → 30 days, 90d → 90 days. Empty or anything else → 100 years (all history). Same mapping as usage-stats, so the log list and the summary cards never disagree. | | Status | Error | What it means | | --- | --- | --- | | 200 | data list | Per-request entries scoped to your account: model, input/output/cached tokens, cost, settlement status, timestamp. | | 401 | not authenticated | Session missing or expired — log in again. | | 500 | internal error | Store failure; retry, and if it persists report with a timestamp. | ## GET /api/dashboard/usage-stats Aggregated usage totals and cost breakdown grouped by model and family across billed traffic. Requires active session cookie. bash ``` curl -b jar.txt "https://atmorouter.dev/api/dashboard/usage-stats?range=30d" ``` json ``` // HTTP 200 — totals count billed traffic only (success + partial); error entries cost 0 and are out { "data": { "total_requests": 12, "total_input_tokens": 9010, "total_output_tokens": 3420, "total_cached_tokens": 1200, "total_cost": 0.0183, "official_cost": 0.0411, "total_saved": 0.0228, "by_model": { "cbcn/glm-5.3": { "requests": 12, "input_tokens": 9010, "output_tokens": 3420, "cached_tokens": 1200, "cost": 0.0183 } }, "by_provider": { "CodeBuddy CN": { "requests": 12, "input_tokens": 9010, "output_tokens": 3420, "cached_tokens": 1200, "cost": 0.0183 } } } } ``` The `by_provider` key name is historical: it groups by catalogue `family` (resolved via a catalog join, falling back to the slug before `/` for models that left the catalog), not by splitting the model id. `total_saved` is `official_cost − total_cost` floored at zero, where cached input counts at 10% of the official input rate. The `range` parameter follows the same `24h / 7d / 30d / 90d → all` mapping as `GET /api/dashboard/usage`. | Status | Error | What it means | | --- | --- | --- | | 200 | data object | Totals + by_model + by_provider (by family) for your account in the requested window. | | 400 | user_id required | Session resolved without a user id — log in again. | | 401 | not authenticated | Session missing or expired — log in again. | What usage tracking records. The server stores the key id with each keyed request, but `GET /api/dashboard/usage` and `GET /api/dashboard/usage-stats` aggregate per account, with breakdowns by model and family. Requests through the playground carry no key id by design. ## GET /api/dashboard/catalog Full model catalog with pricing, limits, and discount metadata. Public read endpoint, no authentication required. bash ``` curl https://atmorouter.dev/api/dashboard/catalog curl "https://atmorouter.dev/api/dashboard/catalog?all=1" # include unpriced models ``` json ``` // HTTP 200 — input/output prices are USD per million tokens; upstream identity never ships { "count": 1, "sync": { "total": 0, "priced": 0, "unpriced": 0, "above_official": 0, "uncompetitive": 0, "excluded": 0, "pruned": 0, "at": "0001-01-01T00:00:00Z" }, "data": [{ "id": "acme/gpt-x", "family": "Acme", "official_in": 1, "official_out": 2, "input_price": 0.5, "output_price": 1, "cached_input_price": 0.5, "context_length": 128000, "max_output": 4096, "modality": "text", "supports_cache": false, "enabled": true, "discount_pct": 50 }]} ``` | Status | Error | What it means | | --- | --- | --- | | 200 | data + count + sync | Enabled models by default; ?all=1 also returns disabled/unpriced models. sync summarizes the last upstream refresh. | | 500 | internal error | Catalog read failure; retry, and if it persists report with a timestamp. | Catalogue filter, not a toggle. `GET /api/dashboard/catalog?all=1` is a read filter that includes unpriced models; there is no user-facing toggle to enable or disable catalogue entries. Enabling stays operator-side. ## GET /api/dashboard/balance Returns current account prepaid balance in USD. Requires active session cookie. bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/balance ``` json ``` // HTTP 200 — the automation check the plan asks for (fresh account) { "balance": 0 } ``` | Status | Error | What it means | | --- | --- | --- | | 200 | balance | Prepaid USD, deducted per settled request. Gate automation on this number before spawning spend. | | 401 | not authenticated | Session missing or expired — log in again. | | 404 | user not found | Session points at an account that no longer exists — log in again, then report if it repeats. | ## GET /api/dashboard/deposit/info Returns live deposit parameters, current balance, and status of payment methods (QRIS and Epusdt crypto rails). Requires active session cookie. bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/deposit/info ``` json ``` // HTTP 200 — read "enabled" before creating anything; false means the rail answers 503 { "balance": 0, "methods": [ { "id": "qris", "label": "QRIS", "kind": "fiat", "available": false, "note": "Scan with any Indonesian bank or e-wallet app. Credited automatically." }, { "id": "epusdt", "label": "USDT / USDC", "kind": "crypto", "available": false, "note": "USDT or USDC on Solana, BNB Chain, or Polygon via hosted checkout. Amount and address are unique per order." } ], "qris": { "enabled": false, "min_idr": 10000, "usd_idr_rate": 16500 }, "epusdt": { "enabled": false, "min_usd": 1, "network": "Solana / BNB Chain / Polygon", "tokens": ["USDT", "USDC"], "pending": null } } ``` QRIS `available` is the kill-switch AND the rail config together; Epusdt `available` is the Epusdt credentials check. Defaults when no settings have been saved are `min_idr 10000` and `usd_idr_rate 16500`; the Epusdt floor constant is `$1`. `pending` carries your newest pending Epusdt order, or `null` when none exists. | Status | Error | What it means | | --- | --- | --- | | 200 | balance + methods + rails | Render the deposit page from this one call: balance, per-method availability, live minimums, pending order. | | 401 | not authenticated | Session missing or expired — log in again. | ## POST /api/dashboard/deposit/epusdt/create Create a hosted USDT or USDC checkout deposit order ($1.00–$100,000 when the Epusdt rail is configured; otherwise `503` before field validation). Requires active session cookie. | Parameter | Type | Description | | --- | --- | --- | | amount_usd | number | Required deposit amount in USD. | | token | string | Optional token: USDT (default) or USDC. | | network | string | Optional network: solana (default), bsc, or polygon. | bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/deposit/epusdt/create \ -H "Content-Type: application/json" -d '{"amount_usd":25,"token":"USDT","network":"solana"}' ``` json ``` // HTTP 201 — pay before expires_at; each order gets its own amount + address { "id": 7, "order_id": "AR-E-7-9f3a1c", "trade_id": "EP-88112", "amount_usd": 25, "actual_amount": 25.013, "token": "USDT", "network": "solana", "receive_address": "9xQeWvG816bUx9EPjHSo8uY6TqukC7d3m2p1oR4s", "payment_url": "https://pay.example/EP-88112", "expires_at": "2026-10-11T10:13:18+07:00" } // HTTP 503 when the rail is unconfigured (checked BEFORE field validation) { "error": "USDT deposits are not configured yet" } ``` Token matching is case-insensitive and defaults to `USDT`; `binance` is accepted as an alias for `bsc`. Amount must sit between the `$1` floor and `$100,000`. The two `503`s (rail credentials, then `GATEWAY_PUBLIC_URL` for the Epusdt callback) run before any field validation, so an unconfigured rail answers `503` even for a bad body. Credit lands via the provider webhook — poll `GET /api/dashboard/deposit/epusdt/status` afterwards; history lives at `GET /api/dashboard/deposit/epusdt/list`. | Status | Error | What it means | | --- | --- | --- | | 201 | order object | Checkout order reserved. Pay the exact actual_amount to receive_address before expires_at. | | 400 | invalid JSON | Malformed body. | | 400 | token must be USDT or USDC | Only those two tokens are accepted. | | 400 | network must be solana, bsc, or polygon | Only those three networks are accepted. | | 400 | amount must be between $1.00 and $100000 | Outside the rail window. | | 401 | not authenticated | Session missing or expired — log in again. | | 405 | method not allowed | POST only. | | 502 | failed to create payment order | Rail reachable but order creation failed; the reserved order is marked failed, retry with a fresh call. | | 503 | USDT deposits are not configured yet | Rail credentials missing — check deposit/info enabled first. | | 503 | USDT deposits need GATEWAY_PUBLIC_URL … | Operator callback misconfiguration; not yours to fix, report it. | ## POST /api/dashboard/topup/fiat Create an Indonesian-rupiah invoice using the enabled virtual-account or e-wallet channels returned by deposit/info. Requires your dashboard session and a same-origin request. Send amount_idr, payment_method (virtual_account or ewallet), payment_channel, and customer_phone for e-wallet only. Customer name and email are taken from the account. Pay the returned total_payment_idr, including any processing fee. Virtual accounts return va_number. E-wallets return pay_url, except OVO, which sends a request to the registered app. Display expires_at from the invoice. Redirects never prove payment; poll the owner-scoped topup/status endpoint for credited status. New method availability is controlled by Settings and active merchant channels. ## POST /api/dashboard/topup/qris Create a QRIS invoice in Indonesian Rupiah (IDR) with automated crediting upon payment. Amount floor is the live-settings minimum (default 10,000 IDR, ceiling 2,000,000 IDR) when the QRIS rail is configured; otherwise `503` before field validation. Requires active session cookie. | Parameter | Type | Description | | --- | --- | --- | | amount_idr | integer | Required deposit amount in IDR (minimum from live settings, default 10,000 IDR). | bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/topup/qris \ -H "Content-Type: application/json" -d '{"amount_idr":50000}' ``` json ``` // HTTP 201 — open pay_url and scan within 2 hours (expires_in 7200s) { "id": 3, "order_code": "AR-3-a1b2c3", "amount_idr": 50000, "amount_usd": 3.030303, "fx_rate": 16500, "qris": "", "pay_url": "https://pay.example/AR-3-a1b2c3", "expires_in": 7200 } // HTTP 503 when the rail is unconfigured (checked BEFORE field validation) { "error": "QRIS payment is not configured" } ``` Floor comes from live settings (`default 10,000 IDR`) and ceiling is `2,000,000 IDR`; USD credit is `amount_idr ÷ fx_rate` truncated to micro-dollars. The `qris` field is always empty — Sumopod renders the QR on the hosted `pay_url` page, so there is no QR payload to carry. `total_payment_idr` is the gross the buyer pays (fee inside, not on top). Like Epusdt, rail checks run first: unconfigured answers `503`, kill-switch off answers `403`, both before field validation. Credit is automatic on payment — poll `GET /api/dashboard/topup/status`; history lives at `GET /api/dashboard/topups` (combined: `GET /api/dashboard/deposits`). | Status | Error | What it means | | --- | --- | --- | | 201 | invoice object | Invoice reserved for 2 hours. Open pay_url and scan; balance credits automatically on confirm. | | 400 | invalid JSON | Malformed body. | | 400 | minimum top-up is Rp… | Below the live-settings floor — read deposit/info min_idr first. | | 400 | amount too large | Above the 2,000,000 IDR ceiling. | | 401 | not authenticated | Session missing or expired — log in again. | | 403 | QRIS payment is disabled | Admin kill-switch off: the dashboard shows it disabled and no new invoice may issue. | | 405 | method not allowed | POST only. | | 502 | failed to create payment | Rail reachable but invoice creation failed; the reserved order is marked failed, retry with a fresh call. | | 503 | QRIS payment is not configured | Rail credentials missing — check deposit/info available first. | ## GET /api/dashboard/me Confirm who the session belongs to without trusting anything the client stored locally: user id, email, balance. Requires active session cookie. An `ar-` inference key never works here and answers `401`. bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/me ``` json ``` // HTTP 200 — keys exactly user_id, email, balance // identity values below are illustrative { "user_id": "1af7f336-…", "email": "you@example.com", "balance": 8.5 } ``` | Status | Error | What it means | | --- | --- | --- | | 200 | user object | Session identity: user id, email, prepaid USD balance. | | 401 | not authenticated | Session missing or expired — log in again. | | 404 | user not found | Session points at an account that no longer exists — log in again, then report if it repeats. | ## GET /api/dashboard/market Per-family market snapshot over enabled models: how many models each family sells, the sell-price range, and the average discount against official list prices. No authentication required. bash ``` curl https://atmorouter.dev/api/dashboard/market ``` json ``` // HTTP 200 — prices are sell_in; discount is measured against official_in { "data": [{ "family": "CodeBuddy CN", "models": 2, "min_price": 0.9, "max_price": 1.8, "avg_discount_pct": 10 }]} ``` | Status | Error | What it means | | --- | --- | --- | | 200 | data list | One entry per family, ordered by family. An empty catalogue answers an empty data list. | | 500 | internal error | Catalog read failure; retry, and if it persists report with a timestamp. | ## GET /api/dashboard/deposits Live combined deposit history across both rails — every settle writes exactly one entry here. Session-scoped, full history with no LIMIT, keys `id, amount, status, created_at`. Requires active session cookie. bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/deposits ``` json ``` // HTTP 200 — combined across rails; current caveat: // created_at currently scans to "" and only the newest entry is returned { "data": [{ "id": "…", "amount": 5.0, "status": "completed", "created_at": "" }]} ``` | Status | Error | What it means | | --- | --- | --- | | 200 | data list | Combined settle ledger: no method or currency fields, newest first. Treat timestamps as unreliable and the list as newest-first-truncated until the read-path fix lands. | | 401 | not authenticated | Session missing or expired — log in again. | | 500 | internal error | Store failure; retry, and if it persists report with a timestamp. | ## GET /api/dashboard/deposit/epusdt/status Poll one Epusdt order by order id. This endpoint settles: a pending order with a trade id and a configured rail is re-verified against the provider inline — status 2 credits your balance, 3 marks the order expired. Polling here is not read-only. Requires active session cookie. bash ``` curl -b jar.txt "https://atmorouter.dev/api/dashboard/deposit/epusdt/status?order_id=AR-E-7-9f3a1c" ``` json ``` // HTTP 200 — keys exactly order_id, status { "order_id": "AR-E-7-9f3a1c", "status": "credited" } ``` | Status | Error | What it means | | --- | --- | --- | | 200 | order object | Current order state. credited means balance already grew — do not re-pay. | | 400 | missing order_id | The query parameter is required. | | 401 | not authenticated | Session missing or expired — log in again. | | 404 | order not found | Unknown order id, or an order owned by someone else: both answer identically so ids cannot be probed. | | 405 | method not allowed | GET only. | ## GET /api/dashboard/deposit/epusdt/list List past Epusdt orders, newest first, capped at 20 entries. No parameters. Requires active session cookie. bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/deposit/epusdt/list ``` json ``` // HTTP 200 — full per-order keys, healthy timestamps // identity values below are illustrative { "data": [{ "order_id": "AR-E-7-9f3a1c", "trade_id": "EP-88112", "amount_usd": 25, "actual_amount": 25.013, "token": "USDT", "network": "solana", "receive_address": "9xQe…", "payment_url": "https://pay.example/EP-88112", "status": "credited", "created_at": "2026-10-12T03:52:06+07:00" }]} ``` | Status | Error | What it means | | --- | --- | --- | | 200 | data list | Per-order entries scoped to your account, newest first, at most 20. | | 401 | not authenticated | Session missing or expired — log in again. | | 500 | internal error | Store failure; retry, and if it persists report with a timestamp. | ## GET /api/dashboard/topup/status Poll one QRIS invoice by numeric id — stored state only. Sumopod exposes no status endpoint, expiry never settles, and only the signed webhook credits, so polling here never moves money. Requires active session cookie. bash ``` curl -b jar.txt "https://atmorouter.dev/api/dashboard/topup/status?id=3" ``` json ``` // HTTP 200 — keys exactly id, status { "id": 3, "status": "pending" } ``` | Status | Error | What it means | | --- | --- | --- | | 200 | invoice object | Stored state. pending means unpaid-or-unconfirmed: pay at pay_url, then wait for automatic credit. retired means the order can no longer be paid. | | 400 | invalid id | Id is missing, non-numeric, or not positive. | | 401 | not authenticated | Session missing or expired — log in again. | | 404 | topup not found | Unknown id, or an invoice owned by someone else: both answer identically so ids cannot be probed. | | 405 | method not allowed | GET only. | ## GET /api/dashboard/topups List past QRIS invoices, newest first, capped at 50 entries. No parameters. Requires active session cookie. bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/topups ``` json ``` // HTTP 200 — invoice entries with healthy timestamps (live shape) // identity values below are illustrative { "data": [{ "id": 3, "order_code": "AR-3-a1b2c3", "amount_idr": 50000, "amount_usd": 3.030303, "fx_rate": 16500, "status": "pending", "pay_url": "https://pay.example/AR-3-a1b2c3", "created_at": "2026-10-12T03:52:06+07:00" }]} ``` | Status | Error | What it means | | --- | --- | --- | | 200 | data list | Per-invoice entries scoped to your account, newest first, at most 50. | | 401 | not authenticated | Session missing or expired — log in again. | | 500 | internal error | Store failure; retry, and if it persists report with a timestamp. | ## Public rankings snapshots `GET /api/public/rankings/models` lists qualifying models by period. Set `period` to day, week, month, all-time or trending. `GET /api/public/rankings/summary` returns up to five models. The endpoints are available when the public rankings feature is enabled. GET /api/public/rankings/market-share returns weekly request share inputs. GET /api/public/rankings/history returns weekly series, or privacy-filtered daily buckets for a model. GET /api/public/rankings/categories returns qualifying models by input-token count or recorded tool usage. GET /api/public/rankings/performance returns measured median throughput and first-byte timing for eligible streams. The API Keys page uses /api/dashboard/ranking-app for a key owner to submit or withdraw an opt-in listing. GET /api/public/rankings/apps returns apps only after their owners opt in, an operator approves the listing, and traffic reaches the publication threshold. ## GET /api/public/status Public platform health: two availability views over 30 minutes, 24 hours, and 7 days, a per-class failure breakdown, per-family gauges, and a 14-day trend. No authentication required. Spend totals elsewhere count `success + partial` as billed; availability here is stricter — `partial` counts as failure. `views.every_api_response` counts every eligible request, including pre-inference refusals and capacity refusals. `views.served_by_upstream_families` counts only requests that reached an upstream, so capacity refusals are absent from it. `overall` is the worse of the two per window. Client-side outcomes — invalid requests, authentication errors, rate limits, budget rejections, and client disconnects — are excluded from both, but remain visible in `failures` with their counts and view. bash ``` curl https://atmorouter.dev/api/public/status ``` json ``` // HTTP 200 — illustrative values { "requests_24h": 3, "success_pct_24h": 33.33, "latency_p50_24h": 120, "requests_7d": 3, "success_pct_7d": 33.33, "latency_p50_7d": 120, "requests_30min": 3, "availability_30min": 33.33, "views": { "every_api_response": { "requests_30min": 3, "availability_30min": 33.33, "requests_24h": 3, "availability_24h": 33.33, "requests_7d": 3, "availability_7d": 33.33, "partial_30min": false, "partial_24h": false, "partial_7d": false }, "served_by_upstream_families": { "requests_30min": 3, "availability_30min": 33.33, "requests_24h": 3, "availability_24h": 33.33, "requests_7d": 3, "availability_7d": 33.33 } }, "overall": { "availability_30min": 33.33, "availability_24h": 33.33, "availability_7d": 33.33 }, "failures": [{ "class": "capacity_refused", "requests_30m": 0, "requests_24h": 0, "requests_7d": 0, "view": "edge" }], "edge_data_since": "2026-10-11T20:52:06Z", "buckets_7d": [{ "t": 1791745509 }], "definitions": { "currentWindowMinutes": 30, "historyDays": 7, "bucketMinutes": 120, "operationalAtOrAbovePct": 95, "degradedAtOrAbovePct": 80, "minRequestsForBanner": 20, "minRequestsForStateHint": 20 }, "families": [{ "family": "example", "requests_24h": 3, "success_pct_24h": 33.33, "latency_p50_ms": 120, "latency_p95_ms": 120, "ttft_1h_ms": null, "throughput_1h": 0, "state": "low-traffic", "last_success": "2026-10-11T20:52:06Z", "buckets_7d": [], "spark_24h": [] }], "daily": [{ "date": "2026-10-11", "requests": 3, "success_pct": 33.33 }], "models_total": 2, "models_priced": 2, "catalog_synced_at": "2026-10-11T20:52:06Z", "generated_at": "2026-10-12T03:52:06Z" } ``` `failures[].view` says where a class is used: `excluded` never enters either denominator, `edge` enters only `every_api_response`, and `both` enters both. `partial_*` on the edge view marks a window that started before pre-inference counting began, so the window is visibly incomplete rather than a fabricated perfect score. `edge_data_since` is the oldest retained counter bucket. State per family comes from one rule: zero requests reads `idle`, fewer than 20 requests reads `low-traffic`, and at or above 95% reads `operational`, at or above 80% reads `degraded`, anything lower reads `outage`. Empty windows report `null`, never a fake 100%: `ttft_1h_ms` is null when nothing streamed in the last hour, bucket entries omit their value on quiet windows, and `daily` success renders 0 on empty days. | Status | Error | What it means | | --- | --- | --- | | 200 | health object | Aggregate-only health: no per-user data, no prompt content, nothing identifying a customer. Cache the banner window; drill with families and daily. | | 429 | rate_limited | The shared per-address budget for the public endpoints is exhausted; Retry-After says when it resets. | | 503 | unavailable | The aggregate is momentarily unavailable — the endpoint never returns a fabricated healthy snapshot. | ## GET /api/announcement Current site banner. No authentication required. An empty `body` means render nothing — still a 200, so the client can tell “no announcement” apart from a server error. bash ``` curl https://atmorouter.dev/api/announcement ``` json ``` // HTTP 200 — keys exactly body, updated_at // values below are illustrative { "body": "Scheduled maintenance Sunday 02:00–03:00 UTC.", "updated_at": "2026-10-12T03:52:06+07:00" } ``` Affiliate sub-paths (`/api/dashboard/affiliate/summary`, `/payouts`, `/api/dashboard/affiliate/payouts/confirm`, `/api/dashboard/affiliate/payouts/resend`, `/referrals`, `/ledger`) are covered in full under [Affiliate](https://atmorouter.dev/docs/affiliate); combos live under [Combos](https://atmorouter.dev/docs/combos). This reference keeps only their overview-table rows. ## GET /api/public/family-usage The homepage orbit uses this public snapshot of all-time billed usage. Each entry in `family_usage` contains the model family, request count and total input plus output tokens. The response includes a generation timestamp in `generated_at`. ## GET /api/public/stats Platform-wide aggregate metrics for the landing page (request counts, active models, tokens processed). Public read endpoint, no authentication required. Responses carry Cache-Control max-age=60 as a client/proxy hint and are served from a short-lived server-side cache, so a value can be up to a minute old. Both public endpoints share one per-address request budget; once it is exhausted the answer is 429 with Retry-After telling you when it resets. bash ``` curl https://atmorouter.dev/api/public/stats ``` json ``` // HTTP 200 — header Cache-Control: public, max-age=60 is a caching hint for clients and proxies { "total_requests": 1, "total_tokens": 150, "total_spent": 0.001, "total_saved": 0, "users": 2, "total_deposits": 0, "deposit_count": 0, "deposit_idr": 0, "models": 2, "families": 2, "cheapest_input": 0, "max_discount_pct": 100, "success_rate_7d": 50, "requests_7d": 2, "latency_p50_ms": 0, "health": [{ "family": "Acme", "requests": 2, "success_pct": 50 }] } ``` Spend totals count billed traffic (`success + partial`); availability is stricter — `partial` counts as failure there, same as `GET /api/public/status`. Deposit totals count settled (`credited`) deposits only, across every deposit source. `success_rate_7d` is `null` (not zero) when the last 7 days hold no requests. Per-family `health` is capped at 12 entries, busiest first. --- # AtmoRouter — Account & security Source: https://atmorouter.dev/docs/account-security Only endpoints that intentionally differ from the standard API carry a chip; the chip links to the note that explains the difference. Most of this section rides the session cookie, not an `ar-` key. Signing in issues an HttpOnly SameSite=Lax cookie with a 30-day expiry; me, reset-password, export, and the delete request and cancel steps answer 401 `not authenticated` without one. Verification (resend/complete) and the deletion confirm are token-bearing instead — they must work from an email link — and logout is an idempotent sign-out that clears whatever cookie is present. `/api/dashboard/me` `/api/dashboard/logout` `/api/dashboard/reset-password` `/api/dashboard/export` ## Session: check who you are, then leave `GET /api/dashboard/me` — Returns the session owner's user id, email, and balance. Confirm the cookie here before scripting anything else. `POST /api/dashboard/logout` — Destroys the session and clears the cookie. POST only; any other method answers 405. ## Verification: resend, then complete Signup is email-first. Register and resend share one 202 shape: HTTP 202 with `verification_requested` plus a resend cooldown. Completion is a separate call carrying the emailed token and the new password — it answers 201 `registered` and issues no session, so sign in afterwards. An expired or spent link answers 410 `verification_invalid`. Passwords must be 8–72 bytes, enforced at signup and reset alike. bash ``` # 1. Request the verification email (register and resend share one flow) curl https://atmorouter.dev/api/dashboard/register -H "Content-Type: application/json" -d '{"email":"you@example.com"}' # -> 202 {"status":"verification_requested","retry_after_seconds":60} # 2. Finish signup with the emailed token plus password (no session is issued) curl https://atmorouter.dev/api/dashboard/complete-registration -H "Content-Type: application/json" -d '{"token":"<64-hex-from-email>","password":"correct horse battery staple"}' # -> 201 {"status":"registered"} — now sign in with POST /api/dashboard/login ``` Token errors are ordered and branchable: malformed syntax answers 400 `invalid_request`, an unknown or spent token answers 410 `verification_invalid`, and a live token with a weak password answers 400 `invalid_password`. Each resend mints a new token and revokes its siblings at completion, in one transaction, so only the newest link stays usable; a replayed token answers 410. Tokens expire 30 minutes after issue, checked both before and during completion. Send quota is three per email per hour plus 20 per IP, with global daily/monthly buckets: the fourth send inside the hour answers 429 `rate_limited` with `retry_after_seconds` and a matching `Retry-After` header, so a 429 on a fresh address means that address recently requested mail. `POST /api/dashboard/resend-verification` — Re-send the verification email; same 202 shape as register. `POST /api/dashboard/complete-registration` — Finish signup with token plus password. Returns no session; a weak password on a live token answers 400 invalid_password while a bad token answers 410. ## Password change kills other sessions and all API keys `POST /api/dashboard/reset-password` — Supply the current and the new password under your session. A wrong current password answers 403, and the step-up shares the sign-in limiter (20 tries per IP plus 8 per account per 15 minutes, then 429 with Retry-After). On success the password rotates, every other session is deleted while your current cookie survives, and every API key for the account is revoked — password, sessions, and keys commit atomically, so a stolen key cannot survive compromise recovery. Re-issue keys afterwards: the full secret is shown once at creation. bash ``` # Log in first (the jar keeps the session cookie) curl -c jar.txt https://atmorouter.dev/api/dashboard/login -H "Content-Type: application/json" -d '{"email":"you@example.com","password":"old-secret"}' # Change the password; every OTHER session dies, all API keys are revoked, this jar survives curl -b jar.txt -c jar.txt https://atmorouter.dev/api/dashboard/reset-password -H "Content-Type: application/json" -d '{"current_password":"old-secret","new_password":"new-secret-at-least-8"}' # -> 200 {"status":"password updated","message":"Password updated. All other sessions were signed out and all API keys were revoked — create new keys."} # Old keys are dead (401); create a fresh one curl -b jar.txt https://atmorouter.dev/api/dashboard/keys -H "Content-Type: application/json" -d '{"name":"post-rotation"}' # -> 201 {"key":"ar-…","message":"key created"} — save the secret now, it is shown once ``` Password change revokes API keys as well as sibling sessions: all three commit in one transaction, so recovery from a suspected compromise is complete. Re-issue keys afterwards — each full secret is shown once at creation. ## Forgotten password: recover without a session If you cannot sign in because the password is what you lost, use the recovery flow. It needs no session and no current password — the emailed link is the proof. | Step | Endpoint | What happens | | --- | --- | --- | | 1. Request | POST /api/dashboard/forgot-password | Send your email address. The answer is the same whether or not an account exists, so this endpoint cannot be used to discover which addresses are registered. A 32-byte token is stored only as a hash and the link is valid 15 minutes. | | 2. Confirm | POST /api/dashboard/reset-password/confirm | Send the token from the email plus the new password, in the JSON body. The token works once. On success the password is replaced, every session is deleted, and every API key is revoked — all in one transaction. | bash ``` # 1. Request a link (no session needed; the response never reveals whether the account exists) curl https://atmorouter.dev/api/dashboard/forgot-password -H "Content-Type: application/json" -d '{"email":"you@example.com"}' # -> 200 {"status":"reset_requested","message":"If an account exists for that address, ..."} # 2. Redeem the token from the email curl https://atmorouter.dev/api/dashboard/reset-password/confirm -H "Content-Type: application/json" -d '{"token":"<64-hex-from-the-email>","new_password":"new-secret-at-least-8"}' # -> 200 {"status":"password_reset","message":"Password reset. Sign in with the new password. ..."} # 3. Sign in with the new password, then create a replacement API key curl -c jar.txt https://atmorouter.dev/api/dashboard/login -H "Content-Type: application/json" -d '{"email":"you@example.com","password":"new-secret-at-least-8"}' ``` Recovery revokes every API key on the account, exactly like the password change above: a key stolen before recovery must not survive it. Your balance and usage history are untouched. Requesting a new link retires the previous one, so only the newest email works. ## Deletion in three steps, with a way back Deletion is request, confirm, and optionally cancel — a staged state machine, not a single DELETE. | Step | Endpoint | What happens | | --- | --- | --- | | 1. Request | POST /api/dashboard/delete-account/request | Session plus the real password, under the same step-up limiter as reset. A 32-byte token is hashed server-side and a confirmation email follows; the link stays valid 15 minutes. | | 2. Confirm | POST /api/dashboard/delete-account/confirm | Token in the POST JSON body. Confirm stages the account to pending_deletion with deletion_due_at 7 days out, clears all sessions, and consumes every token for the user in one transaction. | | 3. Cancel (optional) | POST /api/dashboard/delete-account/cancel | Only a pending_deletion account can cancel: status flips back to active and a fresh session cookie is issued. | bash ``` # 1. Request deletion (password-gated; emailed link valid 15 minutes) curl -b jar.txt https://atmorouter.dev/api/dashboard/delete-account/request -H "Content-Type: application/json" -d '{"password":"..."}' # -> 200 {"status":"verification_email_sent","message":"Verification link sent to your email. Link valid for 15 minutes."} # 2. Confirm with the emailed token IN THE POST BODY (never a query string) curl https://atmorouter.dev/api/dashboard/delete-account/confirm -H "Content-Type: application/json" -d '{"token":"<64-hex-from-email>"}' # -> 200 {"status":"pending_deletion","deletion_due_at":"...","message":"Account scheduled for deletion in 7 days."} # 3. Cancel during the 7-day grace window (sign in again first — sessions were cleared) curl -c jar.txt https://atmorouter.dev/api/dashboard/login -H "Content-Type: application/json" -d '{"email":"you@example.com","password":"..."}' curl -b jar.txt https://atmorouter.dev/api/dashboard/delete-account/cancel -X POST # -> 200 {"status":"active","message":"Account deletion cancelled."} ``` The emailed link itself carries the raw token in its query string (`/confirm-delete?token=…`): it sits in the address bar, browser history, and any query-logging access log until the page POSTs it and strips it. Treat the link as a bearer secret inside its 15-minute window, and prefer pasting the token into the JSON-body curl above over clicking through on a shared machine. The API call itself accepts the token from the body only. `POST /api/dashboard/delete-account/request` — Step 1: password-gated, emailed token valid 15 minutes. `POST /api/dashboard/delete-account/confirm` — Step 2: token in the body, stages pending_deletion with a 7-day grace window. `POST /api/dashboard/delete-account/cancel` — Step 3: restores active and re-issues a session. During the grace window sign-in still works: pending_deletion sessions stay valid so the user can reach the cancel endpoint (login admits both statuses). Inference keys do not — key validation requires an active account, so a pending_deletion key stops calling while the dashboard stays reachable. Once deletion_due_at passes, a single cleanup pass removes the account and everything belonging to it — usage, keys, combos, deposits, sessions, tokens — atomically. Grace enforcement is complete: `ar-` inference keys stop the moment the account enters the deletion grace window, the session-cookie playground refuses with 403 `account_pending_deletion`, and new key issuance is refused the same way — matching the deletion email's "all API keys are paused and no new tokens can be generated" promise. Sign-in, cancel, and read-only dashboard paths stay reachable so the user can reverse the deletion. ## Export: profile, redacted keys, capped usage `GET /api/dashboard/export` — Returns your profile (id, email, balance), your keys with secrets reduced to a stored 12-character preview written once at creation, and the newest 1,000 usage entries. Full key secrets appear exactly once, at creation — export can never leak them. bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/export # -> 200 {"user":{"id":"...","email":"you@example.com","balance":8.5}, # "keys":[{"id":"...","key":"ar-xxxxxxxxx…","name":"prod","enabled":true,"requests":0,"created_at":"..."}], # "usage":[{"model":"...","input_tokens":9,"output_tokens":7,"cached_tokens":0,"cost":0.0000231,"status":"success","created_at":"..."}], # "exported_at":"..."} ``` The `key` field in every export entry is the 12-character preview, never the secret; usage is newest-first capped at 1,000 entries. --- # AtmoRouter — Affiliate Source: https://atmorouter.dev/docs/affiliate Only endpoints that intentionally differ from the standard API carry a chip; the chip links to the note that explains the difference. Covers the five live routes under `/api/dashboard/affiliate`. Audience: signed-in dashboard users earning referral commission. Prerequisite for every command below: log in first and keep the session cookie. API keys (`ar-…`) are rejected on all affiliate routes with `401`. `/api/dashboard/affiliate` bash ``` curl -c jar.txt https://atmorouter.dev/api/dashboard/login \ -H "Content-Type: application/json" \ -d '{"email":"you@example.com","password":"..."}' ``` ## Two wallets — read this first There are two balances and money never moves between them on its own: | Wallet | Response field | Purpose | | --- | --- | --- | | Usage balance | balance | Spendable on API calls. Check it with GET /api/dashboard/balance → {"balance":12.5}. | | Affiliate balance | available_amount | Withdrawable only. Referral commission lands here, never in the usage balance. | The affiliate balance reaches the usage balance through exactly one path: an explicit payout with `"method":"api_balance"`, recorded in the affiliate ledger. There is no automatic transfer, no matter how large either balance grows. ## 1. Check your affiliate balance bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/affiliate/summary ``` The response carries your share link and both halves of the picture (identity values below are illustrative; shapes and policy fields are exact): json ```json { "code": "K7Q2XA", "enabled": true, "rate": 0.1, "min_withdraw": 5, "min_withdraw_api_balance": 0, "withdraw_daily": 1, "referral_link": "https://atmorouter.dev/?ref=K7Q2XA", "rate_history": [{ "rate": 0.1, "effective_from": "2026-09-01T00:00:00Z" }], "wallet": { "available": 12.5, "withdrawn": 5.0, "total_earned": 17.5 }, "stats": { "signups": 9, "spenders": 4, "referred_spend": 125.0, "matured_pending": 3.2, "locked_pending": 9.3 }, "pending_payout": { "id": 41, "amount": 5.0, "method": "usdt" }, "pending_verification": { "amount": 12.5, "method": "usdt", "address": "<32-to-44-char-solana-address>", "expires_at": "2026-10-22T08:15:00Z" } } ``` Both pending keys are shown together for shape only: in practice at most one is present, because a request that is already in flight also refuses a new one. How to read it: | Field | Description | | --- | --- | | wallet.available | What you can withdraw right now. | | wallet.withdrawn / wallet.total_earned | Lifetime reporting totals, never used for payouts. | | stats.matured_pending vs stats.locked_pending | Commission matures gradually as each referred user spends; locked_pending is still waiting on their spending. If your balance looks "stuck", this split is why. | | pending_payout | Present only while a request is awaiting processing. While it exists, new payout requests are rejected (see 409 below), so the dashboard should disable the withdraw form instead of letting the server refuse it. | | pending_verification | Present while a withdrawal is waiting for you to click the confirmation link that was emailed to your account address. It carries the parked amount, method, destination address and expiry, and never a token or an id. While either this or pending_payout is present, new requests are refused, so the dashboard should disable the withdraw form. | | rate, min_withdraw, min_withdraw_api_balance, withdraw_daily | The live program policy, not hardcoded promises. The numbers above are the current defaults (10% rate, 5 USDT minimum, 0 API-balance minimum, 1 wallet withdrawal per day); an admin change is reflected here immediately. min_withdraw applies to usdt; min_withdraw_api_balance applies to api_balance and 0 means any positive amount. rate_history lists past rate periods (shape above) for the footnote: past earnings used the rate in effect when each invite's spend happened. A first entry dated 1970-01-01 is the backfill for pre-history spend — expected, not a corrupt timestamp. | ## 2. See who you referred bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/affiliate/referrals # -> {"data":[{"id":7,"created_at":"...","email":"jo***@example.com", # "spent":40.0,"commission":4.0,"matured":1.8}]} ``` Newest first, capped at 200 entries. Emails are masked server-side to `jo***@example.com` form (first two local-part characters kept, or `customer` when no `@` exists). `spent` counts only the referred user's requests that settled with status `success` or `partial` — failed requests are never billed, so they never earn commission. ## 3. Track your payouts bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/affiliate/payouts # -> {"data":[{"id":41,"amount":5.0,"method":"usdt","address":"...", # "network":"solana","status":"pending","note":"","tx_hash":"", # "requested_at":"...","processed_at":null}]} ``` Newest first, capped at 100 entries. `status` stays `pending` until a human operator confirms it (`completed`) or rejects it (`rejected`) — there is no intermediate state written by any current endpoint (readers also accept a `processing` value defensively, but nothing sets it). A populated `tx_hash` is your on-chain receipt for `usdt` withdrawals. Method quirk: only `POST` creates a payout — any other method on this path (`PUT`, `PATCH`, …) returns the list above instead of `405`. ## 4. Read the ledger (beta) bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/affiliate/ledger # -> {"data":[{"kind":"payout_usdt","amount":-5.0,"balance_after":7.5, # "created_at":"..."}]} ``` Newest first, capped at 100 entries. Every payout reserves from `available_amount` and writes a negative-amount entry (`payout_usdt` or `payout_api_balance`) with the balance after reservation — the audit trail that ties each withdrawal to the wallet movement. The ledger also records maturation credits (`commission_matured`), clawbacks (`commission_clawed`), and reject returns (`payout_rejected_return`), so a payout entry here always has a matching ledger entry. Beta: response shape may change. The ledger endpoint is in beta. It is safe to poll today, but treat the exact response shape as subject to change. ## 5. Request a payout A withdrawal takes two steps. The first call parks the amount, the method and the destination address, and emails a confirmation link to your account address. No payout exists at that point and nothing has moved. The payout is created only when that link is opened and confirmed — confirming is what actually reserves the money. The link expires in 30 minutes, and a newer request replaces an older one, so only the newest link works. Two methods, `usdt` or `api_balance` (surrounding spaces trimmed, case folded; anything else is a 400). Amounts round to 6 decimals and must be positive. `usdt` must be at least the live `min_withdraw` (currently 5; the server message reads `"minimum withdrawal is 5 USDC"`), while `api_balance` uses `min_withdraw_api_balance` (currently 0 — no minimum). Step 1 — park a withdrawal to a Solana wallet (an operator's manual transfer follows confirmation): bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/affiliate/payouts \ -H "Content-Type: application/json" \ -d '{"amount":12.5,"method":"usdt","address":"<32-to-44-char-solana-address>"}' # -> {"status":"verification_sent","amount":12.5,"method":"usdt","expires_in_seconds":1800} ``` Step 1 — park a move of earnings into API-call credit instead (no address needed, no daily limit): bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/affiliate/payouts \ -H "Content-Type: application/json" \ -d '{"amount":12.5,"method":"api_balance"}' # -> {"status":"verification_sent","amount":12.5,"method":"api_balance","expires_in_seconds":1800} ``` Step 2 — confirm with the token from that email. This is the call that creates the payout: bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/affiliate/payouts/confirm \ -H "Content-Type: application/json" \ -d '{"token":"<64-hex-token-from-the-email>"}' # -> {"status":"confirmed","id":41,"amount":12.5,"method":"usdt"} ``` The confirm call takes the token and nothing else. The amount, method and address come from the request you parked, so a link read from an inbox cannot be re-pointed at a larger amount or a different wallet — there is no field in which to send one. The amount in the response is the parked amount, not a number the caller supplied. It works without a session: the emailed token is the whole credential, which is what lets the link open on a phone that is not signed in. Check the address twice before confirming. The server validates length only (32–44 characters) — it does not verify the address is real or that you typed it correctly, and the operator transfer is irreversible. `network` defaults to `solana`. ## 6. Limits and errors The two steps check different things. The request checks, in order: bad body → program enabled → method → amount → minimum for that method → address. It then parks the request and emails a confirmation link. The confirmation checks, in order: the token → program enabled → minimum for the parked method → wallet lock (a missing wallet stops here) → one in-flight request → daily limit → sufficient balance. The first failure wins. The wallet is not touched until the link is confirmed, so a request that is only parked has reserved nothing and consumed no daily quota. Limit values below reflect current defaults; the summary endpoint always carries the live policy. | Situation | Status | Body | | --- | --- | --- | | Not signed in (or ar- API key) | 401 | {"error":"not authenticated"} | | Unparseable POST body (4 KB cap) | 400 | {"error":"invalid request"} | | Program disabled by admin | 403 | {"error":"affiliate program is disabled"} | | Unknown sub-path (after auth) | 404 | {"error":"not found"} | | Method not usdt/api_balance | 400 | {"error":"invalid payout method"} | | Amount ≤ 0, NaN, or infinite | 400 | {"error":"invalid amount"} | | Below the live minimum for the method, at the request or raised before the confirmation | 400 | {"error":"minimum withdrawal is 5 USDC"} — usdt only by default; api_balance has no minimum unless min_withdraw_api_balance is raised above 0 | | usdt address shorter than 32 or longer than 44 chars | 400 | {"error":"a valid Solana wallet address is required"} | | A payout is already pending/processing | 409 | {"error":"you already have a withdrawal awaiting processing"} — one in flight per user, any method; the confirmation answers this too. | | usdt daily quota reached (UTC day) at the confirmation | 429 | {"error":"wallet withdrawals are limited to 1 per day"} — evaluated when the link is confirmed, not when the request is parked: usdt only, rejected requests excluded from the count; api_balance is never rate-limited. | | Reserved balance fell short, at the request or between the request and the confirmation | 400 | {"error":"insufficient affiliate balance"} | | Confirmation token wrong, expired, or already used (one message for all three, deliberately) | 400 | {"error":"invalid or expired payout token"} | | Confirmation sent with no token | 400 | {"error":"token is required"} | Three rules worth remembering: | Rule | Description | | --- | --- | | 1. One at a time (409) | A second request while a payout is in flight is rejected, even for a different amount or method — and so is a confirmation while one is in flight. Wait for the operator to complete or reject the pending one — or check pending_payout and pending_verification in the summary first. A request that is only parked (not yet confirmed) is the exception: a second park replaces the older link, so the older link stops working. Parking and re-sending the link share one email allowance per account and per address, so repeated parks are refused with 429 once it is spent. | | 2. One usdt withdrawal per UTC day (429) | The quota is evaluated when the confirmation link is opened, not when the request is parked — a parked request has withdrawn nothing. The day boundary is UTC, the same day the operator sees in the admin queue. api_balance transfers are internal, cost nothing to process, and are never rate-limited. | | 3. Concurrent requests cannot double-spend | The wallet balance is locked first and the reserve is a single atomic update that fails unless the balance still covers the amount — so two parallel confirmations cannot both pass. If yours loses the race, you get insufficient affiliate balance, not a partial withdrawal. | | 4. The balance is checked before the email | A request the wallet cannot back is refused with insufficient affiliate balance at the request step, so no confirmation link is emailed for money that is not there. An account that has never earned a commission has no affiliate balance at all and is refused the same way. | ## 7. What happens after {"status":"verification_sent"} Until you open the emailed link and confirm it, the request is only waiting for you: nothing is reserved, and a newer request simply replaces it. After confirmation it is parked as `pending`. Nothing else moves until a human operator acts — the operator queue is server-side only (there is no public operator endpoint: /api/admin answers 404 on the public gateway): | Outcome | What happens | | --- | --- | | api_balance confirm | Credits the usage balance — this is the only moment affiliate money becomes API-call credit. | | usdt confirm | Off-platform manual transfer by an operator; the tx_hash is then recorded on your payout request. | | Reject | Returns the reserved amount to available_amount and writes a payout_rejected_return ledger entry, freeing you to request again. | There is an email-confirmation step on this path: the request emails a link to your account address, and the payout is created only when that link is opened and confirmed. The link expires in 30 minutes, and a newer request replaces an older one, so only the newest link works. Settlement time depends on operator review after the confirmation, so `pending` lasting hours is normal. ## 8. Commission maturity and payout-safety notes How the money behind this page behaves: the maturity rule, when rate changes take effect, and the payout-safety edges the live service enforces. Nothing here moves money — behavior fixes, if any, ship in a separate lane. | Rule | What happens | | --- | --- | | 1. Commission matures only from spend | Each referred deposit opens a commission worth deposit x rate at deposit time; it unlocks as the referred user spends: matured is the smaller of total and spend-since-deposit x rate. Oldest deposits consume spend first from one shared pool (FIFO, oldest deposits first). Unspent deposits pay nothing. | | 2. Rate changes apply the moment they take effect | Spend prices at the rate in effect when it happened (periods oldest-first; new deposits use the live policy rate). Each usage entry is attributed by its own timestamp, so a same-day change prices the morning at the old rate and the afternoon at the new one. rate_history lists past periods; the 1970-01-01 line is the backfill for pre-history spend, not a corrupt timestamp. | | 3. Fully-matured earnings show as ready, not stuck | matured_pending / locked_pending count pending plus fully-matured-but-unpaid commissions; a fully-matured commission flips to matured and still shows as ready here as well as in wallet.available. Payouts reserve from available_amount, so a zero split with positive available means request a payout — nothing is stuck. | | 4. Commission opens shortly after the deposit, never twice — retries close the gap | Accrual opens a commission shortly after the deposit on both rails with fail-open guards, so a just-credited deposit may show its commission seconds later — wait and refresh, do not re-deposit. If the process stops between credit and the follow-up write, the commission is not lost: the write retries inline 3 times with 100 ms backoff, a pending intent is persisted durably, and a per-minute pass replays open intents and picks up completed rail deposits older than 2 minutes that still have no commission entry (batch cap 200). Replays only ever open pending, zero-matured commissions, so a retry can never mint spendable money — maturity still unlocks exclusively when the referred user spends. Both rails claim pending-to-credited exactly once and the commission write is idempotent per source deposit. | | 5. Refunds claw matured money back; a reject returns only what the claw left behind | A refund on spent deposits reduces available_amount / total_earned with a floor at zero and writes a commission_clawed ledger entry. A payout already parked as pending is resolved by the operator by hand — so expect a delay and matching ledger entries, not an automatic adjustment. The returned amount is capped, not full: it can never exceed the still-unpaid matured amount left after the claw, so a refund that landed mid-flight keeps its clawed part out of your wallet instead of minting it back. A capped return is marked clawback-reconciled on the payout note with its payout_rejected_return ledger entry; when the claw took everything there is no ledger entry and the note is the only pointer. Only an api_balance confirmation credits your usage balance. | | 6. A rejected USDT payout frees today's quota for a retry | The daily count excludes rejected requests: a rejected usdt request returns its reservation to the wallet and does not consume withdraw_daily = 1, so a second request the same UTC day is allowed — just retry. Completed requests still consume quota (confirm-then-retry answers 429 {"error":"wallet withdrawals are limited to 1 per day"}). api_balance moves are never rate-limited; only one payout may be in flight at a time (409). The USDT minimum stays policy-live, currently 5 ({"error":"minimum withdrawal is 5 USDC"}); api_balance uses min_withdraw_api_balance, default 0, so any positive amount is allowed. | --- # AtmoRouter — Combos Source: https://atmorouter.dev/docs/combos Only endpoints that intentionally differ from the standard API carry a chip; the chip links to the note that explains the difference. A combo is a private model alias: use `combo/` in the model field of Chat Completions or Anthropic Messages. Create and manage it with your dashboard login session; call it with an API key from the same account. `/api/dashboard/combos`[Differs from standard](https://atmorouter.dev/docs/combos#C-behavior-hardening) `/v1/chat/completions` `/v1/messages`[Differs from standard](https://atmorouter.dev/docs/combos#C-anthropic-base) `/v1/models` ## Call a saved combo bash ``` curl https://atmorouter.dev/v1/chat/completions \ -H "Authorization: Bearer $ATMOROUTER_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"combo/cheap-fast-pair","messages":[{"role":"user","content":"Hello!"}],"max_tokens":128}' ``` For Anthropic Messages, send the same model ID to `POST /v1/messages` with your normal Messages body, including `max_tokens`. Use the protocol supported by your client and choose members that support its features. The combo does not translate unsupported model capabilities. Public catalog requests list ordinary models only. Send a valid owner API key to `GET /v1/models` to discover your private combo IDs. Another account cannot discover or call your combo, even if it knows the slug; slugs are unique per account. bash ``` curl https://atmorouter.dev/v1/models \ -H "Authorization: Bearer $ATMOROUTER_API_KEY" ``` ## Context window and output limits Authenticated model discovery includes a combo’s `context_length` and `max_output_tokens` when those limits are known for every saved member. Each value is the smallest corresponding limit across all saved members, including inactive members and those excluded by your key. Output is also capped by the known context window. A temporary availability change cannot increase this advertised limit. Context length is the combined input and output window; it is not the maximum output length. For example, a combo whose members all have a 1,000,000-token context advertises 1,000,000. Adding a member with a 128,000-token context lowers that to 128,000. If a saved member is missing or its limit is unknown, the corresponding field is omitted rather than guessed. Current member limits can change as the catalog updates. Limits are automatic; the combo management API has no manual context override. In Hermes and other clients, use your owner API key for model discovery and refresh the model list or cached metadata after changing a combo. Remove an old manual context override if it prevents discovery. If metadata is unavailable, use a conservative client setting supported by every member; a larger client value cannot expand a model’s actual capacity. ## Routing strategies | Strategy | Selection | | --- | --- | | round-robin | Rotate the starting model across eligible members on each request. Rotation is local to each gateway process and resets on restart. | | failover | Try eligible members in saved order. Move to the next only after a safe rejection before output. | | cheapest | Order by the sum of current input and output prices per million tokens. This heuristic does not guarantee the lowest total cost for your request. | Disabled members and members excluded by your key are skipped. If the key has a model allowlist, it must allow both the combo ID and the underlying member IDs. Normal account and key budgets, request price caps, balance checks, and billing apply to the selected concrete model. A combo does not bypass funding or price limits. Capacity waits apply per member, so a combo request can exceed one member’s capacity-wait window. Set your client timeout to allow for multiple member attempts. Each additional member attempt also consumes your account rate limit. Failover stops before replay would be unsafe. Failover can continue after local model availability or price-limit refusals, or a known capacity rejection such as HTTP 429, only when the prior attempt has been durably settled with no reported supplier expense. It never replays after response headers or stream content have reached your client, uncertain network failures, malformed or incomplete responses, or billing failures. A started stream cannot switch models. Combo management API limits. Dashboard management supports create, list, and delete. Other methods return 405. A session cookie manages combos; an inference API key cannot authenticate these dashboard routes. Listing storage failures return 503. ## 1. Create a combo [Differs from standard](https://atmorouter.dev/docs/combos#C-behavior-hardening) bash ``` curl -c jar.txt https://atmorouter.dev/api/dashboard/login \ -H "Content-Type: application/json" \ -d '{"email":"you@example.com","password":"..."}' curl -b jar.txt https://atmorouter.dev/api/dashboard/combos \ -H "Content-Type: application/json" \ -d '{"name":"Cheap Fast Pair","models":["family/model-a","family/model-b"],"strategy":"failover"}' # -> {"id":"c90d4f21-7b3e-4a5c-9d1f-2e6b8a0c4d7e","slug":"cheap-fast-pair","status":"created"} ``` The member IDs above are illustrative. Choose actual IDs from the live catalog. In the dashboard, click members in priority order or use the arrows before saving. | Parameter | Type | Description | | --- | --- | --- | | name | string | Trimmed display name, 1–100 Unicode characters. Must produce a nonempty slug of at most 100 characters. | | models | string[] | 2–32 distinct, nonempty model IDs, each at most 200 characters. Order is saved. Nested combo/ IDs are not allowed. | | strategy | string | round-robin (default), failover, or cheapest. Legacy fallback is accepted and normalized to failover. | The slug lowercases the name, replaces spaces with dashes, and removes characters outside `[a-z0-9-]`. Duplicate slugs within your account return 409. Creation validation does not guarantee that every member is currently callable: live availability, pricing, and key permissions are checked for each call. Existing legacy combos with one member remain callable. ## 2. List your combos bash ``` curl -b jar.txt https://atmorouter.dev/api/dashboard/combos # -> {"data":[{"id":"...","name":"Cheap Fast Pair","slug":"cheap-fast-pair", # "models":["family/model-a","family/model-b"],"strategy":"failover"}]} ``` Newest first, scoped to your session account. An empty account returns `{"data":[]}`. A storage failure returns 503; an incomplete read does not prove a combo was deleted. A client-supplied user_id does not change ownership. ## 3. Delete a combo bash ``` curl -b jar.txt -X DELETE https://atmorouter.dev/api/dashboard/combos/c90d4f21-7b3e-4a5c-9d1f-2e6b8a0c4d7e # -> {"status":"deleted"} ``` The ID must be UUID-shaped. Unknown IDs and another account's IDs return the same 404. Authentication is checked before the ID shape. Deleting your account also removes your combos. There is no sharing or transfer endpoint; recreate a combo in the target account. ## Management errors | Situation | Status | | --- | --- | | Missing dashboard session, or inference API key used on a dashboard combo route | 401 | | Malformed JSON, invalid name, members, strategy, or DELETE ID | 400 | | Duplicate slug in your account | 409 | | Unknown DELETE ID or ID owned by someone else | 404 | | Unsupported management method | 405 | | Storage failure while listing | 503 | | Other management storage failure | 500 | Inference errors use the selected protocol's error envelope. Calls with no eligible member, a disallowed combo alias, or an exhausted safe failover chain return an error; it never falls back to another account's combo. See [Errors](https://atmorouter.dev/docs/errors) for normal inference, price, and balance refusals. --- # AtmoRouter — Guides Source: https://atmorouter.dev/docs/guides Only endpoints that intentionally differ from the standard API carry a chip; the chip links to the note that explains the difference. Three end-to-end paths that connect the reference sections into one sitting each. Every step below runs as written: dashboard calls reuse the session jar from `POST /api/dashboard/login`, inference calls use a Bearer `ar-` key. Secrets stay redacted — the full secret is shown exactly once at creation, so every example below writes `ar-xxxxxxxxxxxx` where your secret goes. Each guide ends with a done-criterion and a pointer for the failure case. Contract-level changes — behavior fixes, new errors, anything that changes what a status code means — are logged newest-first in `docs/CHANGELOG.md`, with the shipped commit and the action to take, if any. When a guide step surprises you, check the changelog first: the behavior may have moved since the guide was written. `/v1/chat/completions` `/api/dashboard/deposit/epusdt/create` `/api/dashboard/topup/qris` `/api/dashboard/keys` `/api/dashboard/affiliate` Two credentials for two surfaces. Inference takes a Bearer `ar-` key (or `x-api-key`); the dashboard uses a session cookie instead. An `ar-` key never acts as a session, and a session cookie never authenticates inference. ## Guide 1: top up to your first settled call From a zero balance to one settled inference call with reconciled cost, in about fifteen minutes. Prerequisite: a verified account with a session jar (see [Account & security](https://atmorouter.dev/docs/account-security)). Expect `402` before money lands — empty balance, unaffordable input, or a hold the balance cannot cover all answer 402, never retry them (full table under Billing). | Step | Do this | | --- | --- | | 1. Key | Create one key. The response shows the full secret once — save it now; listing later returns a 12-character preview only. | | 2. Balance | Confirm the starting point. A zero balance means the first inference attempt answers 402. | | 3. Deposit | Open one order on either rail. Epusdt spans $1–$100,000; QRIS starts at the live-settings floor (default 10,000 IDR) with a 2,000,000 IDR ceiling. An unconfigured rail answers 503 before field checks — read deposit/info first. | | 4. Pay + poll | Pay the newest invoice only, then poll its status. Epusdt status re-verifies a pending order against the provider inline — status 2 settles to credited. QRIS status only reports the stored state; only the signed webhook credits. On any repeat delivery, check status instead of paying again. | | 5. Call | Send one chat completion with the new key. The gateway reserves temporary spending headroom first — estimated from prompt size plus max_tokens (or bounded up to 16,384 output tokens when omitted), with a small per-request minimum — while your displayed balance stays unchanged until settlement. | | 6. Reconcile | Read the X-Atmorouter-Cost header, then compare it against GET /api/dashboard/usage (newest 200) and official list prices in usage-stats. Once usage completes, the reservation is released and your balance is deducted once for the exact final charge without going below zero. | bash ``` # 1. Key (201 — full secret once) curl -b jar.txt https://atmorouter.dev/api/dashboard/keys \ -H "Content-Type: application/json" -d '{"name":"guide-01"}' # -> {"id":"...","key":"ar-...","message":"key created"} # 2. Balance (expect 0.00 on a fresh account) curl -b jar.txt https://atmorouter.dev/api/dashboard/balance # -> {"balance":0} # 3a. Deposit over Epusdt ($1-$100,000) ... curl -b jar.txt https://atmorouter.dev/api/dashboard/deposit/epusdt/create \ -H "Content-Type: application/json" -d '{"amount_usd":10,"token":"USDT","network":"solana"}' # -> 201 {"order_id":"...","trade_id":"...","payment_url":"..."} — pay this invoice # ... or 3b. over QRIS (floor from live settings, ceiling 2,000,000 IDR) curl -b jar.txt https://atmorouter.dev/api/dashboard/topup/qris \ -H "Content-Type: application/json" -d '{"amount_idr":50000}' # -> 201 {"order_code":"AR-...","pay_url":"...","expires_in":7200} — pay within 2 hours # 4. Poll the order (Epusdt may settle inline; QRIS only reports) curl -b jar.txt "https://atmorouter.dev/api/dashboard/deposit/epusdt/status?order_id=" # -> {"order_id":"...","status":"credited"} curl -b jar.txt "https://atmorouter.dev/api/dashboard/topup/status?id=" # -> {"id":...,"status":"credited"} # 5. First call (Bearer ar- key, never the session cookie) curl https://atmorouter.dev/v1/chat/completions \ -H "Authorization: Bearer ar-xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{"model":"cbcn/glm-5.3","messages":[{"role":"user","content":"Hello!"}],"max_tokens":32}' # -> 200; note the X-Atmorouter-Cost response header — that is the exact charge # 6. Reconcile (header vs usage log) curl -b jar.txt https://atmorouter.dev/api/dashboard/usage # -> {"data":[{"model":"cbcn/glm-5.3",...,"cost":,...}]} ``` Done when the `X-Atmorouter-Cost` header equals the newest `usage` entry cost for the same model. If the call answers `402`, top up instead of retrying; if it answers `401`, the key is missing, revoked, or lacks the `ar-` prefix. The six-stage deposit lifecycle behind step 4 lives under [Billing](https://atmorouter.dev/docs/billing). ## Guide 2: rotate a key without downtime There is no rotation endpoint and no grace window — revoke-and-recreate is the whole primitive (see `C-no-rotate` under [API keys](https://atmorouter.dev/docs/api-keys)). Downtime-free rotation is manual overlap: the replacement serves traffic before the old key dies. bash ``` # 1. Create the replacement FIRST (both keys are valid at once) curl -b jar.txt https://atmorouter.dev/api/dashboard/keys \ -H "Content-Type: application/json" -d '{"name":"prod-app-v2"}' # -> 201 {"id":"","key":"ar-...","message":"key created"} — save the secret now # 2. Prove the new key validates — without spending. Auth runs before body # parsing, so a valid key with a bad body answers 400, # while any bad key answers 401 first. curl https://atmorouter.dev/v1/chat/completions -H "Authorization: Bearer ar-...new..." -H "Content-Type: application/json" -d '{}' # -> 400 {"error":{"message":"model is required",...}} — key validated, zero billed # 3. Shift traffic to the new secret (only now that it proves valid) # 4. Delete the old key (immediate hard delete, scoped to your account) curl -b jar.txt -X DELETE https://atmorouter.dev/api/dashboard/keys/ # -> {"status":"ok"} # 5. Prove the old key is dead (same shape, no spend — auth fails first) curl https://atmorouter.dev/v1/chat/completions -H "Authorization: Bearer ar-...old..." -H "Content-Type: application/json" -d '{}' # -> 401 {"error":{"message":"invalid API key","type":"invalid_api_key"}} ``` | If you see | It means | | --- | --- | | 400 {"error":"invalid key id"} | The DELETE id is malformed. Copy the id from the list output, not from memory. | | 404 {"error":"key not found"} | Well-formed id, but unknown or owned by someone else — scoped deletes answer identically so ids cannot be probed. | | 401 on the NEW key | The secret was copied wrong, or the account is not active-and-verified. Re-create rather than guessing. | Done when the old secret 401s, the new secret 400s on the empty-body probe (key validated, body rejected), and the key list shows only the new id. Two related traps: the list and export surfaces never return full secrets (12-character preview only), and a password change revokes every key on the account at once — after a reset, re-issue instead of rotating. No rotation, revoke and recreate. Rotation with a grace window is not available on Atmo today. The old key stops working the instant `DELETE` commits, so overlap first, delete last. There are no read-only or config-scoped key kinds — every user key is a full inference key. ## Guide 3: from referral link to spendable credit Turn a referral link into API-call credit. The mental model first: two wallets, no automatic transfer — referral commission lands in your affiliate balance (`available_amount`), never in your usage balance (`balance`). Exactly one path bridges them: an explicit payout with `method api_balance` (full wallet map under [Affiliate](https://atmorouter.dev/docs/affiliate)). bash ``` # 1. Get your link and the live policy (rate/minimums/daily are live, not promised) curl -b jar.txt https://atmorouter.dev/api/dashboard/affiliate/summary # -> {"code":"K7Q2XA","referral_link":"https://atmorouter.dev/?ref=K7Q2XA", # "rate":0.1,"min_withdraw":5,"min_withdraw_api_balance":0,"withdraw_daily":1, ...} # 2. The invitee signs up via ?ref=CODE, deposits, and SPENDS. # Each deposit opens commission worth deposit x rate; it unlocks as spend # happens (matured = smaller of total and spend-since-deposit x rate). # No spend, no matured money — locked_pending explains a balance that # looks "stuck". # 3. Watch maturity split in the same summary curl -b jar.txt https://atmorouter.dev/api/dashboard/affiliate/summary # -> {...,"stats":{"matured_pending":3.2,"locked_pending":9.3,...}} # 4. Park the request. This emails a confirmation link and moves nothing. curl -b jar.txt https://atmorouter.dev/api/dashboard/affiliate/payouts \ -H "Content-Type: application/json" -d '{"amount":5,"method":"api_balance"}' # -> {"status":"verification_sent","amount":5,"method":"api_balance","expires_in_seconds":1800} # 5. Open the link and confirm — the payout is created only here, and the # operator acts only after this confirmation. The link lasts 30 minutes and # only the newest one works. curl -b jar.txt https://atmorouter.dev/api/dashboard/affiliate/payouts/confirm \ -H "Content-Type: application/json" -d '{"token":"<64-hex-token-from-the-email>"}' # -> {"status":"confirmed","id":...,"amount":5,"method":"api_balance"} # 6. After the operator confirms, the usage balance grows curl -b jar.txt https://atmorouter.dev/api/dashboard/balance # -> {"balance":} — the only moment affiliate money becomes call credit ``` | If you see | It means | | --- | --- | | 400 {"error":"minimum withdrawal is 5 USDC"} | Below the live minimum for the method — usdt uses min_withdraw (currently 5), api_balance uses min_withdraw_api_balance (currently 0, no minimum). The number is policy-live; re-read the summary instead of hardcoding it. The confirmation re-checks the parked method, so a floor raised between the two steps also answers this. | | 409 {"error":"you already have a withdrawal awaiting processing"} | One payout in flight per user, any method. The park answers it while a payout is in flight; the confirm call answers it when a payout was created between your park and your confirmation. Wait for the operator to complete or reject it first. | | 429 {"error":"wallet withdrawals are limited to 1 per day"} | Returned by the confirm call, not the park: the usdt daily quota per UTC day is evaluated when the link is confirmed — rejected requests excluded (a same-day retry after a reject is allowed), and only usdt is limited; api_balance never is. | Done when `GET /api/dashboard/balance` grows by the payout amount and the ledger shows the matching `payout_api_balance` entry (`GET /api/dashboard/affiliate/ledger`). Prefer `api_balance` for credit: the `usdt` method instead pays a 32–44-character Solana address by manual operator transfer (length-checked only, never verified real), which is irreversible. Validation order, limits, and the post-request lifecycle live under [Affiliate](https://atmorouter.dev/docs/affiliate) §§6–8. ## If a guide and a reference disagree The reference section wins — guides narrate, references state the exact behavior. Report the mismatch on Discord with the guide name and step number so the reference can be corrected. New here? Run Guide 1 end to end before anything else: one working call plus one reconciled charge teaches the credential split, the 402 rejoinder, and the header-to-usage loop that every other section assumes.