Onchain Router Get started

Give agents model access. Keep control of every dollar.

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.

A small wallet paying USDC on Base to route one request across a broad network of AI models before receiving a durable receipt.
Base mainnetUSDC paymentsx402 v2MIT clients0% service fee promotion

One API across four kinds of work.

103 reviewed models across 4 live capabilities. Use a familiar request format and choose an explicit model.

Explore all endpoints ↗

Built for accountable automation

Financial infrastructure built for control and recovery

Requests are validated before work begins, an ambiguous outcome never creates a blind retry, and a successful result waits for durable settlement evidence.

01

Check the exact terms

Network, asset, recipient, amount, request identity, and model must match local policy before a wallet signs.

02

Keep ambiguity visible

Unknown provider or settlement outcomes stop for review and retain the original request identity.

03

Release after durability

The API releases a completed response only after the result, settlement, and receipt are durable.

04

Reuse a verified response

The local proxy can reuse an eligible text response without creating a new payment or receipt.

Meet agents where they already work.

Use the public API directly, install a client from npm, or connect through an agent-native adapter. Each guide explains setup, payments, and recovery.

Public API

You already have an x402 buyer

Direct API

Send familiar JSON to one HTTPS origin. Bring an official x402 client that supports exact EIP-3009 Base USDC payments.

npm stable · 0.2.0

You are building a Node.js application

TypeScript SDK

Typed discovery and paid calls over the Buyer Runtime, with one recovery and receipt contract for every capability.

npm stable · 0.2.0

You work in a terminal

Buyer CLI

Create and unlock a dedicated wallet, set budgets, make requests, recover outcomes, and inspect receipts.

npm stable · 0.2.0

Your agent uses native tools

MCP

Nine focused tools for discovery, generation, wallet status, and receipts. Local stdio, with human-owned wallet setup.

npm stable · 0.2.0

Your app accepts an OpenAI base URL

Local OpenAI proxy

A protected loopback adapter handles payments locally and caches eligible identical text responses for ten minutes.

MIT source · stable 0.2.0

Your coding agent follows reusable instructions

Agent Skill

Discovery, payment, and recovery guidance over the installed Buyer CLI. The agent never receives your wallet key.

GitHub stable · 0.2.1

You use OpenClaw agents

OpenClaw

A native provider, live policy-filtered models, bounded media tools, and same-key retry protection through the local proxy.

GitHub stable · 0.2.0

You use Hermes Agent

Hermes Agent

A native model provider, media tools, in-session discovery, diagnostics, and deliberate recovery commands.

Model access built for accountable teams

103reviewed models4live capabilities5paid AI endpoints6public npm packages

Start with familiar tools.

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 models

Public 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-config

Public 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}'

Know the price before you sign.

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.

Example catalog rates — one model per capability, not the total request price
CapabilityExample modelPublished rate (USDC)
Text & reasoninggemini-3.6-flash$1.5 input · $7.5 output per 1M tokens
Image generationgemini-3.1-flash-lite-image1K (default) $0.035000
Text to speechelevenlabs/flash-v2.5$0.05 per 1K characters
Speech to textelevenlabs/scribe-v2$0.22 per audio hour

Open where trust matters.

Inspect the MIT-licensed clients that manage local budgets, payments, agent integrations, and receipts. Provider credentials and the server gateway stay private.

Your questions answered

Review payment, recovery, and availability before an agent sends a paid request.

Does the agent receive a wallet key?

No. The Buyer Runtime keeps wallet material locally and exposes only the bounded actions required for an approved request.

What happens when a payment or provider outcome is unclear?

The request stops for recovery or review. Onchain Router does not automatically repeat an ambiguous provider or settlement outcome.

Can I inspect prices before a request is signed?

Yes. The catalog publishes rate information, while the live 402 response gives the exact terms for the request being authorized.

Which model capabilities are live?

Use the catalog and model discovery endpoint as the source of truth for released text, image, and speech capabilities.

Ready to give agents controlled model access?

Start with the Buyer CLI, or bring an official x402 buyer to the public API.