dispatch
Send a text chat request through the dispatch gateway: it applies your policy, runs the best eligible model, and returns the completion, usage and the full dispatch_receipt (chosen model, reason, cost, savings, attempts) — the same as POST /v1/chat/completions with a dispatch object. This makes a REAL model call billed to your own provider keys stored for your org (POST /dispatch/keys), and the spend is recorded against your org. Requires your service API key on the MCP connection (x-api-key or Authorization: Bearer); the operator key and anonymous callers get dispatch_requires_api_key, and the local STDIO server refuses with dispatch_requires_hosted_mcp. Pass prompt (with optional system) or messages, not both. Text-only, single-choice, non-streaming; no tools/functions. Refusals carry the same error codes as HTTP. Calls can take a while with failover: bound them with dispatch.failover.timeout_ms and dispatch.failover.max_attempts, and set LLM_PRICING_MCP_TIMEOUT_MS=120000 when using the npx bridge.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stop | No | Stop sequence or list of stop sequences | |
| model | No | Requested model name (default 'auto'); the policy decides what runs | |
| top_p | No | Nucleus sampling | |
| prompt | No | The user prompt (use this or messages, not both) | |
| system | No | Optional system prompt, only with prompt | |
| dispatch | No | Dispatch policy — the same object as the HTTP `dispatch` body field (OpenAI SDK extra_body={'dispatch': {...}}). Omit for the balanced objective with failover on. | |
| messages | No | OpenAI-style chat messages (use this or prompt, not both) | |
| max_tokens | No | Max completion tokens (server default when omitted) | |
| temperature | No | Sampling temperature |