Infere's API is OpenAI-compatible. The base URL is https://api.infere.com/v1 and the key's secret goes in Authorization: Bearer <secret>, so an OpenAI client needs only those two changes. This page covers what Infere adds: headers that group requests in Logs, released prompts, response headers and errors.

Base URL

https://api.infere.com/v1

Authentication

Every request carries the key's secret in the Authorization header, after the word Bearer:

Authorization: Bearer <key secret>

A key decides which models the request may use, its limits and budget, its protections, what Infere changes in the request, and whether prompts and responses are logged. Create and manage keys on Keys; a key's page shows the settings in force.

Endpoints

Method Endpoint Description
POST /v1/chat/completions Chat completions; the model field names the model that answers (streaming supported)
POST /v1/embeddings Text embeddings
POST /v1/audio/transcriptions Speech to text (multipart)
POST /v1/audio/speech Text to speech
GET /v1/models The models your key can call

Models is the catalog of every model you can call - chat, embedding, image, audio and rerank - and a model's panel shows its provider and endpoint. The request names its model, and Infere routes it to that model's provider; there is no automatic model selection and no routing mode.

A key's Allowed models (empty means any model) and Excluded models decide what it may call. Fallback models are tried in order when the provider fails: a provider 5xx, 429 or 408, a timeout, a network error, or a provider whose circuit is open. Other 4xx errors from the provider go back to your app unchanged, and Infere's own limits never fall back - they refuse the request before any model is called.

Grouping Requests: Runs, Conversations, Jobs and Attributes

Logs groups requests by the IDs your project sends. All of them are optional; a request without any is a run of one step.

What Send Shows in Logs as
Run: one unit of work, possibly several model calls (an agent run, a pipeline) X-Infere-Session-Id: <run id> on every call of the run. Optional: X-Infere-Session-Name (a readable name) and X-Infere-Session-Path (the step, e.g. /plan) Runs tab, and a run page with its steps
Nesting inside a run X-Trace-Parent: <parent step's id> Nested steps in the run's tree
Conversation: the turns of one chat X-Conversation-Id: <conversation id> on every turn Conversations tab, and a conversation page with its turns
Job: a batch of independent items X-Infere-Batch-Id: <job id> on every item Jobs tab, and a job page with its items
End user the request body's user field End user column, filter and group-by
Attributes X-Property-<name>: <value>, e.g. X-Property-feature: checkout Attribute columns, filters and group-by ("Your attributes")

Use X-Infere-Session-Id for runs; it is the one header to use. Send a new run ID for each unit of work, and the same conversation ID for each turn of a chat.

import os
from openai import OpenAI

client = OpenAI(base_url="https://api.infere.com/v1", api_key=os.environ["INFERE_API_KEY"])

# Two steps of one run
for step, text in [("/plan", "List two steps to boil an egg."), ("/answer", "How long to boil an egg?")]:
    client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{"role": "user", "content": text}],
        extra_headers={
            "X-Infere-Session-Id": "run-2026-11-19-001",
            "X-Infere-Session-Name": "egg-helper",
            "X-Infere-Session-Path": step,
        },
    )

Requests on a Key with a Released Prompt

When a prompt is released to a key, every request on that key gets the prompt's messages and settings. Your request still carries its own messages:

  • The prompt's messages go first, then the messages your request sends.
  • messages must not be empty: send at least your app's own message. An empty messages array is refused with 400 INFERE_ERR_1301_INVALID_REQUEST_FORMAT.
  • Fill the prompt's {{variables}} with template_variables in the request body. The key's default values fill any you leave out, and a variable with no value reaches the model as written ({{name}}).
  • "disable_prompt_templates": true skips the released prompt for that one request.
client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Classify it."}],
    extra_body={"template_variables": {
        "labels": "billing, bug, praise",
        "message": "I was charged twice this month",
    }},
)

The prompt belongs to the key: a request can't choose a different prompt. To serve two prompts, use two keys.

Response Headers

The response body is the provider's OpenAI-format response. Infere adds these response headers:

Header Value
X-Infere-Request-Id The request's ID; paste it into Logs search to open the request
X-Infere-Model The model that answered
X-Infere-Provider The provider that served it
X-Infere-Fallback true when a fallback model answered instead of the one asked for
X-Infere-Latency-Ms Infere's measured latency for the request
X-Infere-Estimated-Cost The estimated cost in dollars

Errors

Errors use the OpenAI error shape with an Infere code in the code field:

{"error": {"message": "Model 'no-such-model-demo' not found. Check /v1/models.",
           "type": "provider_error", "param": null,
           "code": "INFERE_ERR_1404_MODEL_NOT_FOUND"}}

The code's name says what happened. Refused requests are logged too (outcome Refused, cost $0), with the reason, the HTTP status and the code in the request panel.

Code family Meaning
INFERE_ERR_10xx The key: missing, malformed, expired, revoked or not found
INFERE_ERR_11xx Access and protection: IP not allowed, model excluded or not allowed, personal data, attack check, content category blocked
INFERE_ERR_12xx Money and limits: no credit, budget exceeded, rate limit (1207), concurrency limit (1208)
INFERE_ERR_13xx The request body is invalid
INFERE_ERR_14xx The provider or model: not found, unavailable, timed out, rate limited

Status codes

  • 400 - the request body is invalid, for example an empty messages array (INFERE_ERR_13xx)
  • 401 - the key is missing, malformed, expired, revoked or not found (INFERE_ERR_10xx)
  • 402 - no credit in the workspace, or the key's budget is spent
  • 403 - refused by protection: IP not allowed, model excluded or not allowed, personal data, attack check, or a content category blocked. A blocklist match also refuses with 403 and costs nothing
  • 404 - the model was not found
  • 408 - every attempt ran out of time
  • 429 - a rate limit (1207) or the concurrency limit (1208)
  • 503 - no endpoint of the model in the chosen data-residency region

The key is checked before any model is called: its status, the workspace's credit, the key's budget, its IP allowlist, its allowed models and its protections refuse a request before it reaches a provider.