@circuit-llm/x402
v0.2.4
Published
Circuit SDK payment spine — pay any x402 endpoint in CIRC (client) + verify on-chain CIRC payments (server). Zero runtime dependencies.
Downloads
192
Readme
@circuit-llm/x402
The payment spine of the Circuit network: pay any x402-gated endpoint in CIRC (client) and verify on-chain CIRC payments (server). Zero runtime dependencies.
Part of the Circuit SDK — every paid call in the ecosystem (inference, data) runs on this. Full guide →
Install
npm install @circuit-llm/x402Pay (client)
import { X402Client } from '@circuit-llm/x402';
const client = new X402Client({ wallet }); // wallet: a PaymentWallet — see @circuit-llm/wallet
const res = await client.fetch('https://gateway.circuitllm.xyz/v1/chat/completions', {
method: 'POST',
body: JSON.stringify({ messages: [{ role: 'user', content: 'hi' }] }),
});
// On HTTP 402 it reads the CIRC price, pays on-chain, and retries with the tx signature — transparently.Verify (server)
import { verifyPaymentTx } from '@circuit-llm/x402';
const ok = await verifyPaymentTx(signature, { expectRaw, recipient, rpcUrl });Built-in spend caps (maxSpendRaw, maxTotalSpendRaw), replay protection, and a CIRC/USD oracle. CIRC is a Token-2022 mint (8fQ…pump, 6 decimals).
