API reference
OpenFill speaks the OpenAI API. Point base_url at the address below, send your key as a bearer token, and the whole surface is the index under it.
Base URL
https://api.openfill.ai/v1
Authorization
Bearer of_live_...
Authentication
Every endpoint that is yours takes Authorization: Bearer and a key made on API keys. A key starts with of_live_, is shown once, and can carry its own price limit per market model, which a request on that key inherits when it names none. A missing or revoked key answers 401; an account that is suspended or being deleted answers 403. The market data needs no key at all.
Conventions
Bodies and errors
Requests and responses are JSON, with the exception of a file upload, which is multipart, and a file download, which is the file. Chat and Responses HTTP errors use the OpenAI envelope; Messages uses the Anthropic envelope. Streaming failures arrive in each wire's event format. See errors and retries. There is no version header; the shapes are OpenAI's, and the fields OpenFill adds are named with a prefix or documented beside the field they extend.
Headers a request can carry
| Header | Meaning |
|---|---|
| Authorization | Bearer of_live_... Required on everything except the market data. |
| x-api-key | The same key, as the Anthropic SDKs send it. Read on every route that takes a key when Authorization is absent. |
| Content-Type | application/json, except the file upload. |
| Idempotency-Key | Up to 255 characters. Applies to chat, completions, Responses and Messages, scoped to the account. |
| X-Price-Limit | Same as price_limit. The body wins if both are present. |
| X-Expires-After | Same as max_wait. The body wins if both are present, and a header that is not a whole number of seconds is refused with 400 even then. |
Headers a response can carry
| Header | Meaning |
|---|---|
| Retry-After | Seconds to wait, on a 429 and on a 503 that names one. Absent on a 429 inside a stream, which has no headers left to send. |
| x-request-id | On every response, a stream's head included. The OpenAI SDKs expose it as _request_id; quote it when you write to us and we can find that exact request in the log. |
| x-openfill-order-id | On accepted submissions and successful replays. A live stream sends it in its head before the first token; a blocking response sends headers when it completes. The same value is usage.x_market.order_id. |
| x-openfill-warning | On a 202 for a detached order whose result will not be stored. This legacy header is sent when account storage is off. Read the body's warning and result_stored fields for per-request storage controls and replays. |
No x-ratelimit header is sent. Configured limits are published on GET /v1/rate-limits. Rate and queue ceilings answer 429; body sizes and field bounds have the statuses on the rate limits page.
Machine-readable
The whole surface is described at GET https://api.openfill.ai/openapi.json, OpenAPI 3.1, maintained alongside the route handlers. Route coverage is checked against the mounted API; the endpoint pages describe translation and streaming behavior.
Every docs page is also served as Markdown at its address plus .md, or with Accept: text/markdown at the address itself, and /llms-full.txt holds all of them in reading order for an agent that wants the whole set in one fetch.
Timestamps and pages
The OpenAI-shaped objects (files, batches) carry epoch seconds, as OpenAI's do. The OpenFill objects (orders, usage records, market data) carry ISO 8601 strings, except the bucket starts on the OHLC, uptime and statistics series and the from and to bounds of a history or statistics window, which are epoch seconds so a chart can plot them without parsing.
Lists of orders and usage records page by cursor: pass next_cursor from one response as ?cursor= on the next until has_more is false. File and batch lists page by ?after= with the last id, as OpenAI's does.
Endpoint index
Everything the API serves. Each group heading links to the page with the request and response shapes.
| Method | Path | Auth | What it does |
|---|---|---|---|
| Chat and completions | |||
| POST | /v1/chat/completions | Key | Send a chat request. On a market model it rests at your price until capacity reaches it. |
| POST | /v1/completions | Key | The legacy text completion shape, priced identically. |
| Responses API | |||
| POST | /v1/responses | Key | The OpenAI Responses shape, stateless, on the same market. Codex CLI and the Responses SDKs. |
| Messages API | |||
| POST | /v1/messages | Key | The Anthropic Messages shape on the same market. Claude Code and the Anthropic SDKs. |
| POST | /v1/messages/count_tokens | Key | The gateway's prompt estimate for a body. Free, and it creates no order. |
| Orders, account and usage | |||
| GET | /v1/orders | Key | Your orders, newest first, filtered and paged. |
| GET | /v1/orders/{id} | Key | One order: status, queue position, what it cleared at. |
| GET | /v1/orders/{id}/result | Key | The stored response body, in the shape of the endpoint the request came in on. |
| DELETE | /v1/orders/{id}/result | Key | Delete a stored result ahead of your storage period. |
| POST | /v1/orders/price | Key | Change the price limit on up to 500 queued orders on market models at once. |
| POST | /v1/orders/{id}/cancel | Key | Cancel an order that is still queued. |
| GET | /v1/account | Key | Balance, order counts, defaults and your storage setting. |
| PATCH | /v1/account | Key | Change the defaults your requests inherit. |
| GET | /v1/usage | Key | Your charges, newest first, with the balance alongside. |
| Files and batches | |||
| POST | /v1/files | Key | Upload a JSONL batch input file. |
| GET | /v1/files | Key | Every file on the account, newest first. |
| GET | /v1/files/{id} | Key | One file: size, purpose and when it expires. |
| DELETE | /v1/files/{id} | Key | Delete a file, unless a batch is still working from it. |
| GET | /v1/files/{id}/content | Key | Download a file, input or batch output. |
| POST | /v1/batches | Key | Run every line of an uploaded file as an order. |
| GET | /v1/batches | Key | Your batches, newest first. |
| GET | /v1/batches/{id} | Key | One batch: status, counts and file ids. |
| POST | /v1/batches/{id}/cancel | Key | Stop a batch that is validating or running. |
| Market data | |||
| GET | /v1/models | Public | Every model served, how it is priced, its pricing ratio and length limits, and the reference mix. |
| GET | /v1/models/{model} | Public | One model's entry from that list, by id or by alias. |
| GET | /v1/rate-limits | Public | Every rate, queue, batch and size limit, as enforced. |
| GET | /v1/market | Public | The clearing level now, its mode, whether it is frozen, and the same level split into dollars per 1M cached, uncached and output tokens. A market model only, like every /v1/market route. |
| GET | /v1/market/levels | Public | Every market's clearing level right now, in one call. |
| GET | /v1/market/stream | Public | Server-sent events: one market's level as it moves, with the same split. |
| GET | /v1/market/levels/stream | Public | Server-sent events: every market's level, as deltas. |
| GET | /v1/market/price-lock | Public | The current quote, how long it is valid, the share of locked requests with a price limit above the quote that started in time, and the same split. |
| GET | /v1/market/price-lock/stream | Public | Server-sent events: one quote per window boundary, with the same split. |
| GET | /v1/market/history | Public | The level over a window, downsampled to one point per bucket. |
| GET | /v1/market/ohlc | Public | Open, high, low, close and time-weighted mean per bucket. |
| GET | /v1/uptime | Public | Probe results per bucket, pooled unless you pass ?model=, and whether the model has capacity now. |
| GET | /v1/stats/tokens | Public | Token volume per model over a window. |
| GET | /v1/stats/models | Public | Per-model totals over a window, every served model present, with how each is priced and whether it has capacity. |
| GET | /healthz | Public | Liveness. |
| GET | /api/hello | Public | Client discovery; HEAD is also supported. |
| GET | /openrouter/v1/models | Public | The partner catalog, priced from the current quote, or from a fixed-price model's prices. |
| GET | /v1/limits | Public | 308 redirect to /v1/rate-limits. |
| GET | /openapi.json | Public | This whole surface as an OpenAPI 3.1 document. |