Overview
OpenAI- and Anthropic-compatible inference, plus request costs, your balance and routing configuration.
Spare Inference speaks the APIs your code already uses. Point an OpenAI or Anthropic SDK at us and change the model id; requests, responses, streaming and tool calls work as they do there.
Endpoints
Inference. Any API key can call these.
| Endpoint | Compatible with | Use it from |
|---|---|---|
POST /v1/chat/completions | OpenAI Chat Completions | OpenAI SDKs, LangChain, LiteLLM, most frameworks |
POST /v1/responses | OpenAI Responses | OpenAI SDKs and the Agents SDK |
POST /v1/messages | Anthropic Messages | Anthropic SDKs and the agents built on them |
GET /v1/models | OpenAI Models | Any client that lists models. Returns live prices; no key needed |
Usage and billing. Read-only, for scripts and agents that track their own spend. For history and totals, use the console's Activity and Billing pages.
| Endpoint | Returns | Scope |
|---|---|---|
GET /v1/requests/{request_id}/settlement | What one request used and cost | inference:invoke |
GET /v1/billing/balance | Credit available now | billing:read |
Configuration. Manage from code what you would otherwise set in the console.
| Endpoints | Manage | Scopes |
|---|---|---|
/v1/namespaces/me/routing-presets | Routing presets | routing_preset:read, routing_preset:write |
/v1/byok/connections | Provider keys you saved in the console | byok:read, byok:write |
GET /health tells you whether the API is reachable.
Base URLs
| OpenAI SDKs | Anthropic SDKs | |
|---|---|---|
| Production | https://api.spareinference.ai/v1 | https://api.spareinference.ai |
| Sandbox | https://spareinference.ai/api/sandbox/v1 | https://spareinference.ai/api/sandbox |
Anthropic SDKs add /v1 themselves. The sandbox covers the inference endpoints only: any key is accepted and
every request gets a canned reply. Pick it in the server menu of an endpoint page to send requests from the
browser.
Authentication
Send your API key as Authorization: Bearer $SPARE_API_KEY or x-api-key: $SPARE_API_KEY. See
Authentication for scopes.
Models
| Model id | deepseek-v4.1-flash |
| Snapshot | deepseek-ai/DeepSeek-V4.1-Flash-1017 |
| Context | 1M tokens |
| Max output | 384K tokens |
More open models are coming. GET /v1/models always has the current list and prices; see
also Models.
Request ids
Every inference response carries an x-bitrouter-request-id header. Keep it: it is how you look up what the
request cost with settlement, and what to send us if something went wrong.
Errors
Errors follow the shape of the API each endpoint is compatible with. See Errors for status codes and what to do about them.
The spec
The OpenAPI document for these endpoints is at /openapi.json, for generating clients or
handing to an agent. Every page here also has a Markdown version: add .md to its URL.
How is this guide?