API

Prepaid keys

A key is minted by an x402 deposit and spends down per call. No login, no account.

Endpoints

Mint from the dashboard

The dashboard runs the whole deposit in your browser wallet: it asks the server for terms, you sign one USDC authorization for exactly the amount you typed, and the key appears. Keys are kept in your browser only.

Mint from a terminal

Any x402 client works. With the official packages:

typescript
import { privateKeyToAccount } from "viem/accounts";
import { x402Client, wrapFetchWithPayment } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm/exact/client";

const account = privateKeyToAccount(process.env.BUYER_PRIVATE_KEY);
const client = x402Client.fromConfig({
  schemes: [{ network: "eip155:5042", client: new ExactEvmScheme(account) }],
});
const pay = wrapFetchWithPayment(fetch, client);

const res = await pay("https://arcrouter.co/v1/keys", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({ amount_usd: 5 }),
});
console.log(await res.json()); // { key: "arc_sk_...", balance_usdc: 5, ... }
The full key is returned exactly once. ArcRouter stores only its hash and cannot show it again.

Inspect a key

curl
curl https://arcrouter.co/v1/keys/me -H "Authorization: Bearer $ARCROUTER_KEY"
response
{
  "key_prefix": "arc_sk_Ab12...",
  "owner": "0x1234...",
  "balance_usdc": 4.2187,
  "deposited_usdc": 5,
  "spent_usdc": 0.7813,
  "totals": { "requests": 412, "prompt_tokens": 803112, "completion_tokens": 240877, "cache_hits": 96 },
  "usage_daily": [{ "day": "2026-09-21", "requests": 38, "tokens": 91220, "charge_usdc": 0.0641 }],
  "recent_usage": [{ "at": "...", "model": "gpt-oss-120b", "prompt_tokens": 1830, "completion_tokens": 412, "charge_usdc": 0.001313, "cached": false }]
}

Close a key

DELETE /v1/keys/me revokes the key immediately and queues the remaining balance as a refund to the wallet that funded it.