API overview
One base URL, one key, every format. Everything you need before the first call.
Base URL
https://binference.io/api/v1For the Anthropic SDKs and Claude Code, use https://binference.io/api: they add /v1 themselves.
Endpoints
| Method | Path | Format | Key |
|---|---|---|---|
POST | /chat/completions | OpenAI Chat Completions | Yes |
POST | /responses | OpenAI Responses | Yes |
POST | /messages | Anthropic Messages | Yes |
POST | /images | Image generation | Yes |
POST | /uploads | Upload an image for models | Yes |
GET | /models | Every model and its price | No |
GET | /images/models | Every image model and its price | No |
GET | /balance | What the key can spend | Yes |
Any other path under /api/v1, like embeddings, answers 404 not_found in JSON.
DEX market data
The DEX's markets, order books, trades and candles, under the same base URL. They're public: no key needed.
| Method | Path | What it is |
|---|---|---|
GET | /dex/markets | Every open market |
GET | /dex/markets/{id}/book | A market's order book |
GET | /dex/markets/{id}/trades | Its latest trades |
GET | /dex/markets/{id}/candles | Its price candles |
- Numbers as decimal strings. Prices are USDT per $1 of credit, sizes are dollars of credit and USDT amounts are USDT. Times are Unix milliseconds.
- Cached for 1 second. Ask at most once a second.
- 1,200 weight a minute per IP address. Each call counts 1 to 5. Over it, the answer is
429 rate_limitedwith the seconds to wait inRetry-After. - Only the query parameters each endpoint lists, each once. Any other is refused with
400 unknown_parameter. - Errors are JSON:
{ "error": { "code": "unknown_market", "message": "..." } }.404 not_foundmeans the DEX is not open yet. - Wallets and accounts never appear.
MCP server
Agents can also read their credit, usage and limits, and manage their own keys, over MCP at https://binference.io/api/mcp, with the same key. See MCP server to connect, and MCP tools for every tool.
Authentication
Send your binf_ key as a bearer token or as x-api-key:
Authorization: Bearer binf_...A missing, wrong or revoked key answers 401 invalid_api_key. See API keys.
Requests
- JSON bodies, up to 4 MB. Send images and files as URLs, not inline data: upload a large image and send its link.
- Bodies pass through as sent. Every field of each format works, beyond the ones these pages list.
- Stateless. Nothing is stored between calls. Send the conversation every time.
- From anywhere. The API accepts calls from any origin, so browser tools work. Keys in web pages can be read by visitors: keep them on a server.
Answers
Answers follow each format's own shape, with three additions:
| Field or header | What it is |
|---|---|
usage.cost | What the call was charged, in dollars. On every format but Messages. |
x-binference-call-id | The call's id on your Calls page. Quote it when you contact us. |
x-generation-id | The provider's id for the answer. |
Errors
Errors use each format's own shape, with a stable code to branch on:
{
"error": {
"message": "This agent is starting calls faster than 600 a minute. Retry in 1 second.",
"type": "rate_limit_error",
"code": "rate_limited",
"param": null
}
}See every code in Errors, and the limits in Rate limits.