Chat completions with x402 payment
chat_completionsSend 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…
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. Start with a FREE model (no payment at all) and keep max_tokens >= 200 — a thinking model spends part of that budget on reasoning, so a smaller limit can return an empty answer.
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. | |
| tools | No | OpenAI-style tool schemas the model may call. Forwarded unchanged; they count as input tokens for the price (§4.2/§5.3). | |
| messages | Yes | Chat messages (text content only). An assistant turn that calls a tool may carry content: null with tool_calls. | |
| max_tokens | No | Max output tokens (billed upfront, §4.2). MCP calls are non-stream: cap per config. Use >= 200 — reasoning models share this budget with their thinking and a smaller limit can return an empty answer. | |
| tool_choice | No | OpenAI tool_choice: 'auto', 'none', 'required', or {type: function, function: {name}}. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | ||
| model | No | ||
| usage | No | ||
| object | No | ||
| choices | No | ||
| created | No |