Create a chat completion
OpenAI-compatible chat completion. ModelBeat reserves a worst-case cost hold before routing, then settles it against realized usage after the provider responds. A `402` means the hold exceeded the available prepaid balance.
OpenAI-compatible chat completion.
ModelBeat reserves a worst-case cost hold before routing, then settles it
against realized usage after the provider responds. A 402 means the hold
exceeded the available prepaid balance.
Authorization
bearerAuth A ModelBeat API key, prefixed mb_live_, sent as Authorization: Bearer <key>.
Keys are issued in the ModelBeat console and are scoped to one tenant. The
example value used throughout this document
(mb_live_EXAMPLE_NOT_A_REAL_KEY_00000000000000000000) is a placeholder and
will not authenticate.
In: header
Header Parameters
Opaque, caller-chosen key that makes a retry safe. The OpenAI SDK — the integration path ModelBeat advertises — retries 5xx and timeouts by default; without this header each retry is a new logical request, i.e. a second reservation and a second charge for one prompt. Send the same key on a retry and ModelBeat returns the original reservation: one hold, one charge.
Reusing a key for a different request body, or one whose reservation was already settled,
is refused with 409. Keys longer than 255 characters are ignored (treated as absent).
length <= 255Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/chat/completions" \ -H "Idempotency-Key: req-8f3a1c00-2b7e-4d9a-9c11-000000000000" \ -H "Content-Type: application/json" \ -d '{ "model": "auto", "messages": [ { "role": "system", "content": "string" } ] }'{ "id": "string", "object": "string", "created": 0, "model": "string", "system_fingerprint": "string", "choices": [ { "index": 0, "finish_reason": "string", "message": {} } ], "usage": { "prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0, "cost": { "input_tokens_cost": 0, "output_tokens_cost": 0, "reasoning_tokens_cost": 0, "citation_tokens_cost": 0, "search_queries_cost": 0, "request_cost": 0, "total_cost": 0 } }, "extra_fields": { "request_type": "string", "routing_info": { "level": "advanced", "is_fallback": true, "tier_escalated": true }, "latency": 0, "chunk_index": 0 }}Create a message (Anthropic shape) POST
Anthropic Messages API-compatible endpoint. Accepts Anthropic's wire format; ModelBeat's own catalog-driven routing still decides which model actually serves the request — sending this shape does not pin you to an Anthropic-served model, and does not require one to exist in the catalog. Prompt-cache tokens (`cache_creation_input_tokens`/`cache_read_input_tokens`) are billed at the regular input rate, not Anthropic's cheaper cache-read rate.
Create a text completion POST
OpenAI-compatible text completion.