Inference

Rate Limits

Find your account limits, check remaining capacity, and request higher limits.

Koah keeps inference free through ads shown in your app. Request limits help keep token generation sustainable as your app grows.

Rate limits set how many requests and tokens your account can use per minute.

LimitCounts
Requests per minute (RPM)Each request.
Tokens per minute (TPM)Input and output tokens. Cached and uncached input tokens count equally.

Default limits by account tier

Account tierRPMTPM
Basic120500,000
Pro1201,000,000

These are account defaults. A model, service tier, or organization-specific configuration can set different limits. A request can reach either the request limit or the token limit, even when capacity remains for the other.

Check your limits

Check these headers on successful responses and 429 Too Many Requests responses to see the limits that apply to your request.

HeaderWhat it tells you
x-ratelimit-limit-requestsThe maximum requests allowed per minute.
x-ratelimit-limit-tokensThe maximum tokens allowed per minute.
x-ratelimit-remaining-requestsThe requests remaining in the current window.
x-ratelimit-remaining-tokensThe tokens remaining in the current window.
x-ratelimit-reset-requestsThe time until the request limit resets.
x-ratelimit-reset-tokensThe time until the token limit resets.
retry-afterHow long to wait before retrying a rate-limited request, when provided.

Handle a rate limit

If you receive 429 Too Many Requests, follow retry-after when it is present. Otherwise, retry with backoff: wait longer between each attempt and stop after a small number of retries. Do not immediately repeat every failed request.

Spread requests over time and reduce concurrent requests to stay within your limits. If your app regularly needs more capacity, request higher limits.

Response codes

These are the expected HTTP responses during private preview. Response details may change. Use the reason returned with an error to decide what to do next.

CodeWhat it meansWhat to do
200The request succeeded or the stream started.Show the content. Render an ad only if Koah returns an ad ID, after the stream finishes successfully.
400 / 422The request contains invalid or unsupported input.Check the request fields and model.
401The API key is missing or invalid.Check your key and authentication settings.
403Your app does not have access to the requested operation.Contact Koah to check your access.
404The endpoint or model was not found.Check the base URL, endpoint, and model ID.
429 β€” request volumeYour app is sending too many requests.Slow down, follow retry guidance, or request higher limits.
429 β€” ad renderingYour rate limit was reduced because requested ads repeatedly did not render.Fix the ad integration and contact Koah for a review. Repeated retries will not fix the cause.
5xxKoah or a model provider has a temporary service error.Retry with backoff and keep the user's work.

429 can have different causes. Check the returned reason before retrying. Responses without an ad ID do not require ad display and do not count as missed ads. See the error reference for more detail.

Request higher limits

Need more token capacity? Request higher limits with your app name or publisher ID, expected request and token volume, and an example of your ad placement. Do not include API keys or private user queries.

We will work with you to improve the ad placement and user experience so that the value of the ads can support more token generation. Better visibility, relevance, and placement design can help your app support higher demand.

Higher limits are reviewed with your integration; they are not automatic.

Was this helpful?