Check the exact terms
Network, asset, recipient, amount, request identity, and model must match local policy before a wallet signs.
One provider-neutral API for text, images, and speech. Pay per request with USDC through x402, enforce budgets locally, and keep a verified receipt for every completed payment.
103 reviewed models across 4 live capabilities. Use a familiar request format and choose an explicit model.
Explore all endpoints ↗/v1/chat/completions
Chat, vision, tools, and structured output in OpenAI or Anthropic request shapes.
/v1/images/generations
Generate a 1K image and receive a hosted URL or Base64 delivery.
/v1/audio/speech
Generate hosted MP3 audio using one of 20 curated public voice aliases.
/v1/audio/transcriptions
Transcribe one bounded MP3 through JSON or multipart input.
Built for accountable automation
Requests are validated before work begins, an ambiguous outcome never creates a blind retry, and a successful result waits for durable settlement evidence.
Network, asset, recipient, amount, request identity, and model must match local policy before a wallet signs.
Unknown provider or settlement outcomes stop for review and retain the original request identity.
The API releases a completed response only after the result, settlement, and receipt are durable.
The local proxy can reuse an eligible text response without creating a new payment or receipt.
Use the public API directly, install a client from npm, or connect through an agent-native adapter. Each guide explains setup, payments, and recovery.
You already have an x402 buyer
Send familiar JSON to one HTTPS origin. Bring an official x402 client that supports exact EIP-3009 Base USDC payments.
You are building a Node.js application
Typed discovery and paid calls over the Buyer Runtime, with one recovery and receipt contract for every capability.
You work in a terminal
Create and unlock a dedicated wallet, set budgets, make requests, recover outcomes, and inspect receipts.
Your agent uses native tools
Nine focused tools for discovery, generation, wallet status, and receipts. Local stdio, with human-owned wallet setup.
Your app accepts an OpenAI base URL
A protected loopback adapter handles payments locally and caches eligible identical text responses for ten minutes.
Your coding agent follows reusable instructions
Discovery, payment, and recovery guidance over the installed Buyer CLI. The agent never receives your wallet key.
You use OpenClaw agents
A native provider, live policy-filtered models, bounded media tools, and same-key retry protection through the local proxy.
You use Hermes Agent
A native model provider, media tools, in-session discovery, diagnostics, and deliberate recovery commands.
The TypeScript SDK, CLI, MCP server, local proxy, Buyer Runtime, and routing package are MIT-licensed npm releases. Pin @onchainrouter packages to 0.2.0. Automatic model routing remains experimental; wallet policy stays human-owned.
Public npm stable 0.2.0 · requires human setup and an unlocked Buyer Runtime.
npm install @onchainrouter/client@0.2.0
import { OnchainRouterBuyer } from '@onchainrouter/client';
const requestKey = process.env.REQUEST_ID;
if (!requestKey) throw new Error('Set a persisted REQUEST_ID');
const buyer = await OnchainRouterBuyer.connect();
try {
const result = await buyer.chat({
"model": "gemini-3.6-flash",
"messages": [
{
"role": "user",
"content": "Explain x402 in one sentence."
}
],
"max_tokens": 128,
"stream": false
}, requestKey);
if (!result.ok) throw new Error(`${result.outcome}: ${result.message}`);
console.log(result.body);
console.log(result.receipt.id, result.payment.actualAtomic);
} finally {
buyer.close();
}Public npm stable 0.2.0 · setup, unlock, and policy changes stay human-only.
npm install --global @onchainrouter/cli@0.2.0
onchain-router setup
onchain-router policy show
onchain-router unlock
onchain-router modelsPublic npm stable 0.2.0 · prints a local stdio configuration without exposing wallet secrets.
npm install --global @onchainrouter/mcp@0.2.0
onchain-router-mcp --print-configPublic API · this plain request inspects the unpaid challenge and does not sign or spend USDC.
request_key="$(node -p 'require("node:crypto").randomUUID()')"
curl -i https://onchainrouter.dev/v1/chat/completions \
-H 'content-type: application/json' \
-H "x-idempotency-key: $request_key" \
--data '{"model":"gemini-3.6-flash","messages":[{"role":"user","content":"Explain x402 in one sentence."}],"max_tokens":128,"stream":false}'No subscription plans. Choose a model and pay per request in USDC. The live HTTP 402 response supplies the exact amount before you authorize payment.
Launch promotion: 0% service markup. A 0.001000 USDC successful-call fee and a 0.001000 USDC minimum usage charge still apply.
| Capability | Example model | Published rate (USDC) |
|---|---|---|
| Text & reasoning | gemini-3.6-flash | $1.5 input · $7.5 output per 1M tokens |
| Image generation | gemini-3.1-flash-lite-image | 1K (default) $0.035000 |
| Text to speech | elevenlabs/flash-v2.5 | $0.05 per 1K characters |
| Speech to text | elevenlabs/scribe-v2 | $0.22 per audio hour |
Inspect the MIT-licensed clients that manage local budgets, payments, agent integrations, and receipts. Provider credentials and the server gateway stay private.
Review payment, recovery, and availability before an agent sends a paid request.
No. The Buyer Runtime keeps wallet material locally and exposes only the bounded actions required for an approved request.
The request stops for recovery or review. Onchain Router does not automatically repeat an ambiguous provider or settlement outcome.
Yes. The catalog publishes rate information, while the live 402 response gives the exact terms for the request being authorized.
Use the catalog and model discovery endpoint as the source of truth for released text, image, and speech capabilities.
Start with the Buyer CLI, or bring an official x402 buyer to the public API.
