Chat completions
BetaWe just launched Apps: hosted models, actions and pages, on the same bill as your inference.Read the Apps docs

Create a chat completion

POSThttps://api.inferencebureau.com/v1/chat/completions

The OpenAI chat completions API, for every certified language model. Supports streaming, tools, and structured output. Dispatch picks the provider; the model you request is the model that answers, unless you allow model fallback. For Claude, POST /v1/messages speaks the Anthropic API natively.

Body

application/json, up to 1 MiB
  • modelstringrequired

    Model slug, e.g. openai/gpt-4o-mini. Slugs match OpenRouter. A vendor's own name (gpt-5-mini, claude-sonnet-4-5-20250929) resolves to the catalog id when exactly one model matches. A team alias such as org/fast runs as the model it names, with its preset's defaults for fields you leave out. GET /v1/models lists the ones your key may call.

  • messagesarrayrequired

    The conversation so far. At least one message.

  • streambooleanoptional

    Return server-sent events as tokens are generated.

  • max_tokensintegeroptional

    Upper bound on generated tokens. Also sets how much balance is reserved. max_completion_tokens is accepted too. When neither is sent, output is limited to 4,096 tokens (or your maxOutputTokens Directive), never more than the model's maximum.

  • toolsarrayoptional

    Functions the model may call: tools of type function (or custom). Other tool types are refused with unsupported_parameter, as are web_search_options and OpenRouter's plugins; see Web search.

  • tool_choicestring | objectoptional

    Force, allow, or forbid tool calls.

  • parallel_tool_callsbooleanoptional

    Allow several tool calls in one turn.

  • response_formatobjectoptional

    Constrain output to JSON or a JSON schema.

  • temperaturenumberoptional

    Sampling temperature.

  • top_pnumberoptional

    Nucleus sampling.

  • stopstring | arrayoptional

    Sequences that end generation.

  • seedintegeroptional

    Best-effort deterministic sampling.

  • reasoningobjectoptional

    Reasoning controls for models that support them.

  • stream_optionsobjectoptional

    Pass { "include_usage": true } for a final usage chunk.

  • nintegeroptional

    Only 1 is supported.

  • userstringoptional

    Your end user, up to 256 characters: recorded on the request for attribution and per-end-user Directives, never forwarded. safety_identifier is read the same way when user is absent (and is forwarded, as sent). The ib-user header wins over both.

  • metadata, store, models, providerOptionsoptional

    Accepted and not forwarded. Providers are always chosen by Dispatch, never by the request.

  • ibobjectoptional

    Inference Bureau extension, removed before dispatch. tags: up to ten tags for cost breakdowns. For mixed-model sessions: session, suggestion, decision, confirmed_by, task, ignored unless the key is opted in. In the OpenAI SDKs, pass it with extra_body (Python) or as an extra field (TypeScript).

Headers

  • Authorizationstringrequired

    Bearer ib_live_…, or the key in x-api-key. See Authentication.

  • Content-Typestringrequired

    application/json. Anything else is refused with 400 invalid_request.

  • Idempotency-Keystringoptional

    Makes retries safe: a repeated key never starts a second generation. Kept for 24 hours. See Request IDs.

  • X-Client-Request-IDstringoptional

    Your own correlation id, recorded on the receipt.

  • ib-sessionstringoptional

    Groups this turn with the rest of its conversation, like ib.session. See Sessions.

  • ib-userstringoptional

    Your end user, up to 256 characters; wins over user. See End users and tags.

  • ib-tagsstringoptional

    Comma-separated tags, such as search,onboarding, added to ib.tags; at most ten in all. Never sent upstream.

Response headers

HeaderMeaning
X-Request-IDLook up the request in Logs or via GET /v1/requests/:id.
Retry-AfterOn 429, seconds to wait before retrying. Also sent when a provider asked for a cooldown.
X-RateLimit-ScopeOn 429, which level's limit was hit: organization, project, environment, key, or end_user (a per-end-user limit). The management API sends management_key or management_writes (see Management), and reading logged content content_read.
X-RateLimit-DimensionOn 429, which limit was hit: requests, tokens or concurrency, or an end user's daily_requests or daily_tokens. These are your Directives rate limits, which every team has by default.
X-Original-Request-IDOn a 409 for a repeated Idempotency-Key, the request that first used it.
ib-fallback-modelA fallback model answered instead of the requested one; names it.
ib-alias-deprecatedThe request named a deprecated alias: its retirement date, and replaced-by= its replacement when it has one.
ib-suggestion, ib-session, …Keys opted in to mixed-model sessions.

Limits

Request bodies are limited to 1 MiB (413 payload_too_large). A request has 240 seconds overall. A stream must start within 30 seconds, and is ended if it then sends nothing for 30 seconds. A non-streamed response may take the whole 240 seconds; past that the request fails with 504 request_deadline_exceeded. A stream that breaks after it started sends a final data: {"error": { "code": "stream_interrupted", … } } event and closes without [DONE]; see Errors.

Input plus max_tokens must fit the model's context window, or the request is refused with 400 context_limit_exceeded before anything is reserved.