Skip to main content
Model APIs bill by token and enforce request and token rate limits. You can also set a workspace budget and query usage by API key or model.

Rate limits

Baseten applies two rate limits:
  • Requests per minute (RPM): The maximum number of API requests per minute.
  • Tokens per minute (TPM): The maximum number of input and output tokens processed per minute. Cached and uncached input tokens count equally toward this limit, even though cached tokens cost less.
To monitor token and request consumption by API key or model, see Usage. Default limits vary by account status. To raise a Basic account’s limits, request email verification. You can also use that form to move to Pro or Enterprise.
If you exceed these limits, the API returns a 429 Too Many Requests error. See Inference errors for how to respond.

Rate limit response headers

Successful responses and 429 Too Many Requests errors from Model APIs include these rate limit headers:
  • x-ratelimit-limit-requests: Reports the maximum number of requests you can send per minute.
  • x-ratelimit-remaining-requests: Reports how many requests remain before you reach the request rate limit.
  • x-ratelimit-limit-tokens: Reports the maximum number of tokens your requests can use per minute.
  • x-ratelimit-remaining-tokens: Reports how many tokens remain before you reach the token rate limit.
Rate limits replenish continuously rather than reset at fixed intervals. Because the limits account for how quickly traffic arrives, the remaining values might not equal the per-minute limit minus the requests or tokens used during the current minute. Send requests at a steady rate, and use exponential backoff after a 429 Too Many Requests response.
Rate limits do not guarantee available capacity. Baseten can return 529 Overloaded when a Model API runs out of capacity. See 529: overloaded.

Pricing

Model APIs bill per million tokens. For current per-model rates, see the Model APIs pricing page. Fast tier variants have their own per-model pricing and rate limits; see Supported models for details.

Cached input tokens

Cached input tokens are prompt tokens served from the KV cache at a discounted rate. Caching is automatic and requires no request flags. For coding-agent requests, Baseten uses recognized session IDs to pin related requests to the same replica. Claude Code, Codex, and OpenCode include these IDs without additional configuration. Baseten checks the following header:
  • x-session-affinity: generic session ID
The following headers are recognized as best-effort fallbacks:
  • x-claude-code-session-id: Claude Code’s root session
  • x-claude-code-agent-id: Claude Code’s subagent
  • session-id: Codex
  • x-opencode-session: OpenCode
  • x-session-id: generic session ID
For other integrations, send a consistent x-session-affinity value to pin related requests to the same region or replica. Use one ID for a single conversation or agent task, including its subagents. Do not reuse an ID across unrelated tasks because doing so concentrates traffic on one replica. The ID should remain stable within a task and differ across tasks. For example, hash your internal conversation or session ID with SHA-256 and use the first 16 hexadecimal characters:
x-session.py
Send the resulting value in the x-session-affinity header on every request in the conversation:

Budgets

Set a monthly budget to receive email notifications as workspace spend approaches the configured amount. If you enforce the budget, Baseten rejects Model API requests after the workspace reaches it. Budget enforcement does not affect dedicated inference or training.

Usage

Track Model APIs usage with baseten model-api usage or the GET /v1/model_apis/usage REST endpoint. Both return input, cached input, uncached input, and output token counts, plus request counts, in 1m, 1h, or 1d buckets. Group or filter results by API key, user, or model. Personal API keys and OAuth credentials are attributed to a user; usage from credentials that are not user-scoped has a null user ID.
Show daily usage per model over the last 7 days:
Break hourly usage down by user and model for one model:
Filter to a specific API key prefix and output JSON:
Usage data is available from August 5, 2026 at 20:45 UTC (2026-08-05T20:45:00Z). Baseten did not backfill earlier Model APIs usage.
You can also track usage as Prometheus metrics in your own observability stack through the metrics export endpoint: baseten_model_api_tokens_total splits token counts by token_type (uncached_input, cached_input, output), and baseten_model_api_inference_requests_total counts requests by status_code. See Model API metrics for the full label set.

Next steps

Inference errors

Handle 429 Too Many Requests and other status codes.

Model APIs overview

Review supported models and features.