Messages (Anthropic)
BetaWe just launched Apps: hosted models, actions and pages, on the same bill as your inference.Read the Apps docs

Create a message

POSThttps://api.inferencebureau.com/v1/messages

The Anthropic Messages API. anthropic/* models pass through natively, so content blocks, system, cache_control, extended thinking, tools, and output_config work as in the Anthropic SDK. Other models certified for this endpoint (OpenAI, Google, and more; see Models) take the same request and return the same response shape: the gateway converts to the provider's format and back, including tools, streaming, and structured output. Point the SDK's base URL here and use your project key.

Body

application/json, up to 1 MiB
  • modelstringrequired

    A model slug, e.g. anthropic/claude-sonnet-5 or openai/gpt-5-mini. Anthropic's own names, such as claude-sonnet-4-5-20250929, resolve to the catalog id, and a team alias such as org/fast to the model it names (its preset may supply max_tokens). A model without a route certified for this endpoint is refused with invalid_request; use chat completions for it.

  • max_tokensintegerrequired

    Upper bound on generated tokens, including thinking. Also sets how much balance is reserved; Directives may lower it.

  • messagesarrayrequired

    user and assistant turns. Content is a string or an array of content blocks.

  • systemstring | arrayoptional

    System prompt. Text blocks may carry cache_control.

  • streambooleanoptional

    Return Anthropic server-sent events.

  • toolsarrayoptional

    Tool definitions with input_schema, and Anthropic's web_search_20250305 or web_search_20260209 server tool with a required max_uses (see Web search). Client tools (custom, bash, text_editor, computer, memory) work as usual. Other server tools, such as web fetch and code execution, are refused with unsupported_parameter, as are mcp_servers and container.

  • tool_choiceobjectoptional

    Force, allow, or forbid tool use.

  • thinkingobjectoptional

    Extended thinking settings for models that support it.

  • output_configobjectoptional

    Structured output with a JSON schema.

  • temperature, top_p, top_k, stop_sequencesoptional

    Sampling controls, as in the Anthropic API.

  • metadataobjectoptional

    Not forwarded. metadata.user_id is recorded as your end user for attribution and per-end-user Directives.

  • ibobjectoptional

    Inference Bureau extension, removed before dispatch: tags (up to ten) and the mixed-model fields, as on chat completions.

Headers

  • x-api-keystringoptional

    Your ib_live_… key, as the Anthropic SDK sends it. Authorization: Bearer works too and wins when both are sent.

  • anthropic-versionstringoptional

    Forwarded. Defaults to 2023-06-01.

  • anthropic-betastringoptional

    Forwarded unchanged.

  • Idempotency-Keystringoptional

    As for chat completions; keys are scoped to this endpoint. See Request IDs.

  • X-Client-Request-IDstringoptional

    Your own correlation id, recorded on the receipt.

  • ib-userstringoptional

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

  • ib-tagsstringoptional

    Comma-separated tags for cost breakdowns, at most ten with ib.tags. Never sent upstream.

  • ib-sessionstringoptional

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

The response id is the generation id, the same identifier chat completions return. Look up the charge with GET /v1/requests/:id using the X-Request-ID header.

Errors

Errors use Anthropic's shape so SDK error handling and retries work unchanged. error.code carries the stable code from Errors, and request_id matches the X-Request-ID header.

Statuserror.type
400, 409invalid_request_error
401authentication_error
402billing_error
403permission_error
404not_found_error
413request_too_large
429rate_limit_error
503overloaded_error
504 and othersapi_error

A stream that breaks after it started ends with an event: error frame whose error.code is stream_interrupted.

Limits

Same as chat completions: 1 MiB request bodies, 240 seconds overall (10 minutes with the web_search tool), a stream that sends nothing for 30 seconds is ended. A non-streamed response may take the whole deadline. Mixed-model sessions (shadow and suggestions) work here as on chat completions: send ib in the body (the SDK's extra_body), and a switch can move the session to any pool model this endpoint serves. While the key is in Suggest mode, thinking blocks from earlier turns are dropped before dispatch, because a model will not accept another provider's signed thinking; the open tool loop keeps them. Provider web search stays on routes verified for it.

Count tokens

POST /v1/messages/count_tokens takes the same model, messages, system, tools, tool_choice and thinking as a message and returns { "input_tokens": … }, as in the Anthropic API. It is free, never billed or rate limited, and limited to models your key may use. When your Directives require zero data retention or no training (requireZdr or requireNoTraining), the count is an estimate made here (it runs high), so the content never leaves for a provider.