Chat completions with x402 payment
chat_completionsGenerate text by sending a chat completion request to any supported model. Pay per use with Solana USDC via x402, choosing auto, eco, or premium routing or a specific model.
Instructions
Send a chat completion request to any supported model. Paid tool: x402 payment (Solana USDC) is required — the first call returns 402 with the exact price; retry with _meta["x402/payment"]. Responses are non-streaming. Provide either mode (auto/eco/premium routing) or model (explicit id, mutually exclusive with mode); one of the two is required — if both are sent, model wins. mode values: auto = cheapest model fitting the context, eco = cheapest available, premium = best model. max_tokens defaults to 4096 and is clamped to the model's max output. Use this tool to generate text; to inspect models and prices first, use 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 |