C

Chit402 · Chat Completions

by Chit402

POSTBaseSolana

$0.002

per call · USD Coin on Base

Treasury desk and possession book for agent spend. Who paid which call — 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.

Endpoint

POST https://api.xfuel.app/v1/chat/completions

74

Calls / 30d

9

Unique payers / 30d

Sep 9

Last called

exact

Payment scheme

Call this service

TypeScript · @x402/fetch
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPay = wrapFetchWithPayment(fetch, account);

const res = await fetchWithPay("https://api.xfuel.app/v1/chat/completions", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "max_tokens": 500,
    "messages": [
      {
        "content": "Hello",
        "role": "user"
      }
    ],
    "model": "xfuel/auto"
  }),
});
const data = await res.json();
cURL
curl -X POST \
  "https://api.xfuel.app/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -d '{"max_tokens":500,"messages":[{"content":"Hello","role":"user"}],"model":"xfuel/auto"}' \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

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

Payment details

Pay to0x23f713411c30bbd9a989c9cbc22eb0b55f7f7334
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase, Solana
Schemesexact

Is this your API?

Pin it to the top of AI & Inference and the homepage with a featured placement.

Get featured →

More from Chit402 & similar services