Developer documentation
Pay for AI model requests one at a time
Send a text, image, or speech request, approve a clear spending limit, pay in USDC, and receive a durable receipt.
Page tools
Onchain Router gives you one provider-neutral interface for text generation, image generation, text to speech, and speech to text. You approve a request-specific spending limit in your wallet and receive the result only after the result, final charge, and receipt are safely stored.
Choose your path
- Choose a capability: compare all five paid AI endpoints and four free discovery endpoints.
- Make your first request: follow the step-by-step guide with a dedicated wallet that holds only a small amount of USDC.
- Connect an autonomous agent: install the portable Agent Skill and set a hard spending limit in atomic USDC units.
- Connect a backend service: start with the generated guide for Chat Completions, Messages, Image Generations, Text to Speech, or Speech to Text.
What stays familiar
Text requests use the familiar model, messages, max_tokens, and stream fields. Image requests use model, prompt, n, image_size, aspect_ratio, and response_format; 1K and 1:1 are the defaults, and the selected model must advertise the requested values. Text to speech uses JSON with model, input, voice, and response_format. Speech to text accepts one bounded MP3 either as standard multipart form data or as canonical Base64 JSON for agents that cannot construct file uploads. Choose an available capability, endpoint, and model from GET /v1/models; choose a public voice alias from GET /v1/audio/voices.
What x402 adds
The first unpaid request returns Hypertext Transfer Protocol (HTTP) status 402 with the payment network, asset, recipient, expiry time, and maximum amount. An official x402 buyer signs the authorization locally and retries the identical request. After success, inspect the PAYMENT-RESPONSE header, the X-Receipt-ID header, and the receipt link.
You do not need an API subscription, and Onchain Router never stores your wallet key. Never send a private key, model-provider key, or custom provider address in the request body.
