Rate limits
The gateway limits how many requests per minute your organization can make to each model. Fourier Health sets the limit for each model your organization can call; see Rate limits in the console. Every response that reaches the rate limit check tells you your limit and how much of it is left.
How limits work
Section titled “How limits work”- Per model. Each model has its own limit and its own window. Requests to one model never count against another.
- Sliding window. The gateway counts your requests over the last 60 seconds. There is no reset at the top of each minute.
- Rejected requests don’t count. A
429doesn’t consume any of the window, so a retry afterretry-afterseconds isn’t penalized.
Response headers
Section titled “Response headers”The gateway reports the limit in the following headers:
| Header | Value |
|---|---|
x-ratelimit-limit |
Your requests-per-minute limit for the requested model. |
x-ratelimit-remaining |
Requests you can still make in the current window after this one. 0 on a 429. |
x-ratelimit-reset |
Seconds until the oldest request in the window drops out of it and frees capacity, from 1 to 60. |
retry-after |
Only on 429: seconds to wait before retrying. Equal to x-ratelimit-reset. |
The headers appear on every response that reached the rate limit check. Responses rejected earlier, such as 401 or 403, don’t carry them.
To read the headers through the openai SDKs, use client.embeddings.with_raw_response.create(...) in Python and client.embeddings.create(...).withResponse() in TypeScript.
When you’re rate limited
Section titled “When you’re rate limited”When you exceed the limit, the gateway returns 429 with a problem body and the rate limit headers:
HTTP/1.1 429 Too Many RequestsContent-Type: application/problem+json; charset=utf-8x-ratelimit-limit: 300x-ratelimit-remaining: 0x-ratelimit-reset: 12retry-after: 12x-request-id: 5c8e0d9c-2a4f-4b0e-9e1b-3f6a7d8c9e01
{ "type": "about:blank", "title": "Too Many Requests", "status": 429, "code": "rate_limited", "detail": "Rate limit exceeded"}Retries
Section titled “Retries”The official openai SDKs retry 429 responses automatically, along with connection errors and 5xx responses, twice by default with exponential backoff. Raise the retry count for batch jobs, or set it to 0 if you handle retries yourself:
import os
from openai import OpenAI
client = OpenAI( api_key=os.environ["FOURIER_API_KEY"], base_url="https://gateway.fourierhealth.com/v1", max_retries=5,)
# Or per request:client.with_options(max_retries=5).embeddings.create( model="ClinEmbed-1", input="Allergies: penicillin (rash).", extra_body={"input_type": "document"},)import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.FOURIER_API_KEY, baseURL: "https://gateway.fourierhealth.com/v1", maxRetries: 5,});
// Or per request:await client.embeddings.create( { model: "ClinEmbed-1", input: "Allergies: penicillin (rash)." }, { maxRetries: 5 },);If you call the API directly, wait retry-after seconds before you retry, and add a little jitter so parallel workers don’t retry at the same moment.
To stay within the limit in the first place, batch up to 1,000 strings into one input array. The limit counts requests, not strings or tokens.