API

Prepaid keys

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

Preview specification. The API opens at launch; this page describes the interface it will serve.

Endpoints

  • POST /v1/keys with { "amount_usd": 5 }: an x402 deposit that returns a new key
  • POST /v1/keys/topup: an x402 deposit plus Bearer, which adds balance
  • GET /v1/keys/me: balance, totals and recent usage
  • DELETE /v1/keys/me: revoke the key and refund whatever is left

The dashboard manages the same keys from the wallet that funded them. Connect that wallet and every key it owns is listed, each with top up and close.

Mint from the dashboard

The dashboard runs the deposit in your browser wallet: it fetches the terms, you approve one payment for exactly the amount you entered, and the key appears. Keys are held in your browser only; the lane stores a hash.

Mint from a terminal

Any x402 v2 client can mint. With the reference packages it looks like this:

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

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

const res = await pay("https://inferlane.xyz/v1/keys", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({ amount_usd: 5 }),
});
console.log(await res.json()); // { key: "il_sk_...", balance_usd: 5 }
The key is returned once. The lane keeps only a hash, so a lost key cannot be recovered; close it from the dashboard and the balance returns to the funding wallet.

Inspect a key

curl
curl https://inferlane.xyz/v1/keys/me -H "Authorization: Bearer $INFERLANE_KEY"