Skip to content

API overview

All requests go to https://api.inferam.ai over HTTPS. The same model sits behind three wire formats, so official OpenAI and Anthropic SDKs work by changing only the base URL and key:

Format Endpoint Used by
OpenAI Chat Completions POST /v1/chat/completions opencode, pi, most OpenAI-compatible tools
OpenAI Responses POST /v1/responses Codex
Anthropic Messages POST /v1/messages, POST /v1/messages/count_tokens Claude Code, DeepSeek Harness

SDK base URLs: OpenAI SDKs take https://api.inferam.ai/v1, and Anthropic SDKs take https://api.inferam.ai.

Send an Inferam key either way:

Authorization: Bearer ifr_...
x-api-key: ifr_...

Create and revoke keys on inferam.ai/keys. A key’s full value is shown once, when it’s created; Inferam stores only a hash. A revoked key stops working on its next request. Keys created by inferam auth login expire after 30 days without use; keys you create on the dashboard don’t expire.

A missing, invalid or revoked key gets a 401 in the format’s own error shape (see Errors).

GET /v1/models lists the models Inferam is serving. The response parses with both the OpenAI and the Anthropic SDKs:

{
"object": "list",
"data": [{ "id": "DeepSeek-V4.1-Flash-1017", "object": "model", "type": "model", "display_name": "DeepSeek-V4.1-Flash-1017", "owned_by": "inferam", "created_at": "2026-01-01T00:00:00Z" }],
"has_more": false,
"first_id": "DeepSeek-V4.1-Flash-1017",
"last_id": "DeepSeek-V4.1-Flash-1017"
}

Use the ID from this list as model. When the served model changes, the list changes with it. A request naming any other model gets a 404 that lists the available ones.

Limit Value
Context window 524,288 tokens
Default output limit 32,768 tokens, when a request sets none
Maximum output limit 65,536 tokens. Larger values are lowered to this
Request body 32 MB
Wait for capacity up to 30 seconds, then a capacity error

The output limit is max_tokens or max_completion_tokens in Chat Completions, max_output_tokens in Responses, and max_tokens in Messages. It must be a positive integer. Reasoning tokens count toward it.

Inferam runs a fixed number of generations at once. When all are busy, your request waits in a queue for up to 30 seconds. Nothing is streamed before it’s admitted. While requests are waiting, the next free slot goes to the waiting account with the fewest generations running, so one busy account can’t starve the others. An account alone on the service can use every slot.

If no slot frees up within 30 seconds, you get a capacity error with Retry-After: 5: 503 in the OpenAI formats, or 529 overloaded_error in Anthropic Messages. Coding agents and the official SDKs retry these automatically.

If the client disconnects, its generation is stopped and the slot freed.

Every response reports input, output and cached input tokens. These are the same numbers shown on inferam.ai/usage.

Format Input Output Cached input
Chat Completions usage.prompt_tokens usage.completion_tokens usage.prompt_tokens_details.cached_tokens
Responses usage.input_tokens usage.output_tokens usage.input_tokens_details.cached_tokens
Messages usage.input_tokens + usage.cache_read_input_tokens usage.output_tokens usage.cache_read_input_tokens

In Anthropic Messages, input_tokens excludes cached tokens, as in Anthropic’s own API. Prompt caching is automatic: repeated prefixes, such as an agent’s system prompt and earlier turns, are served from cache. You don’t need cache-control markers, and cache_creation_input_tokens is always 0.

Inferam keeps no conversation state between requests. Every request carries the full conversation, as Chat Completions and Messages always do. In Responses, store is always false and previous_response_id is rejected.

Live availability and response times are on status.inferam.ai. It’s checked every 5 minutes from two regions, including a real one-token generation.