Your first x402 answer

Quickstart in 5 minutes

Inspect the offer for free, then pay for an answer from your own wallet. Allow extra time if you need to fund a wallet.

Pick your surface

  • API key

    OpenAI/Anthropic SDK, Claude Code or MCP: developer guide.

  • x402 with your own wallet

    Follow the four steps below.

  • Free try

    Use free/deepseek-v4.1-flash on the same endpoint: no wallet, 20 answers/day per network (IPv4 /24, IPv6 /64).

Step 1: see the 402 (free)

Send this unpaid request. Expect HTTP/2 402 and a PAYMENT-REQUIRED header containing base64 JSON.

Verified in the historical checks listed below: unpaid-curl.

curl -i https://ask.singitai.app/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{"model":"deepseek-v4.1-flash","max_tokens":200,"messages":[{"role":"user","content":"Say hello in five words."}]}'

Decode the header with Node:

Verified in the historical checks listed below: decode-offers.

curl -s -o /dev/null -D - https://ask.singitai.app/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{"model":"deepseek-v4.1-flash","max_tokens":200,"messages":[{"role":"user","content":"Say hello in five words."}]}' \
  | awk 'tolower($1)=="payment-required:"{print $2}' | tr -d '\r' \
  | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>{const r=JSON.parse(Buffer.from(s.trim(),"base64"));
      console.log("x402Version", r.x402Version);
      for (const a of r.accepts) console.log(a.scheme.padEnd(6), a.network.padEnd(40), a.amount, "atomic USDC")})'

Expected offer order: upto Base, upto Solana, exact Base, exact Solana. x402Version is 2. The Base upto offer for this request is 1500 atomic USDC (0.0015 USDC). Other amounts come from the current offer.

HTTP/2 402
payment-required: <base64 JSON>

x402Version 2
upto   Base     1500 atomic USDC
upto   Solana   <amount from offer>
exact  Base     <amount from offer>
exact  Solana   <amount from offer>

Live 31.10.2026: the 402 body also carries x402Version and accepts, matching the decoded header. upto authorizes a ceiling and settles actual usage; exact pays a flat price.

Step 2: put USDC on Base

You need Node 20+, a wallet private key you control for the agent, and a small USDC balance on the Base network. No ETH is needed for this upto path: the facilitator pays the gas through Permit2/EIP-2612 gas sponsoring.

Withdraw USDC to Base from an exchange that supports Base withdrawals, or bridge USDC to Base. Check the destination network before sending. Use a fresh wallet with a small balance for agents; keep its private key out of source files and logs.

At the 0.0015 USDC minimum ceiling, one USDC covers hundreds of short answers on cheap models: floor(1 / 0.0015) = 666 calls at that ceiling. Longer answers or other models can require more; read each offer.

Step 4: read the result

A successful paid answer returns HTTP 200. Read choices[0].message.content for the answer and billing.totalAtomic for the settled amount in USDC micro-units. For upto, it is at most the ceiling you signed.

PAYMENT-RESPONSE is base64 JSON describing the facilitator settlement (transaction, network, payer). X-SingIt-Receipt is JSON with SingIt’s reference, transaction, network, payer and amount charged.

If you get 402 again

CauseWhat to do
No signature sent / client did not retryUse a payment-aware client and retry the same request with PAYMENT-SIGNATURE.
Wrong network or assetSelect the network and USDC asset in the offer. For Variant A, fund USDC on Base.
USDC balance below the ceilingEnsure the wallet can cover the full amount in the offer, even if actual settlement may be lower.
409 payment_duplicate: signature already usedSign a fresh one; do not replay the used signature.
stale_payment_permit: stale permitFetch a new 402 and sign the fresh offer.
Settlement failed: 402 with only error + code, no PAYMENT-REQUIRED headerThe body is {"error":"payment_required","code":"payment_required"}. No answer came back. Whether the payment settled was not confirmed, so check your wallet's USDC balance and recent Base transactions before you sign again, then retry with a fresh signature.
Ceiling below the priceRead amount in the offer; raise --max-amount / maxPerCall to cover it.

Variant B: Coinbase Bazaar MCP

Free discovery checked; paid step not run

What was run on 31.10.2026 (Prague): Free steps against https://api.cdp.coinbase.com/platform/v2/x402/discovery/mcp (no auth): initialize OK (server x402-discovery 1.0.0); tools/list shows proxy_tool_call, search_resources, validate_endpoint. search_resources with curatedOnly:false and query "SingIt Ask chat completions" returns SingIt's chat route tools whose names start with x402_post_https___ask_singitai_app_v1_chat_completions_; per-model routes also appear. Always use a fresh search result, never a hard-coded full name. validate_endpoint for POST https://ask.singitai.app/v1/chat/completions returned active:true, indexed:true, hasBazaarExtension:true, 402 with 4 accepts, x402 version 2.

With @coinbase/cdp-sdk 1.60.0 the documented install line was not enough: @x402/extensions and @x402/svm (its peer dependencies) must be installed too, otherwise import { CdpX402Client } from "@coinbase/cdp-sdk/x402" fails with ERR_MODULE_NOT_FOUND. With them all four imports resolve and the free search runs.

Not run: creating the CDP wallet, funding it, or proxy_tool_call (the paid step). These need a Coinbase CDP account, and a funded wallet.

Install dependencies (the two peer dependencies are required for the CDP x402 import):

Verified in the historical checks listed below: install-b.

npm install @coinbase/cdp-sdk @modelcontextprotocol/sdk @x402/core @x402/evm @x402/mcp @x402/extensions @x402/svm

The complete CDP wallet example is in the first paid call guide.

Variant C: Coinbase agentic wallet CLI

Free CLI checks completed; paid step not run

What was run on 31.10.2026 (Prague): npx [email protected] --version returned 2.12.1 (Node 24.22.1). npx [email protected] x402 details https://ask.singitai.app/v1/chat/completions works with no login and prints the 402 requirements. It auto-detects the method and takes no -X/-d options: passing them gives error: unknown option '-X'. npx [email protected] x402 bazaar search "SingIt Ask" works with no login and lists SingIt's chat route (price 0.0015 USDC, Base, upto). npx [email protected] status needs an authenticated wallet and prints the auth login instructions. x402 pay has -X/--method, -d/--data, --max-amount, --scheme as documented.

Not run: auth login/verify, balance, or x402 pay (the paid step). These need an email login to a Coinbase agentic wallet and USDC on Base. Needs Node 24+.

Verified in the historical checks listed below: cli-free.

npx [email protected] --version
npx [email protected] x402 details https://ask.singitai.app/v1/chat/completions
npx [email protected] x402 bazaar search "SingIt Ask"

Paid command template — not run; requires login and USDC on Base:

npx [email protected] x402 pay https://ask.singitai.app/v1/chat/completions -X POST \
  -d '{"model":"deepseek-v4.1-flash","max_tokens":200,"messages":[{"role":"user","content":"Say hello in five words."}]}' \
  --max-amount 2000

--max-amount uses USDC micro-units: 2000 = 0.002 USDC, above this request’s 0.0015 ceiling. See the full guide.