Skip to content
docs

Limits

The router checks request size and structure before it calls the model. A request that is too large returns 413; a request with an invalid structure returns 422 with the code validation_error.

LimitValueCode when exceeded
Whole request body100 MBpayload_too_large
One inline file (image, PDF), original size before base6450 MBfile_too_large
All text in the request: messages, system prompt, tool descriptions, input on /v1/embeddings, state and questions on /v1/systemone15 MBtext_content_too_large

The model also limits context size: see context_length and max_completion_tokens in the catalog. Input that does not fit in the model’s context window returns 400 with the code provider_context_length_exceeded.

LimitValue
Model ID length200 characters
Messages per request (input items on /v1/responses)up to 100,000
Tools (tools) per requestup to 10,000
input items on /v1/embeddingsup to 2048
Nesting depth of state, instructions, and option descriptions on /v1/systemoneup to 64 levels

How many tools a specific model accepts is up to its provider, and that number may be lower. When the provider rejects the request, the router returns its own code, such as provider_bad_request; the reason may be given in message.

A non-streaming response must arrive within 5 minutes. For long generations, use "stream": true. Web search has a budget of 240 seconds. Without streaming, running out of it returns 408 provider_timeout; in a stream, the budget is checked between steps and may end the response as incomplete.

There is no fixed requests-per-second limit per key. The two 429 codes call for different handling:

CodeWhat happenedWhat to do
provider_rate_limitedThe model limited the request rateRetry with a delay. Under sustained load, spread it across several models
api_key_limit_exceededThe key’s spending limit for the period is used up. extra.reset_at holds the time the counter resets (UTC, ISO 8601)Wait for the reset, raise the key’s limit, or use another key

Under peak load, the router responds with 503, the code service_unavailable, and a Retry-After header.

  • Retry only transient failures: 408, 429, 500, 502, 503. Other 4xx codes are request errors, and a retry returns the same response. With api_key_limit_exceeded, retrying before extra.reset_at is pointless too.
  • Use exponential backoff with jitter. When every client retries at the same moment, they create a second wave of load; random jitter added to the delay spreads it out.
  • Respect Retry-After. If the header is present, wait at least that long before retrying.
  • Cap the number of attempts, for example at three. After that, return the error to your own client.
  • A dropped connection does not cancel generation. An interrupted stream is billed in full; see Tokens and usage. A retry after the drop is billed again.

For the full list of codes and error formats, see Errors.