DocumentationAPI reference
Ask AI

Take the docs with you

Ask ChatGPTOpen a new chat ↗Ask ClaudeOpen a new chat ↗Ask on GeminiCopy prompt, then paste in Gemini ↗View llms.txtDocumentation index ↗

External chats receive links to public docs.

API reference

Explore request fields, response examples, errors, and copyable SDK samples. All examples are illustrative; discover current model IDs and prices from the catalog.

Base URL: https://atmorouter.dev. Use /v1 for OpenAI SDKs and the bare host for Anthropic SDKs. Dashboard APIs require a separate login session.

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 fieldTypeDescription
modelRequiredstringEnabled model ID from GET /v1/models, or a private combo/<slug> alias owned by the API key account. Normal member permissions, budgets, pricing, and balance checks apply.
messagesRequiredarrayConversation messages. Content blocks and tools depend on the model.
max_tokensintegerRequested output limit. Affordability and context caps apply; upstream enforcement varies.
streambooleanReturn OpenAI-format SSE, ending with data: [DONE].
stream_optionsobjectSee the request schema.
temperaturenumberSampling setting forwarded to the model; support varies.
top_pnumberNucleus sampling setting; support varies.
stopUnionStop sequence(s), when supported.
toolsarrayOpenAI function definitions; model must support tools.
tool_choiceUnionTool selection policy, if supported.
response_formatobjectStructured 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

{
  "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
{
  "type": "object",
  "properties": {
    "model": {
      "type": "string",
      "description": "Enabled model ID from GET /v1/models, or a private combo/<slug> 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
{
  "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 fieldTypeDescription
modelRequiredstringEnabled model ID from GET /v1/models, or a private combo/<slug> alias owned by the API key account. Normal member permissions, budgets, pricing, and balance checks apply.
max_tokensRequiredintegerRequired positive integer. Context and affordability caps apply.
messagesRequiredarrayConversation messages. Content blocks and tools depend on the model.
systemUnionSystem prompt text or Anthropic content blocks.
streambooleanNative Anthropic SSE ending in message_stop.
toolsarrayAnthropic tool definitions, when supported.
tool_choiceobjectAnthropic tool selection, when supported.
temperaturenumberForwarded sampling setting; model-specific.
stop_sequencesarrayForwarded 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

{
  "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
{
  "type": "object",
  "properties": {
    "model": {
      "type": "string",
      "description": "Enabled model ID from GET /v1/models, or a private combo/<slug> 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
{
  "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/<slug> 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

{
  "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
{
  "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"
          },
          "max_output_tokens": {
            "type": "integer"
          },
          "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.

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/<slug> aliases through Chat Completions or Messages with an owner API key.