OpenAI compatible API. Attested gateway. Public status.

x402 Stablecoin Funding For Agents

Let agents add TrustedRouter prepaid credits with Stripe x402 while prompt traffic stays inside the attested API gateway.

Verify gateway
1 URLbase_url migration
100smodels and routes
0prompt logs by default

x402 stablecoin funding

API-key required

x402 is a funding rail for prepaid credits. It does not run inside the enclave and it does not carry prompts. Agents use a normal TrustedRouter API key, add credits with stablecoin when needed, then retry the same attested API call.

curl https://trustedrouter.com/v1/billing/x402/fund \
  -H "Authorization: Bearer $TRUSTEDROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount":"10.00"}'

The response is HTTP 402 Payment Required and includes a payment-required header for x402-capable clients.

Settle after payment

idempotent
curl https://trustedrouter.com/v1/billing/x402/settle \
  -H "Authorization: Bearer $TRUSTEDROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"payment_intent_id":"pi_..."}'

Stripe webhooks also settle the same payment. If the webhook wins the race, the settle call returns the current state without double-crediting.

Boundary

control plane only
  • x402 endpoints require a sk-tr-... key.
  • Workspace is derived from the key, never from request body input.
  • Stripe metadata contains billing ids and amounts only.
  • Prompt and output content stay out of Stripe, Sentry, logs, and billing records.
  • The enclave still authorizes only when prepaid credits are available.

Agent retry loop

recommended
1. Call /v1/chat/completions or /v1/responses.
2. If TrustedRouter returns insufficient credits, call https://trustedrouter.com/v1/billing/x402/fund.
3. Pay using the payment-required header.
4. Poll https://trustedrouter.com/v1/billing/x402/settle with backoff: 5s, 10s, 20s, 30s, then every 60s.
5. Retry the original attested inference call after credits land.

Sign in

Choose a sign in method.