Onchain Router · Chat Completions

by Onchain Router

POSTBase

$0.002

per call · USD Coin on Base

Request-priced LLM inference · 0% service fee launch promotion

Endpoint

POST https://onchainrouter.dev/v1/chat/completions

5

Calls / 30d

1

Unique payers / 30d

Sep 7

Last called

exact

Payment scheme

Call this service

TypeScript · @x402/fetch
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPay = wrapFetchWithPayment(fetch, account);

const res = await fetchWithPay("https://onchainrouter.dev/v1/chat/completions", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "max_tokens": 512,
    "messages": [
      {
        "content": "Hello",
        "role": "user"
      }
    ],
    "model": "gemini-3.6-flash",
    "stream": false
  }),
});
const data = await res.json();
cURL
curl -X POST \
  "https://onchainrouter.dev/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -d '{"max_tokens":512,"messages":[{"content":"Hello","role":"user"}],"model":"gemini-3.6-flash","stream":false}' \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

{
  "choices": [],
  "id": "chatcmpl_example",
  "model": "gemini-3.6-flash",
  "object": "chat.completion",
  "usage": {
    "completion_tokens": 0,
    "prompt_tokens": 0,
    "total_tokens": 0
  }
}

Payment details

Pay to0xa7660dea6aadcc87cbb5e79ccd262d391e61de5d
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase
Schemesexact

Is this your API?

Pin it to the top of AI & Inference and the homepage with a featured placement.

Get featured →

More from Onchain Router & similar services