x402_infer
Run one inference paid PER CALL in Bitcoin BSV via x402, no prepaid channel. Non-custodial, two steps: (1) call without payment to get the 402 quote (status payment_required, accepts[]); nothing is spent. (2) Build and sign a BSV payment for that quote in your own wallet (for example fetchWithX402 / buildPayment in @bsvkey/x402-bsv-client) and call again with the same prompt, model, maxTokens and webSearch plus payment = the base64 X-PAYMENT value. Returns the completion plus the on-chain settlement txid. This server never takes a private key: a wif argument is refused. On failure returns isError "error: (): ". Codes: key_refused (a private key was sent; it was not used or forwarded); payment_failed (402: the payment did not settle; nothing is spent); invalid_request (400: unknown model or bad input; nothing is spent); upstream_failed (502: the payment SETTLED but the model provider then failed; the text includes the settlement txid. There is no automatic refund: contact embryospace@gmail.com with that txid).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Model id or policy: auto|cheapest|best, claude-*, grok-*. | grok-4.3 |
| prompt | Yes | The user prompt. | |
| system | No | Optional system prompt. | |
| payment | No | The base64 X-PAYMENT header value your wallet signed for the quote from step 1. Omit to get the quote. | |
| maxTokens | No | Max output tokens. | |
| webSearch | No | Let the model search the live web (adds a per-search fee to the quote). |