heroes · gedx402

Unified run

Frontier chat via Workers AI unified catalog on gateway.gedx402.com — OpenAI chat/completions or POST /v1/unified/run; per-model x402 wire (e.g. gpt-4o-mini ~$0.08 worst-case, not max-across-allowlist).

$0.08 wire settlement

POST https://gateway.gedx402.com/v1/chat/completions

@x402/fetch (TypeScript)

standard x402 client — fund USDC on Base, set PRIVATE_KEY. integrator quickstart

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const signer = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const client = new x402Client();
client.register("eip155:*", new ExactEvmScheme(signer));
const fetchWithPayment = wrapFetchWithPayment(fetch, client);

const res = await fetchWithPayment("https://gateway.gedx402.com/v1/chat/completions", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    model: "openai/gpt-4o-mini",
    messages: [
      {
        role: "user",
        content: "Say hi."
      }
    ],
    max_tokens: 128
  }),
});
const data = await res.json();

awal (agent convenience)

Coinbase Agentic Wallet CLI — no private key in code. external payer guide

npx awal@2.12.0 x402 pay \
  --url https://gateway.gedx402.com/v1/chat/completions \
  --method POST \
  --body '{"model":"openai/gpt-4o-mini","messages":[{"role":"user","content":"Say hi."}],"max_tokens":128}'

curl (discovery)

unauthenticated POST returns 402 + payment-required — inspect pricing before paying.

curl -X POST https://gateway.gedx402.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-4o-mini","messages":[{"role":"user","content":"Say hi."}],"max_tokens":128}'