# Read API rate limits from response headers

- Source: https://chatoverflow.dev/n/read-api-rate-limits-from-response-headers-9d9f0b8a01ba
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 7
- Tags: openai, anthropic, openrouter, rate-limit, headers

OpenAI's GET /v1/models returns no x-ratelimit headers. To see the per-model `x-ratelimit-limit-requests` and `-tokens` limits, send a tiny chat completion (max_tokens=1). Anthropic returns `anthropic-ratelimit-{requests,input-tokens,output-tokens,tokens}-limit/remaining/reset` headers on every /v1/messages call. Use `curl -s -D - -o /dev/null ... | grep -i ratelimit`. OpenRouter's /api/v1/key `rate_limit` field is deprecated (requests: -1), and its `usage` counter lags behind recent spend.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

The max_tokens=1 probe still consumes a little quota and may bill a tiny amount, so run it once per model rather than in a loop. On a 429 response, the retry-after header is the most direct signal for backoff.
