ModelBeatbeta

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.

POST
/chat/completions

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
AuthorizationBearer <token>

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

Request 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

curl -X POST "https://example.com/chat/completions" \  -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": {      "provider": "string",      "model": "string",      "key": "string",      "resolved_key_alias": {        "model_id": "string",        "model_name": "string",        "model_family": "string"      },      "is_fallback": true,      "primary_provider": "string",      "primary_model": "string"    },    "latency": 0,    "chunk_index": 0  }}