API overview

One base URL, one key, every format. Everything you need before the first call.

Base URL

https://binference.io/api/v1

For the Anthropic SDKs and Claude Code, use https://binference.io/api: they add /v1 themselves.

Endpoints

MethodPathFormatKey
POST/chat/completionsOpenAI Chat CompletionsYes
POST/responsesOpenAI ResponsesYes
POST/messagesAnthropic MessagesYes
POST/imagesImage generationYes
POST/uploadsUpload an image for modelsYes
GET/modelsEvery model and its priceNo
GET/images/modelsEvery image model and its priceNo
GET/balanceWhat the key can spendYes

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.

MethodPathWhat it is
GET/dex/marketsEvery open market
GET/dex/markets/{id}/bookA market's order book
GET/dex/markets/{id}/tradesIts latest trades
GET/dex/markets/{id}/candlesIts 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_limited with the seconds to wait in Retry-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_found means 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 headerWhat it is
usage.costWhat the call was charged, in dollars. On every format but Messages.
x-binference-call-idThe call's id on your Calls page. Quote it when you contact us.
x-generation-idThe 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.

On this page