> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atlaso.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a chat completion

> Send an OpenAI Chat Completions request through Atlaso, with memory added.

Atlaso calls the model's provider with your own saved provider key and adds the user's memory first. For memory, see [Memory](https://docs.atlaso.ai/gateway/memory.md). For every error code, see [Errors](https://docs.atlaso.ai/gateway/errors.md).


## OpenAPI

````yaml api-reference/openapi.json POST /chat/completions
openapi: 3.1.0
info:
  title: Atlaso Gateway API
  version: 1.0.0
  description: An OpenAI-compatible API that calls your own provider keys and adds memory.
servers:
  - url: https://api.atlaso.ai/v1
security:
  - AtlasoKey: []
paths:
  /chat/completions:
    post:
      tags:
        - Chat
      summary: Create a chat completion
      description: >-
        Sends an OpenAI Chat Completions request to the model's provider with
        your saved provider key, after adding memory. Cost and memory come back
        in reply headers. With `stream: true` the reply is Server-Sent Events
        (`text/event-stream`) in the OpenAI chunk shape, ending with `data:
        [DONE]`. When `stream_options.include_usage` is `true`, the usage chunk
        (empty `choices`) also carries the `atlaso` object; if the provider sent
        no usage, Atlaso sends one chunk with empty `choices`, `usage` null and
        `atlaso`, just before `[DONE]`. Without `include_usage`, Atlaso adds no
        chunk: every chunk carries at least one choice. A stream that fails
        after it started ends with an error frame, `data: {"error": {...}}`. A
        streamed reply has no `x-atlaso-cost-usd` or `x-atlaso-cache` header;
        the cost of every call is in Activity.
      operationId: createChatCompletion
      parameters:
        - name: x-atlaso-memory
          in: header
          required: false
          description: >-
            Lowers memory for this one call. `off`: no recall and no learning,
            and the reply's `x-atlaso-memory` header says `status=off` with
            `reason=request_off`. `use`: recall as usual, but nothing from this
            call is learned. Letter case and spaces around the value are
            ignored; any other value is ignored too. It never turns memory or
            learning on for a key whose settings are lower.
          schema:
            type: string
            enum:
              - 'off'
              - use
        - name: x-atlaso-user
          in: header
          required: false
          description: >-
            Your app user's id, set by your server. A key set to memory for each
            user of your app reads the user only from this header. 1 to 256
            printable characters, not only spaces, with no API key or token in
            it. Send it once. Used exactly as sent.
          schema:
            type: string
            minLength: 1
            maxLength: 256
          example: demo-user-42
        - name: x-atlaso-session-id
          in: header
          required: false
          description: >-
            Your own id for a group of related calls (a chat session). Only
            printable ASCII is kept: other characters are removed and a longer
            value is cut to 128 characters. Ignored when the call comes from
            Claude Code or Codex through the Gateway (coming soon), which will
            send their own.
          schema:
            type: string
          example: session-7
        - name: x-atlaso-client
          in: header
          required: false
          description: >-
            The name of your app or tool, shown with the call in Activity. Only
            printable ASCII is kept: other characters are removed and a longer
            value is cut to 64 characters.
          schema:
            type: string
          example: support-bot
        - name: x-atlaso-tags
          in: header
          required: false
          description: >-
            Your own labels for this call, as comma-separated `key=value` pairs.
            At most 10 tags per call (header and body together). A key is
            lowercase letters, digits, `_` and `-`, at most 32 characters. A
            value is printable ASCII, 1 to 64 characters. A tag that breaks a
            rule is dropped and named in `x-atlaso-tags-dropped`; the call still
            goes ahead. A header over 2048 characters is not read at all: none
            of its tags is used, and `x-atlaso-tags-dropped` names it as
            `x-atlaso-tags too_long`. See [Tags](/gateway/tags).
          schema:
            type: string
          example: feature=chat,env=prod
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - messages
              additionalProperties: true
              description: >-
                The OpenAI Chat Completions request. Fields not listed here are
                passed to the provider, which may refuse them. At most 32 MiB.
              properties:
                model:
                  type: string
                  description: An exact model id from `GET /models`.
                  example: openai/gpt-5.4-mini
                messages:
                  type: array
                  items:
                    type: object
                    additionalProperties: true
                  description: >-
                    The conversation, in the OpenAI Chat Completions message
                    shape.
                stream:
                  type: boolean
                  description: Send `true` for Server-Sent Events.
                stream_options:
                  type: object
                  additionalProperties: true
                  properties:
                    include_usage:
                      type: boolean
                      description: >-
                        Send `true` to receive the usage chunk, which then also
                        carries the `atlaso` object.
                  description: Stream settings.
                max_tokens:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                max_completion_tokens:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                stop:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                tools:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                tool_choice:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                parallel_tool_calls:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                response_format:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                reasoning_effort:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                reasoning:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                temperature:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                top_p:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                top_k:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                min_p:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                'n':
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                seed:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                logprobs:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                top_logprobs:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                frequency_penalty:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                presence_penalty:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                repetition_penalty:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                logit_bias:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                store:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                service_tier:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                modalities:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                audio:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                prediction:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                web_search_options:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                verbosity:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                prompt_cache_key:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                chat_template_args:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                enable_thinking:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                thinking:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                cache_control:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                speed:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                inference_geo:
                  description: >-
                    Passed to the provider, or mapped to the provider's own
                    field. A provider that cannot take it refuses the call with
                    400 `unsupported_parameter`, before any provider call.
                user:
                  description: >-
                    Never fails a call. OpenAI and OpenAI-compatible hosts get
                    it as sent. Where Atlaso knows the provider does not take
                    it, it is left out of the provider request and named in
                    `x-atlaso-ignored-params`. On a key that keeps your own
                    memory, Atlaso also reads it to label cost by app user
                    (`x-atlaso-user` first, then `safety_identifier`, then
                    `user`). On a key with memory for each user of your app, a
                    value that differs from `x-atlaso-user` is refused with 400
                    `user_id_conflict`. On Google models the value is sent as a
                    label, which allows at most 63 characters of lowercase
                    letters, digits, `_` or `-`. A value those rules do not
                    allow is left out and named in `x-atlaso-ignored-params`; it
                    is never rewritten. When `user` and `safety_identifier` are
                    both sent with different values, `safety_identifier` is the
                    label (or `user`, when only its value is allowed) and the
                    other is left out and named.
                safety_identifier:
                  description: >-
                    Never fails a call. OpenAI and OpenAI-compatible hosts get
                    it as sent. Where Atlaso knows the provider does not take
                    it, it is left out of the provider request and named in
                    `x-atlaso-ignored-params`. On a key that keeps your own
                    memory, Atlaso also reads it to label cost by app user
                    (`x-atlaso-user` first, then `safety_identifier`, then
                    `user`). On a key with memory for each user of your app, a
                    value that differs from `x-atlaso-user` is refused with 400
                    `user_id_conflict`. On Google models the value is sent as a
                    label, which allows at most 63 characters of lowercase
                    letters, digits, `_` or `-`. A value those rules do not
                    allow is left out and named in `x-atlaso-ignored-params`; it
                    is never rewritten. When `user` and `safety_identifier` are
                    both sent with different values, `safety_identifier` is the
                    label (or `user`, when only its value is allowed) and the
                    other is left out and named.
                metadata:
                  description: >-
                    Never fails a call. OpenAI and OpenAI-compatible hosts get
                    it as sent. Where Atlaso knows the provider does not take
                    it, it is left out of the provider request and named in
                    `x-atlaso-ignored-params`.
                provider:
                  type: object
                  description: >-
                    Atlaso's routing choice for a model several hosts serve.
                    Taken out of the body before the provider call. Any other
                    sub-field is refused with 400.
                  properties:
                    order:
                      type: array
                      maxItems: 16
                      items:
                        type: string
                      description: Hosts to try first, in this order.
                    only:
                      type: array
                      maxItems: 16
                      items:
                        type: string
                      description: Use only these hosts.
                    ignore:
                      type: array
                      maxItems: 16
                      items:
                        type: string
                      description: Never use these hosts.
                    allow_fallbacks:
                      type: boolean
                      default: true
                      description: >-
                        Whether the call may switch to the next host in routing
                        order (`order`, after `only` and `ignore`) when a host
                        fails before any answer has been sent. False keeps the
                        call on the first host.
                  additionalProperties: false
                  example:
                    order:
                      - together
                      - fireworks
                atlaso:
                  type: object
                  description: >-
                    Atlaso's own body field, always taken out before the
                    provider call. Its `tags` object holds your labels for the
                    call; a body tag replaces a header tag with the same key.
                  properties:
                    tags:
                      type: object
                      additionalProperties:
                        type: string
                      description: Key to value, with the same rules as `x-atlaso-tags`.
                  example:
                    tags:
                      feature: chat
              example:
                model: openai/gpt-5.4-mini
                messages:
                  - role: user
                    content: What do I like to drink?
      responses:
        '200':
          description: >-
            The provider's answer in the OpenAI Chat Completions shape. Replies
            from OpenAI models are passed on as OpenAI sent them. Replies from
            providers with a different shape (for example Anthropic, Google and
            Amazon Bedrock) are translated into it. When a Claude model (on
            Anthropic or Amazon Bedrock) spends all of `max_tokens` on thinking
            and writes no text, the reply also carries `atlaso` with `reason`
            (`thinking_limit_no_text`) and `notice`.
          headers:
            x-atlaso-call-id:
              $ref: '#/components/headers/CallId'
            x-atlaso-provider:
              $ref: '#/components/headers/Provider'
            x-atlaso-model:
              $ref: '#/components/headers/Model'
            x-atlaso-cost-usd:
              $ref: '#/components/headers/CostUsd'
            x-atlaso-cache:
              $ref: '#/components/headers/Cache'
            x-atlaso-reason:
              $ref: '#/components/headers/Reason'
            x-atlaso-memory:
              $ref: '#/components/headers/MemoryReceipt'
            x-atlaso-paid-by:
              $ref: '#/components/headers/PaidBy'
            x-request-id:
              $ref: '#/components/headers/RequestId'
            x-atlaso-ignored-params:
              $ref: '#/components/headers/IgnoredParams'
            x-atlaso-tags-dropped:
              $ref: '#/components/headers/TagsDropped'
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                description: >-
                  The provider's reply in the OpenAI shape: unchanged for OpenAI
                  models, translated for providers with a different shape.
              example:
                id: chatcmpl-123
                object: chat.completion
                created: 1763366400
                model: gpt-5.4-mini
                choices:
                  - index: 0
                    message:
                      role: assistant
                      content: You like oat-milk lattes.
                    finish_reason: stop
                usage:
                  prompt_tokens: 120
                  completion_tokens: 8
                  total_tokens: 128
            text/event-stream:
              schema:
                type: string
                description: >-
                  With `stream: true` the reply is Server-Sent Events
                  (`text/event-stream`) in the OpenAI chunk shape, ending with
                  `data: [DONE]`. When `stream_options.include_usage` is `true`,
                  the usage chunk (empty `choices`) also carries the `atlaso`
                  object; if the provider sent no usage, Atlaso sends one chunk
                  with empty `choices`, `usage` null and `atlaso`, just before
                  `[DONE]`. Without `include_usage`, Atlaso adds no chunk: every
                  chunk carries at least one choice. A stream that fails after
                  it started ends with an error frame, `data: {"error": {...}}`.
                  A streamed reply has no `x-atlaso-cost-usd` or
                  `x-atlaso-cache` header; the cost of every call is in
                  Activity. The `atlaso` object is described under the Atlaso
                  schema.
        '400':
          description: >-
            The request was refused before any provider call, or the provider
            refused it as invalid. Codes: `invalid_body`,
            `unsupported_parameter`, `invalid_request_error`,
            `model_kind_not_supported`, `cache_retention_not_available`,
            `provider_key_missing`, `provider_key_disabled`,
            `provider_endpoint_missing`, `provider_workspace_not_found`,
            `provider_workspace_required`, `provider_invalid_request`,
            `provider_bad_request`, `bedrock_inference_profile_required`,
            `azure_content_filter`, `user_id_required`, `user_id_not_accepted`,
            `user_id_conflict`.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            x-atlaso-memory:
              $ref: '#/components/headers/MemoryReceipt'
            x-atlaso-paid-by:
              $ref: '#/components/headers/PaidBy'
            x-atlaso-call-id:
              $ref: '#/components/headers/CallId'
            x-atlaso-provider:
              $ref: '#/components/headers/Provider'
            x-atlaso-model:
              $ref: '#/components/headers/Model'
            x-atlaso-reason:
              $ref: '#/components/headers/Reason'
            x-should-retry:
              $ref: '#/components/headers/ShouldRetry'
            x-atlaso-cost-usd:
              $ref: '#/components/headers/CostUsd'
            x-atlaso-cache:
              $ref: '#/components/headers/Cache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: >-
                    Parameter 'logit_bias' is not supported by this Anthropic
                    model. Remove 'logit_bias' and retry.
                  type: invalid_request_error
                  param: null
                  code: unsupported_parameter
                  doc_url: https://docs.atlaso.ai/gateway/errors#unsupported_parameter
        '401':
          description: >-
            The Atlaso key is missing, invalid or revoked, or the provider
            rejected your saved key. Codes: `invalid_api_key`,
            `provider_key_rejected`, `azure_claude_key_refused`.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            x-atlaso-memory:
              $ref: '#/components/headers/MemoryReceipt'
            x-atlaso-paid-by:
              $ref: '#/components/headers/PaidBy'
            x-atlaso-call-id:
              $ref: '#/components/headers/CallId'
            x-atlaso-provider:
              $ref: '#/components/headers/Provider'
            x-atlaso-model:
              $ref: '#/components/headers/Model'
            x-atlaso-reason:
              $ref: '#/components/headers/Reason'
            x-should-retry:
              $ref: '#/components/headers/ShouldRetry'
            x-atlaso-cost-usd:
              $ref: '#/components/headers/CostUsd'
            x-atlaso-cache:
              $ref: '#/components/headers/Cache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: >-
                    Your Atlaso API key is missing, invalid or revoked. Set
                    Authorization: Bearer to an active key from the API keys
                    page.
                  type: authentication_error
                  param: null
                  code: invalid_api_key
                  doc_url: https://docs.atlaso.ai/gateway/errors#invalid_api_key
        '402':
          description: >-
            The provider refused the call for a billing reason. Codes:
            `provider_billing_error`.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            x-atlaso-memory:
              $ref: '#/components/headers/MemoryReceipt'
            x-atlaso-paid-by:
              $ref: '#/components/headers/PaidBy'
            x-atlaso-call-id:
              $ref: '#/components/headers/CallId'
            x-atlaso-provider:
              $ref: '#/components/headers/Provider'
            x-atlaso-model:
              $ref: '#/components/headers/Model'
            x-atlaso-reason:
              $ref: '#/components/headers/Reason'
            x-should-retry:
              $ref: '#/components/headers/ShouldRetry'
            x-atlaso-cost-usd:
              $ref: '#/components/headers/CostUsd'
            x-atlaso-cache:
              $ref: '#/components/headers/Cache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: >-
                    OpenAI refused the call for a billing reason on your saved
                    key. Check your OpenAI plan and credit.
                  type: billing_error
                  param: null
                  code: provider_billing_error
                  doc_url: https://docs.atlaso.ai/gateway/errors#provider_billing_error
        '403':
          description: >-
            The Atlaso API is not enabled for the account, or the provider
            denied access. Codes: `gateway_not_enabled`,
            `provider_permission_denied`, `third_party_data_sharing_blocked`,
            `groq_org_model_blocked`, `groq_project_model_blocked`,
            `qwen_model_access_denied`, `qwen_workspace_access_denied`,
            `qwen_billing_required`, `qwen_model_unavailable`,
            `bedrock_account_not_enabled`, `bedrock_api_keys_blocked`,
            `bedrock_access_denied`, `bedrock_payment_method_required`,
            `bedrock_model_access_required`, `azure_policy_blocked`,
            `azure_quota_required`, `coreweave_inference_disabled`.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            x-atlaso-memory:
              $ref: '#/components/headers/MemoryReceipt'
            x-atlaso-paid-by:
              $ref: '#/components/headers/PaidBy'
            x-atlaso-call-id:
              $ref: '#/components/headers/CallId'
            x-atlaso-provider:
              $ref: '#/components/headers/Provider'
            x-atlaso-model:
              $ref: '#/components/headers/Model'
            x-atlaso-reason:
              $ref: '#/components/headers/Reason'
            x-should-retry:
              $ref: '#/components/headers/ShouldRetry'
            x-atlaso-cost-usd:
              $ref: '#/components/headers/CostUsd'
            x-atlaso-cache:
              $ref: '#/components/headers/Cache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: >-
                    The Atlaso API is not enabled for this account yet. No model
                    call was made.
                  type: permission_error
                  param: null
                  code: gateway_not_enabled
                  doc_url: https://docs.atlaso.ai/gateway/errors#gateway_not_enabled
        '404':
          description: >-
            The model is not available through Atlaso, or Microsoft Foundry has
            no deployment of it in your resource. Codes: `model_not_available`,
            `azure_deployment_required`.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            x-atlaso-memory:
              $ref: '#/components/headers/MemoryReceipt'
            x-atlaso-paid-by:
              $ref: '#/components/headers/PaidBy'
            x-atlaso-call-id:
              $ref: '#/components/headers/CallId'
            x-atlaso-provider:
              $ref: '#/components/headers/Provider'
            x-atlaso-model:
              $ref: '#/components/headers/Model'
            x-atlaso-reason:
              $ref: '#/components/headers/Reason'
            x-should-retry:
              $ref: '#/components/headers/ShouldRetry'
            x-atlaso-cost-usd:
              $ref: '#/components/headers/CostUsd'
            x-atlaso-cache:
              $ref: '#/components/headers/Cache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: >-
                    This model is not available through Atlaso. Choose an exact
                    id from GET /v1/models.
                  type: invalid_request_error
                  param: null
                  code: model_not_available
                  doc_url: https://docs.atlaso.ai/gateway/errors#model_not_available
        '405':
          description: >-
            The route exists but not with this method. Codes:
            `method_not_allowed`.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            x-atlaso-memory:
              $ref: '#/components/headers/MemoryReceipt'
            x-atlaso-paid-by:
              $ref: '#/components/headers/PaidBy'
            x-should-retry:
              $ref: '#/components/headers/ShouldRetry'
            x-atlaso-call-id:
              $ref: '#/components/headers/CallId'
            x-atlaso-provider:
              $ref: '#/components/headers/Provider'
            x-atlaso-model:
              $ref: '#/components/headers/Model'
            x-atlaso-cost-usd:
              $ref: '#/components/headers/CostUsd'
            x-atlaso-cache:
              $ref: '#/components/headers/Cache'
            x-atlaso-reason:
              $ref: '#/components/headers/Reason'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: Method not allowed.
                  type: invalid_request_error
                  param: null
                  code: method_not_allowed
                  doc_url: https://docs.atlaso.ai/gateway/errors#method_not_allowed
        '410':
          description: >-
            Microsoft retired the model, so Microsoft Foundry no longer answers
            calls to it. Codes: `azure_model_retired`.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            x-atlaso-memory:
              $ref: '#/components/headers/MemoryReceipt'
            x-atlaso-paid-by:
              $ref: '#/components/headers/PaidBy'
            x-atlaso-call-id:
              $ref: '#/components/headers/CallId'
            x-atlaso-provider:
              $ref: '#/components/headers/Provider'
            x-atlaso-model:
              $ref: '#/components/headers/Model'
            x-atlaso-reason:
              $ref: '#/components/headers/Reason'
            x-should-retry:
              $ref: '#/components/headers/ShouldRetry'
            x-atlaso-cost-usd:
              $ref: '#/components/headers/CostUsd'
            x-atlaso-cache:
              $ref: '#/components/headers/Cache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: >-
                    Microsoft retired this model, so Microsoft Foundry no longer
                    answers calls to it. Choose a newer model. Microsoft's model
                    retirement schedule names its replacement.
                  type: invalid_request_error
                  param: null
                  code: azure_model_retired
                  doc_url: https://docs.atlaso.ai/gateway/errors#azure_model_retired
        '413':
          description: 'The body is over 32 MiB. Codes: `request_too_large`.'
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            x-atlaso-memory:
              $ref: '#/components/headers/MemoryReceipt'
            x-atlaso-paid-by:
              $ref: '#/components/headers/PaidBy'
            x-atlaso-call-id:
              $ref: '#/components/headers/CallId'
            x-atlaso-provider:
              $ref: '#/components/headers/Provider'
            x-atlaso-model:
              $ref: '#/components/headers/Model'
            x-atlaso-reason:
              $ref: '#/components/headers/Reason'
            x-should-retry:
              $ref: '#/components/headers/ShouldRetry'
            x-atlaso-cost-usd:
              $ref: '#/components/headers/CostUsd'
            x-atlaso-cache:
              $ref: '#/components/headers/Cache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: >-
                    The request body is too large. Send at most 32 MiB, or
                    shorten the messages.
                  type: invalid_request_error
                  param: null
                  code: request_too_large
                  doc_url: https://docs.atlaso.ai/gateway/errors#request_too_large
        '429':
          description: >-
            A limit was reached, at Atlaso or at the provider. Codes:
            `rate_limited`, `account_rate_limited`, `key_daily_limit`,
            `user_daily_limit_reached`, `monthly_budget_reached`,
            `repeated_request_stopped`, `agent_loop_stopped`,
            `provider_rate_limit`, `insufficient_quota`, `provider_spend_limit`.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            x-atlaso-memory:
              $ref: '#/components/headers/MemoryReceipt'
            x-atlaso-paid-by:
              $ref: '#/components/headers/PaidBy'
            x-atlaso-call-id:
              $ref: '#/components/headers/CallId'
            x-atlaso-provider:
              $ref: '#/components/headers/Provider'
            x-atlaso-model:
              $ref: '#/components/headers/Model'
            x-atlaso-reason:
              $ref: '#/components/headers/Reason'
            retry-after:
              $ref: '#/components/headers/RetryAfter'
            x-should-retry:
              $ref: '#/components/headers/ShouldRetry'
            x-atlaso-cost-usd:
              $ref: '#/components/headers/CostUsd'
            x-atlaso-cache:
              $ref: '#/components/headers/Cache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: >-
                    Too many requests on this Atlaso key. Retry after the
                    indicated delay; no model call was made.
                  type: rate_limit_error
                  param: null
                  code: rate_limited
                  doc_url: https://docs.atlaso.ai/gateway/errors#rate_limited
        '500':
          description: 'Atlaso hit an internal error. Codes: `internal_error`.'
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            x-atlaso-memory:
              $ref: '#/components/headers/MemoryReceipt'
            x-atlaso-paid-by:
              $ref: '#/components/headers/PaidBy'
            x-atlaso-call-id:
              $ref: '#/components/headers/CallId'
            x-atlaso-provider:
              $ref: '#/components/headers/Provider'
            x-atlaso-model:
              $ref: '#/components/headers/Model'
            x-atlaso-reason:
              $ref: '#/components/headers/Reason'
            x-atlaso-cost-usd:
              $ref: '#/components/headers/CostUsd'
            x-atlaso-cache:
              $ref: '#/components/headers/Cache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: >-
                    Atlaso hit an internal error. Retry; if it repeats, contact
                    support with the x-request-id.
                  type: api_error
                  param: null
                  code: internal_error
                  doc_url: https://docs.atlaso.ai/gateway/errors#internal_error
        '502':
          description: >-
            The provider failed or gave an unusable reply. Codes:
            `provider_unavailable`, `provider_invalid_response`,
            `provider_reply_failed`.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            x-atlaso-memory:
              $ref: '#/components/headers/MemoryReceipt'
            x-atlaso-paid-by:
              $ref: '#/components/headers/PaidBy'
            x-atlaso-call-id:
              $ref: '#/components/headers/CallId'
            x-atlaso-provider:
              $ref: '#/components/headers/Provider'
            x-atlaso-model:
              $ref: '#/components/headers/Model'
            x-atlaso-reason:
              $ref: '#/components/headers/Reason'
            retry-after:
              $ref: '#/components/headers/RetryAfter'
            x-atlaso-cost-usd:
              $ref: '#/components/headers/CostUsd'
            x-atlaso-cache:
              $ref: '#/components/headers/Cache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: >-
                    OpenAI is unavailable or returned a server error. The
                    request may have reached OpenAI; check your OpenAI usage
                    before retrying. Atlaso did not retry or switch providers.
                  type: api_error
                  param: null
                  code: provider_unavailable
                  doc_url: https://docs.atlaso.ai/gateway/errors#provider_unavailable
        '503':
          description: >-
            Atlaso could not check the key or reach memory, or the provider is
            busy. Codes: `auth_unavailable`, `memory_unavailable`,
            `provider_busy`.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            x-atlaso-memory:
              $ref: '#/components/headers/MemoryReceipt'
            x-atlaso-paid-by:
              $ref: '#/components/headers/PaidBy'
            x-atlaso-call-id:
              $ref: '#/components/headers/CallId'
            x-atlaso-provider:
              $ref: '#/components/headers/Provider'
            x-atlaso-model:
              $ref: '#/components/headers/Model'
            x-atlaso-reason:
              $ref: '#/components/headers/Reason'
            retry-after:
              $ref: '#/components/headers/RetryAfter'
            x-should-retry:
              $ref: '#/components/headers/ShouldRetry'
            x-atlaso-cost-usd:
              $ref: '#/components/headers/CostUsd'
            x-atlaso-cache:
              $ref: '#/components/headers/Cache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: >-
                    Atlaso could not check your API key right now. Retry
                    shortly; no model call was made.
                  type: api_error
                  param: null
                  code: auth_unavailable
                  doc_url: https://docs.atlaso.ai/gateway/errors#auth_unavailable
        '504':
          description: 'The provider did not answer in time. Codes: `provider_timeout`.'
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            x-atlaso-memory:
              $ref: '#/components/headers/MemoryReceipt'
            x-atlaso-paid-by:
              $ref: '#/components/headers/PaidBy'
            x-atlaso-call-id:
              $ref: '#/components/headers/CallId'
            x-atlaso-provider:
              $ref: '#/components/headers/Provider'
            x-atlaso-model:
              $ref: '#/components/headers/Model'
            x-atlaso-reason:
              $ref: '#/components/headers/Reason'
            retry-after:
              $ref: '#/components/headers/RetryAfter'
            x-atlaso-cost-usd:
              $ref: '#/components/headers/CostUsd'
            x-atlaso-cache:
              $ref: '#/components/headers/Cache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: >-
                    OpenAI did not answer in time. The request may have reached
                    OpenAI; check your OpenAI usage before retrying. Atlaso did
                    not retry or switch providers.
                  type: api_error
                  param: null
                  code: provider_timeout
                  doc_url: https://docs.atlaso.ai/gateway/errors#provider_timeout
components:
  headers:
    CallId:
      description: The call's id.
      schema:
        type: string
      example: 01JZ8X4Q2M7N3P5R6S7T8V9W0X
    Provider:
      description: >-
        Host name of the provider that answered, or `none` when no provider
        answered.
      schema:
        type: string
      example: api.openai.com
    Model:
      description: Catalog id of the model that answered, or `none`.
      schema:
        type: string
      example: openai/gpt-5.4-mini
    CostUsd:
      description: >-
        List-price cost in US dollars, six decimals, or `unknown`. A call
        refused before it reached a provider carries `0.000000`. Not sent on a
        stream, except `0.000000` for a free model.
      schema:
        type: string
      example: '0.000412'
    Cache:
      description: >-
        Prompt cache tokens: `read=N; write=N`, `unknown` for a count not known.
        Not sent on a stream.
      schema:
        type: string
      example: read=0; write=0
    Reason:
      description: >-
        Present when the call did not end normally, for example an error code or
        `provider_refusal`.
      schema:
        type: string
      example: provider_refusal
    MemoryReceipt:
      description: >-
        What memory did: `status=...; ids=...; ms=...; reason=...; added=...;
        action=...`. `status` is `used`, `none`, `skipped`, `off` or `bypass`.
        With `x-atlaso-memory: off` it reads `status=off` and
        `reason=request_off`; a key whose memory is off gives
        `reason=key_mode_off`. Routes that do not use memory say
        `status=bypass`.
      schema:
        type: string
      example: status=none; ids=; ms=38; reason=no_match; added=0; action=none
    PaidBy:
      description: 'Always `own_key`: the provider bills your own key.'
      schema:
        type: string
        enum:
          - own_key
      example: own_key
    RequestId:
      description: Atlaso's id for this request. Quote it to support.
      schema:
        type: string
      example: req_4f1c2e9a7b6d4c3e8a1f0b2d
    IgnoredParams:
      description: >-
        Settings you sent that the provider ignores or that were left out for
        it, comma separated. Only when there are any.
      schema:
        type: string
      example: temperature,top_p
    TagsDropped:
      description: >-
        Tags that were dropped and why, separated by `; `. Values are never
        echoed. Only when a tag was dropped.
      schema:
        type: string
      example: 'customer secret; #3 invalid_key'
    ShouldRetry:
      description: '`false` when retrying soon cannot help. The OpenAI SDKs read it.'
      schema:
        type: string
        enum:
          - 'false'
      example: 'false'
    RetryAfter:
      description: Seconds to wait before retrying.
      schema:
        type: string
      example: '2'
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - type
            - param
            - code
            - doc_url
          properties:
            message:
              type: string
              description: What happened and what to do.
            type:
              type: string
              description: Error type, as OpenAI uses it.
              example: invalid_request_error
            param:
              type:
                - string
                - 'null'
              description: The field or header at fault, if any.
            code:
              type: string
              description: A stable code. A provider's own code may appear too.
            doc_url:
              type: string
              format: uri
              description: Where this code is explained on the Errors page.
  securitySchemes:
    AtlasoKey:
      type: http
      scheme: bearer
      bearerFormat: sk-at-...
      description: >-
        Your Atlaso key in `Authorization: Bearer sk-at-...`. Send one
        Authorization header. A request that also sends `x-atlaso-key` is
        refused with 401.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.