For AI agents, the documentation index lists all pages. Append .md to a documentation URL for Markdown, or request text/markdown.

Skip to Content
spare inference

Overview

OpenAI- and Anthropic-compatible inference, plus request costs, your balance and routing configuration.

3 min readEdit this page

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.

EndpointCompatible withUse it from
POST /v1/chat/completionsOpenAI Chat CompletionsOpenAI SDKs, LangChain, LiteLLM, most frameworks
POST /v1/responsesOpenAI ResponsesOpenAI SDKs and the Agents SDK
POST /v1/messagesAnthropic MessagesAnthropic SDKs and the agents built on them
GET /v1/modelsOpenAI ModelsAny 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.

EndpointReturnsScope
GET /v1/requests/{request_id}/settlementWhat one request used and costinference:invoke
GET /v1/billing/balanceCredit available nowbilling:read

Configuration. Manage from code what you would otherwise set in the console.

EndpointsManageScopes
/v1/namespaces/me/routing-presetsRouting presetsrouting_preset:read, routing_preset:write
/v1/byok/connectionsProvider keys you saved in the consolebyok:read, byok:write

GET /health tells you whether the API is reachable.

Base URLs

OpenAI SDKsAnthropic SDKs
Productionhttps://api.spareinference.ai/v1https://api.spareinference.ai
Sandboxhttps://spareinference.ai/api/sandbox/v1https://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 iddeepseek-v4.1-flash
Snapshotdeepseek-ai/DeepSeek-V4.1-Flash-1017
Context1M tokens
Max output384K 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?