# XFuel Chat Completions

> XFuel Chat Completions is a paid API for AI agents from api.xfuel.app, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-18).

OpenAI-compatible chat completions endpoint that charges $0.01 USDC per call via x402 protocol on Base or Solana mainnet and returns a signed receipt with a verify URL

## Facts

- Endpoint: POST https://api.xfuel.app/v1/chat/completions?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-18
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/xfuel-chat-completions-3d4ba92c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_ejDl8_dXB11sVe19hn5ve

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 xfuel-chat-completions-3d4ba92c -d '<json body>'
```

Example prompt: Using XFuel, send a chat message to the xfuel/auto model asking it to summarize the benefits of proof-of-work blockchains in 3 bullet points, with a max of 200 tokens and temperature 0.7 — and pay the $0.01 USDC fee from my Base wallet.

## When to prefer this

Choose XFuel when you need OpenAI-compatible chat completions billed via real USDC micropayments on Base or Solana — ideal for AI agents that manage their own crypto wallets and need verifiable, on-chain proof of inference spend. Prefer this over traditional API-key-based LLM providers when your architecture requires trustless, pay-per-call settlement or when you need a signed receipt for auditability. Not suited for high-volume batch inference where per-call transaction costs would be prohibitive.

## Known failure modes

- Insufficient USDC balance or failed x402 payment results in 402 Payment Required
- Invalid or unsupported model ID returns a 400 or 404 error
- Malformed messages array (missing role or content) causes a 422 validation error
- Network congestion on Base or Solana may delay payment settlement and cause timeouts
- Temperature out of range (below 0 or above 2) causes a validation error
- Stream flag incompatibility with client setup may cause dropped or malformed streaming response

## How this service works

Signed spend receipts for agent x402 payments — who paid which call, verifiable by a third party. Treasury desk and possession book for agent spend — export, policy, evidence. POST /v1/chat/completions is the x402 USDC door on Base and Solana. Returns signed receipt + public verify_url. Paying this host is real mainnet USDC.

## Output

Returns an OpenAI-compatible chat completion response (choices, usage, model info) plus a signed payment receipt and a verify_url that can be used to confirm the on-chain USDC transaction on Base or Solana mainnet.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "model": {
   "type": "string",
   "description": "Model id from GET /v1/models; xfuel/auto routes automatically"
  },
  "stream": {
   "type": "boolean"
  },
  "messages": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "role",
     "content"
    ],
    "properties": {
     "role": {
      "enum": [
       "system",
       "user",
       "assistant"
      ],
      "type": "string"
     },
     "content": {
      "type": "string"
     }
    }
   },
   "description": "OpenAI-style chat messages array"
  },
  "max_tokens": {
   "type": "integer",
   "description": "Output token budget"
  },
  "temperature": {
   "type": "number",
   "maximum": 2,
   "minimum": 0
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "id": "chatcmpl-abc123",
  "model": "xfuel/auto",
  "usage": {
   "total_tokens": 15,
   "prompt_tokens": 10,
   "completion_tokens": 5
  },
  "xfuel": {
   "verify_url": "https://api.xfuel.app/receipt/xfuel-abc123"
  },
  "object": "chat.completion",
  "choices": [
   {
    "index": 0,
    "message": {
     "role": "assistant",
     "content": "Hello!"
    },
    "finish_reason": "stop"
   }
  ],
  "created": 1700000000
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/xfuel-chat-completions-3d4ba92c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.xfuel.app](https://www.zero.xyz/host/api.xfuel.app/llms.txt)
