infer
Run one metered inference (OpenAI-compatible), paid per token in Bitcoin BSV from your prepaid channel. Returns the completion plus a receipt: satoshis charged, model routed to, remaining balance, and the broker-signed usage receipt. Needs a funded channel key: send the HTTP header "Authorization: Bearer channelId:channelSecret" with the MCP request, or pass apiKey. Thinking models (claude-sonnet-5, claude-opus-5, claude-opus-5-5, claude-fable-5-1) bill their hidden reasoning as output, and maxTokens is raised to at least 1024 for them. On failure the tool returns isError with text "error: (): ". Codes: no_channel_key (no Authorization header and no apiKey); invalid_channel (401: channel not found, bad secret, or closed; open a new one); insufficient_balance (402: the channel cannot cover the worst case for this call; the text includes requiredSats and balanceSats; top up at the website, or lower maxTokens / turn off webSearch); invalid_request (400: unknown model or policy, a model whose provider is not enabled, or a malformed prompt; call list_models); upstream_failed (502: the model provider failed; nothing is charged, retry or pick another model). Nothing is charged on any error. This server does not verify its own receipt: check usageReceipt offline with @bsvkey/x402-bsv-client (verifyReceipt, verifyCharge, verifyMeter) against the key at /v1/receipt-key.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Model id or policy: auto|cheapest|best, claude-*, grok-*. | auto |
| apiKey | No | channelId:channelSecret for a funded channel. Omit to use the Authorization header (preferred). | |
| prompt | Yes | The user prompt. | |
| system | No | Optional system prompt. | |
| maxTokens | No | Max output tokens. | |
| webSearch | No | Let the model search the live web (adds a per-search fee). |