Chat completions with x402 payment
chat_completionsSend chat completion requests to any supported model to generate text, choosing an explicit model or routing mode. Free models and paid trials are available; paid requests need x402 Solana USDC payment.
Instructions
Send a chat completion request to any supported model. Free models are served without payment; the first calls to a PAID model are also free per client (free trials), after which x402 payment (Solana USDC) is required — an unpaid call returns 402 with the exact price; retry with _meta["x402/payment"]. Responses are non-streaming. Pass either mode (auto/eco/premium) or model (explicit id) — one of the two is required; model wins if both are sent. Use this tool to generate text; inspect models and prices first with the free list_models tool.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Smart routing profile (auto/eco/premium). | |
| model | No | Explicit model id (see list_models / /v1/models). Mutually exclusive with mode. | |
| messages | Yes | Chat messages (text content only). | |
| max_tokens | No | Max output tokens (billed upfront, §4.2). MCP calls are non-stream: cap per config. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | ||
| model | No | ||
| usage | No | ||
| object | No | ||
| choices | No | ||
| created | No |