# x402inference

> OpenAI-compatible inference gateway paid in USDC on Base via x402's
> `batch-settlement` scheme. No account, no wallet whitelist, no signed
> auth headers.

Open an on-chain escrow channel with one deposit, then make metered
inference calls against it — pay only for what you actually use. Unclaimed
balance is recoverable at any time via a timed withdrawal — this is escrow,
not custody.

## Endpoints

### `POST /accountless/chat/completions`

OpenAI-compatible chat completions body (`{ model, messages, ... }`).
The first unpaid request returns HTTP 402 with a `PAYMENT-REQUIRED` header
describing a `batch-settlement` offer (network, asset, receiving address,
per-request ceiling). An x402-aware client library signs a channel deposit
and retries the same request with a `Payment-Signature` header. The real
per-token cost of the call comes back on the `X-Request-Cost-Atomic`
response header — the voucher authorizes spend up to a ceiling, but you're
only ever charged the real, metered cost.

### `GET /accountless/models`

Public, no payment required. Lists the models this gateway will accept,
each with the real per-token price you'll be charged (markup included):

```json
{
  "object": "list",
  "data": [
    {
      "id": "openai/gpt-4o-mini",
      "object": "model",
      "provider": "openrouter",
      "pricing": {
        "prompt_usd_per_token": "0.000000157",
        "completion_usd_per_token": "0.00000063"
      }
    }
  ]
}
```

Models come from more than one upstream provider, so send `id` exactly as
listed here. Where two providers serve the same model id, the listed id is
qualified (`nanogpt:anthropic/claude-sonnet-5`) — that form pins the
provider, and prices differ between them.

### `GET /healthz`

Liveness check.

### `GET /openapi.json`

Machine-readable OpenAPI 3.1 contract for the endpoints above — the
canonical discovery document per the [x402scan discovery
spec](https://x402scan.com/discovery/spec), including per-route pricing
(`x-payment-info`) and input schemas.

## Notes for agents

- No signup, no API key, no wallet whitelist — payment authorization is the
  only credential.
- This file is the reference: https://x402inference.com/ hands visitors a prompt for
  their own coding agent rather than hand-maintained code samples, so treat
  this document as the source of truth for building an integration.
- Payment scheme docs (external, maintained by x402):
  https://docs.x402.org/schemes/batch-settlement
- `x402inference.com` is the only deployment; there is no sandbox/testnet
  endpoint documented for public use.
