# x402 LLM Gateway

> x402 LLM Gateway is a paid API for AI agents from x402.alexk.is, paid per call via x402, $0.01/call, status unknown (last checked 2026-10-18).

OpenAI-compatible chat completions endpoint that charges $0.01 USDC per call via the x402 on-chain micropayment protocol on Base.

## Facts

- Endpoint: GET https://x402.alexk.is/v1/chat/completions?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-18
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-llm-gateway-4dc14c37
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Gc2sqOksm3b73nhqLnwa8

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402-llm-gateway-4dc14c37
```

Example prompt: Ask the LLM gateway to continue this conversation — messages so far are [{"role":"user","content":"Explain quantum entanglement in one paragraph"}] — using default model settings and pay the $0.01 USDC fee automatically.

## When to prefer this

Choose this endpoint when you need OpenAI-compatible chat completions with true pay-per-call billing in USDC on Base — ideal for autonomous agents, low-volume workloads, or crypto-native apps that want no subscription commitment and on-chain auditability of each inference cost. Prefer it over standard OpenAI or Anthropic APIs when your agent already handles x402 payment flows or when you need stablecoin-denominated AI spend.

## Known failure modes

- HTTP 402 returned if no payment signature is included — client must sign a USDC transfer and retry with PAYMENT-SIGNATURE header
- Payment signature invalid or USDC balance insufficient — transaction rejected by facilitator
- Model ID not found — returns error if unsupported model is specified
- Malformed messages array — missing required 'role' or 'content' fields causes 400 error
- Rate limit or upstream LLM unavailability — gateway may return 503 or timeout

## How this service works

OpenAI-compatible chat completions, priced per call at $0.01 USDC on Base. Payment uses the x402 protocol: an unpaid request returns HTTP 402 with a PAYMENT-REQUIRED header; the client signs a USDC transfer, retries with a PAYMENT-SIGNATURE header, and the facilitator settles on-chain.

## Output

Returns an OpenAI-format chat completion object containing: a unique completion ID, the model used, a choices array with the assistant's message content, role, and finish reason, plus a Unix timestamp of when the response was created.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "messages"
 ],
 "properties": {
  "model": {
   "type": "string",
   "description": "Model id. Omit to use the default."
  },
  "messages": {
   "type": "array",
   "description": "Conversation so far, oldest first."
  },
  "max_tokens": {
   "type": "integer"
  },
  "temperature": {
   "type": "number"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "id": {
   "type": "string"
  },
  "model": {
   "type": "string"
  },
  "object": {
   "type": "string"
  },
  "choices": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "index": {
      "type": "integer"
     },
     "message": {
      "type": "object",
      "properties": {
       "role": {
        "type": "string"
       },
       "content": {
        "type": "string"
       }
      }
     },
     "finish_reason": {
      "type": "string"
     }
    }
   }
  },
  "created": {
   "type": "integer"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-llm-gateway-4dc14c37/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.alexk.is](https://www.zero.xyz/host/x402.alexk.is/llms.txt)
