Skip to main content
Docs · API reference

API reference

The Inferbase inference API. Base URLs, authentication, every endpoint, and a quick start for the OpenAI SDKs.

Browse docs · API reference › API reference
On this page
  1. Request shapes and formats
  2. Base URLs
  3. Authentication
  4. Endpoints
  5. Quick start
  6. Python (OpenAI SDK)
  7. Node.js (OpenAI SDK)
  8. curl, streaming
  9. Anthropic SDK
  10. Conventions

The inference API accepts requests in the OpenAI chat completions shape, the OpenAI Responses shape, and the Anthropic Messages shape, and serves them through the routing engine. Existing SDKs work when pointed at the Inferbase base URL. This section documents the endpoints an application calls, in one shape: method and path, purpose, authentication, parameters, example, response, and errors. Endpoints that serve the portal itself, such as usage reports, receipts and agent runs, are not part of this reference.

Only chat routes. Embeddings, rerank, images, speech, transcription and video are chosen by the routing policy's pool rather than by evidence, because nothing Inferbase measures ranks those models against each other. See Embeddings and rerank and Images, audio and video.

Request shapes and formats

The Inferbase API accepts chat requests in three shapes: OpenAI Chat Completions, the OpenAI Responses API, and Anthropic Messages. It is OpenAI compatible and Anthropic compatible, so the OpenAI and Anthropic SDKs work when pointed at the Inferbase base URL; send the shape your SDK or framework already uses. All three reach the same router, take model: "auto" or a model id, and support streaming and tool calling.

ShapeEndpointTypical clients
OpenAI Chat CompletionsPOST /chat/completionsOpenAI SDKs and any OpenAI-compatible client. See Chat completions.
OpenAI ResponsesPOST /responsesThe OpenAI Agents SDK and Pydantic AI. See Responses.
Anthropic MessagesPOST /v1/messages on https://api.inferbase.aiAnthropic SDKs and Claude Code. See Anthropic Messages.

The other surfaces use the OpenAI shape for their kind of request: embeddings, images, speech, transcription and video. Rerank uses the Cohere shape.

Base URLs

Base URLUse
https://api.inferbase.ai/api/v1/inferenceThe full form.
https://api.inferbase.ai/v1For SDKs that expect a base URL ending in /v1. Serves the model endpoints only: chat completions, Responses, messages, embeddings, rerank, images, audio, video, and the model list.
https://api.inferbase.aiFor Anthropic SDKs, which append /v1/messages themselves.

Both OpenAI-style base URLs serve the model endpoints with the same authentication, limits, and timeouts. Keys, credits, usage, routing decisions, and model health are served only under https://api.inferbase.ai/api/v1/inference. Use one base URL per integration.

Authentication

Send the key from Gateway › API keys as a bearer token.

text
Authorization: Bearer inf_your_api_key

Endpoints that create, change, or revoke keys require a signed-in session rather than a key, so a leaked key cannot mint another. Two endpoints need no credential: the model list and a model's health. Routing preview needs a signed-in session. See Authentication and idempotency.

Endpoints

Method and pathPurposeAuth
POST /chat/completionsChat completion, streaming or not. model: "auto" routes.Key or session
POST /responsesThe OpenAI Responses shape, for the OpenAI Agents SDK and Pydantic AI.Key or session
POST /messagesThe Anthropic Messages shape, for Anthropic SDKs and Claude Code. Served at https://api.inferbase.ai/v1/messages.Key or session
POST /embeddingsEmbeddings, OpenAI shape. The pool decides; auto takes its first embedding model.Key or session
POST /rerankRerank, Cohere shape. The pool decides; auto takes its first rerank model.Key or session
POST /images/generationsGenerate images, OpenAI shape.Key or session
POST /images/editsChange an image you send, OpenAI shape.Key or session
POST /audio/speechText to audio, OpenAI shape. Serves on an Inferbase route priced in its unit, or on your own credential.Key or session
POST /audio/transcriptionsAudio to text, OpenAI shape, multipart. Serves on an Inferbase route priced in its unit, or on your own credential.Key or session
POST /videosStart a video generation. Returns a job. Serves on an Inferbase route priced in its unit, or on your own credential.Key or session
GET /videos/{video_id}The job's status and progress.Key or session
GET /videos/{video_id}/contentDownload the finished video.Key or session
GET /modelsThe models the caller can use, with auto first.None
GET /models/{model_id}/healthWhether the provider serving a model is reachable.None
GET /routing-decisions/{request_id}The decision record for one routed request.Key or session
POST /keys, GET /keys, PATCH /keys/{key_id}, DELETE /keys/{key_id}Manage API keys.Session to write; key or session to list
GET /credits, GET /credits/transactions, GET /usageBalance, transactions, and usage logs.Key or session

Paths are relative to https://api.inferbase.ai/api/v1/inference. The model endpoints are also served under https://api.inferbase.ai/v1, and Anthropic SDKs reach /messages through their own base.

Quick start

Python (OpenAI SDK)

python
from openai import OpenAI

client = OpenAI(
    api_key="inf_your_api_key",
    base_url="https://api.inferbase.ai/api/v1/inference",
)

# Routed: Inferbase chooses the model from the pool your routing policy allows.
response = client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "Explain quantum computing in 3 sentences."}],
)
print(response.model)
print(response.choices[0].message.content)

# Pinned: a specific model, no routing step.
response = client.chat.completions.create(
    model="openai-gpt-oss-120b",
    messages=[{"role": "user", "content": "Hello!"}],
)

Node.js (OpenAI SDK)

typescript
import OpenAI from 'openai'

const client = new OpenAI({
  apiKey: 'inf_your_api_key',
  baseURL: 'https://api.inferbase.ai/api/v1/inference',
})

const response = await client.chat.completions.create({
  model: 'auto',
  messages: [{ role: 'user', content: 'Explain quantum computing in 3 sentences.' }],
})
console.log(response.choices[0].message.content)

curl, streaming

bash
curl -N https://api.inferbase.ai/api/v1/inference/chat/completions \
  -H "Authorization: Bearer inf_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "messages": [{"role": "user", "content": "Hello!"}],
    "stream": true
  }'

Anthropic SDK

python
from anthropic import Anthropic

client = Anthropic(auth_token="inf_your_api_key", base_url="https://api.inferbase.ai")
message = client.messages.create(
    model="auto",
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello!"}],
)

The Anthropic SDK sends its key as x-api-key by default, which the gateway does not read. Pass the key as the auth token, which sends the bearer header.

Conventions

  • Model ids are as listed by GET /models: the catalog id of the model, such as openai-gpt-oss-120b, the same id the model's page carries at /models/{id}. A specific variant a route serves is named with a colon, such as deepseek-r1-0528:turbo. The id says which model, never which provider served it. A provider's own spelling of an id, such as openai/gpt-oss-120b, is accepted as an alias on every request; responses always return the catalog id.
  • Unrecognized request fields are rejected with a 422, never ignored. A field that is accepted is either forwarded to the provider or reported as not forwarded, so a 200 always means the request you sent is the request that ran.
  • The response model is always the model that served the request, never auto. The response id is the request id.
  • Errors use the OpenAI error envelope with a request_id. See Errors.

Last updated October 11, 2026.