83trust / 100

Chat Completions

by Chit402 in AI models & inference

x402 APIPassing, checked 2 h ago

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.

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

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
261 ms typical, 261 ms slowest 5%
Last check
2 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -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"}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.03:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fapi.xfuel.app%2Fv1%2Fchat%2Fcompletions
const res = await pay("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"}),
});
console.log(await res.json());

Example input

{
  "max_tokens": 500,
  "messages": [
    {
      "content": "Hello",
      "role": "user"
    }
  ],
  "model": "xfuel/auto"
}

Example output

{
  "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.chit402.com/receipt/chit-abc123"
  }
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
2 h agoPassed402261 ms$0.002