# Inferit for agents

> Inferit is the inference layer for AI agents: one integration to access models and pay per inference request. Developers who run open-weight models connect them and earn from the requests they serve. Your agent buys per request, without an API key from every lab. Name a model and Inferit picks its cheapest healthy seller, or send `"model": "auto"` and it picks the model too, and charges the exact price. Pay per request with x402 v2 (no account, no API key) or spend a prepaid balance with a key.

**Network.** Whitechain Sepolia, chain id 1874. Prices settle in ITC, free from Inferit's faucet. When `GET https://api-production-c74b9.up.railway.app/v1/rails` lists a `stellar` rail, x402 payments also work on Stellar, in ITC: https://inferit.cc/docs/payments/stellar.md. Contracts and security: https://inferit.cc/docs/security-trust.md and https://inferit.cc/security.

**Units.** API amounts are integers in millionths of a dollar, paid as millionths of an ITC. So `"10000"` = $0.01 (0.01 ITC). JSON carries amounts as decimal strings (`"10000"`).

## In one minute

1. Claim free ITC: `POST https://api-production-c74b9.up.railway.app/v1/faucet` with `{"address":"0x..."}`. It needs no gas.
2. Call `POST https://api-production-c74b9.up.railway.app/v1/chat/completions` with `"model": "auto"` and no key, as the code below does. You get `402 Payment Required` with a quote of at least $0.01 (`amount` ≥ `"10000"`).
3. Sign the quote with a standard x402 v2 client and resend the same body. The official `@x402/fetch` works once ITC is allowed in its spend controls (one `setSpendControls` line, below). Sign with a plain key (EOA): smart-wallet signatures (ERC-1271, ERC-6492) are not accepted.
4. You get the answer. `x-inferit-model` names the model that served it. The request is charged its exact cost; the rest of the payment stays your balance.

## Two ways to pay

With an API key, each request is charged to your prepaid balance: no quote, no payment step (only a `402 insufficient_funds` when the balance or the ceiling is too low, or `402 spend_limit_exceeded` when the key is at its limit). Without a key, you get a 402 quote and pay for that one request with x402.

| | x402 (no account) | API key |
| --- | --- | --- |
| Setup | None: any EVM key, even one with zero WBT | Sign in with the wallet (an off-chain signature), mint a key |
| Per request | One x402 payment of at least $0.01, credited to your balance | Nothing extra: the request spends your balance |
| Charged | The exact cost of the request | The exact cost of the request |
| Header | `PAYMENT-SIGNATURE` (answering the 402) | `Authorization: Bearer ik_...` |

## Let Inferit pick the model

Send `"model": "auto"` and Inferit picks the model. Among the models that have a healthy seller right now, it keeps the ones that fit the request (context window, tools, images, and any price or quality limit you set), scores each on a published quality ranking against its price for this exact request, and sends the request to the best value, at that model's cheapest healthy seller. If that seller fails before it sends a byte, the request moves to the next seller, then to the next model. The router chooses from the request's size and features, never from what the prompt says.

| `model` | Policy | What it picks |
| --- | --- | --- |
| `auto` (also `auto:balanced`, `inferit/auto`) | best value | Quality weighed against this request's price: a model that costs twice as much must score 6 points higher to win |
| `auto:cheap` (also `inferit/auto:cheap`) | lowest price | The lowest price for this request among the candidates; quality breaks ties |
| `auto:best` (also `inferit/auto:best`) | highest ranked | The highest quality score among the candidates; price breaks ties |

Any other id that starts with `auto:` or `inferit/auto` answers `400 invalid_auto_policy`.

Optional hints, as body fields or as headers (for clients that cannot add body fields). If both are sent, the stricter value wins:

| Body field | Header | Range | Meaning |
| --- | --- | --- | --- |
| `max_price_per_m` | `x-inferit-max-price-per-m` | integer millionths of a dollar per 1M tokens, 1 to 10^12 | Skip any offer whose all-in price, blended on this request's estimated token mix, is above it. Auto and named models |
| `min_context` | `x-inferit-min-context` | integer tokens, 1 to 100,000,000 | Only models whose context window is at least this. Auto only |
| `min_quality` | `x-inferit-min-quality` | integer, 0 to 100 | Only models whose quality score is at least this. Auto only |

Hints never reach a seller. `min_context` or `min_quality` with a named model answers `400 invalid_request`.

Every served response says what happened:

- `x-inferit-model`: the catalog id of the model that served the request (the JSON `model` field says the same; in a stream, trust the header).
- `x-inferit-route`: `direct` for a named model, or `auto:balanced`, `auto:cheap`, `auto:best`.
- `x-inferit-auto-choice` (auto only): `1` when auto's top choice served it, `2` or more when failover moved it to another model.

With x402, the 402 quote is priced for the model auto picks, and the 402 carries `x-inferit-model` and `x-inferit-route`; the paid retry tries that model first. `GET https://api-production-c74b9.up.railway.app/v1/routing` returns the policies, the hints, the quality ranking (its sources and date) and the models auto can choose from now. When no model fits, the API answers `503 no_eligible_model`, and `error.reasons` counts why; without a key, that 503 comes before any 402, so nothing is paid. Naming a model with a live offer (a `best_price` in `GET https://api-production-c74b9.up.railway.app/v1/models`) still works then. The whole rule is at https://inferit.cc/docs/routing.md.

## Where to go

| What | Where |
| --- | --- |
| API base (OpenAI-compatible; a `GET` on it returns a JSON index) | `https://api-production-c74b9.up.railway.app/v1` |
| Chat completions (streaming supported; send `"model": "auto"` or name a model) | `POST https://api-production-c74b9.up.railway.app/v1/chat/completions` |
| How model auto chooses, and what it can choose from now | `GET https://api-production-c74b9.up.railway.app/v1/routing` |
| x402 discovery | `GET https://api-production-c74b9.up.railway.app/.well-known/x402` |
| Inferit's ITC faucet | `POST https://api-production-c74b9.up.railway.app/v1/faucet` |
| Inferit's ITC faucet on Stellar, while `GET /v1/rails` lists a `stellar` rail (a G… account with a trustline to ITC) | `POST https://api-production-c74b9.up.railway.app/v1/faucet/stellar` |
| Models, list prices and the lowest live all-in price (the three auto rows first) | `GET https://api-production-c74b9.up.railway.app/v1/models` |
| One model's order book (price levels, with offer and healthy-offer counts) | `GET https://api-production-c74b9.up.railway.app/api/markets/<url-encoded model id>` |
| One model's offers: all-in price, context, quantization, health, 24 h uptime and time to first token | `GET https://api-production-c74b9.up.railway.app/v1/models/<url-encoded model id>/endpoints` |
| This guide | https://inferit.cc/agents.md (also served at https://inferit.app/agents.md) |
| The same guide for people | https://inferit.cc/agents |
| Every page of the site as markdown | https://inferit.cc/llms.txt (index), https://inferit.cc/llms-full.txt (full text) |
| Full API reference | https://inferit.cc/docs/api-reference.md |
| Automatic model routing | https://inferit.cc/docs/routing.md |
| Pay with x402 on Stellar: the network, the asset and its contract, the trustline, the faucet, the client code, the limits | https://inferit.cc/docs/payments/stellar.md |
| Selling inference, including the API-only path | https://inferit.cc/docs/sellers.md |
| Selling from your own computer (the open-source seller app, one command) | https://inferit.cc/docs/sellers/quickstart.md |
| List an open-weight model you run that is not in the catalog, then offer it at your own price (seller session or seller API key) | `POST https://api-production-c74b9.up.railway.app/v1/seller/models` (https://inferit.cc/docs/api-reference.md#seller) |
| Frameworks: LangChain, Vercel AI SDK, LiteLLM, CrewAI, OpenCode | https://inferit.cc/docs/guides/langchain.md, https://inferit.cc/docs/guides/vercel-ai-sdk.md, https://inferit.cc/docs/guides/litellm.md, https://inferit.cc/docs/guides/crewai.md, https://inferit.cc/docs/guides/opencode.md |
| The app, for people with a browser wallet | https://inferit.app |
| Inferit's public repositories: the seller app, the x402 facilitator, examples, the model catalog (the market's code is private) | https://github.com/InferitAI |

## Two tokens, two jobs

- **ITC** is what you pay for inference with: one ITC per dollar of price. It has 6 decimals, so one base unit is a millionth of a dollar (0.000001 ITC). Inferit's ITC faucet mints 1,000 ITC per address, once per 24 h, at no charge. It is sponsored: the claim needs no gas.
- **WBT** is Whitechain's native gas token. You need it only for on-chain transactions you send yourself: a deposit, a seller registration, a withdrawal. An agent that pays with x402 sends none, so it needs no WBT until it withdraws.
- The API accepts EIP-3009 payments in ITC only.

## Prices in US dollars

- API amounts are integers in millionths of a dollar, paid as millionths of an ITC.
- API prices are per 1M tokens, input and output, all-in: the seller's price plus the 5% marketplace commission. `"84000"` per 1M = $0.084 per 1M tokens.
- `GET /v1/models` lists the three auto rows first (`owned_by: "inferit"`), then the models with a live offer, then the rest of the open-weight catalog, including list-price-only rows (`best_price: null`). Each live model's `live.max_context_tokens` is the largest context a healthy seller serves now. Closed models (`open_weight: false`, `servable: false`) are reference rows that no seller can list on Inferit: they are left out unless you pass `?include=reference`, and a request for one answers `404 model_not_servable`. A row with a `best_price` has a live offer.
- `GET /v1/models` carries each price twice. `pricing.prompt` and `pricing.completion` are decimal strings in dollars (paid in ITC) per token (`"0.0000001"`), as OpenRouter writes them; `input_per_m`, `output_per_m` and `cache_read_per_m` are integer millionths of a dollar per 1M tokens (`"100000"`). `pricing` is the list price, `best_price` the lowest live all-in price from a healthy seller (or `null`), and `best_price.discount_pct` compares that all-in price with list.
- What a request costs, at the serving seller's own price (before the fee): `sellerCost = ceil((uncachedIn × inputPerM + cachedIn × cacheReadPerM + out × outputPerM) / 1000000)`, then `fee = ceil(sellerCost × feeBps / 10000)`; you pay `sellerCost + fee`. Example: a seller asking `80000` / `160000` ($0.08 / $0.16) per 1M tokens before the fee: 1,000 input and 500 output tokens cost `160` + `8` = `168` millionths of a dollar ($0.000168).
- The `x-inferit-buyer-cost-micro` response header is the authoritative cost of each request.

## Pay per request with x402: a prepaid meter

x402 amounts are in token base units, so x402 can express a millionth of a dollar. But every x402 payment is an on-chain transaction, and each one costs gas. So Inferit works as a prepaid meter:

1. Call `POST https://api-production-c74b9.up.railway.app/v1/chat/completions` with no `Authorization` header (the code below sends `"model": "auto"`; any model with a live offer works the same way). It answers `402 Payment Required`. The `PAYMENT-REQUIRED` header is base64 JSON, and the body carries the same document: x402 v2, scheme `exact`, network `eip155:1874`, asset = ITC, `payTo` = the `MarketEscrow` contract (not Inferit), `maxTimeoutSeconds` 120 and `extra` = the token's EIP-712 name and version.
2. The amount is the worst-case cost of this exact request body at the top-ranked offer (with model auto: the top-ranked offer of the model auto picks, named in the 402's `x-inferit-model` header): the input estimate plus the output limit, all-in, and never less than $0.01 (0.01 ITC). The output limit is `min(max_tokens, max_completion_tokens, context_length)`, or 1,024 tokens when you send neither (times `n` when you ask for several choices); `context_length` is the model's, from `GET /v1/models`. The quote is pinned for 120 s.
3. Sign an EIP-3009 `TransferWithAuthorization` for that amount to the escrow, and resend the same body with the `PAYMENT-SIGNATURE` header. `X-PAYMENT`, the v1 name, is still accepted.
4. Inferit's facilitator verifies the payment and settles it first: it calls `depositWithAuthorization` on the escrow and pays the gas. The payment is credited to your own escrow balance.
5. The request is served (streaming included) and charged its exact cost against that balance. The response carries `PAYMENT-RESPONSE` (base64: the deposit transaction, the network and the payer) and `x-inferit-buyer-cost-micro`.
6. What the request does not use stays your escrow balance. Every call without a key gets its own 402 and its own payment. To spend the balance without paying again, sign in with the same wallet and use an API key (below), or withdraw it.

Settlement to sellers is batched on chain: one transaction pays for many requests.

### TypeScript, with the official x402 fetch client

A brand-new key with zero WBT works: the agent never sends a transaction itself.

```ts
// npm i @x402/fetch @x402/evm viem    then: npx tsx agent.mts    (Node 18+, @x402 2.28 or newer)
import { decodePaymentResponseHeader, wrapFetchWithPayment, x402Client } from '@x402/fetch';
import { ExactEvmScheme } from '@x402/evm/exact/client';
import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts';

const API = 'https://api-production-c74b9.up.railway.app';
// A brand-new key works: the agent never sends a transaction itself.
const account = privateKeyToAccount((process.env.AGENT_KEY as `0x${string}` | undefined) ?? generatePrivateKey());

// 1. Inferit's faucet gives this address 1,000 free ITC (the claim costs nothing).
const faucet = await fetch(`${API}/v1/faucet`, {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({ address: account.address }),
});
console.log('faucet', faucet.status, await faucet.text());

// 2. The standard x402 v2 client. It only pays in tokens it was told about, so allow ITC in its spend
//    controls, and cap one payment at 1 ITC (1000000 base units, 6 decimals), whatever the server quotes.
const ITC = { network: 'eip155:1874', asset: '0x2E672dFE33EA977FD064E01aDe7d8c73B3Be7fBB' } as const;
const client = new x402Client()
  .register('eip155:*', new ExactEvmScheme(account))
  .setSpendControls({ allowedAssets: [{ ...ITC, maxAmountPerPayment: '1000000' }] });
const fetchWithPayment = wrapFetchWithPayment(fetch, client);

// 3. Call the API with no key: 402 -> sign -> paid retry, all inside fetchWithPayment.
const res = await fetchWithPayment(`${API}/v1/chat/completions`, {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({
    model: 'auto',
    messages: [{ role: 'user', content: 'Say hello in five words.' }],
    max_tokens: 64, // the quote is the worst case for this body, so a small max_tokens keeps it small
  }),
});
const body = await res.json();
console.log(res.status, body.choices?.[0]?.message?.content ?? body);

// Which model answered (with model auto, Inferit picked it), and the payment receipt: the deposit transaction and who paid.
console.log('model', res.headers.get('x-inferit-model'));
const receipt = res.headers.get('PAYMENT-RESPONSE');
if (receipt) console.log(decodePaymentResponseHeader(receipt));
console.log('cost', res.headers.get('x-inferit-buyer-cost-micro'), 'millionths of a dollar; the rest stays in your balance');
```

The `setSpendControls` line is configuration of the standard client, not a patch: the client only pays in tokens it knows, and ITC is not on its built-in list. Its `maxAmountPerPayment` (`"1000000"`, 1 ITC) is the client's maximum per payment: a setting in your client, not a rule the contract enforces.

### Python, the v2 exchange by hand

No x402 package: `eth-account` signs the EIP-3009 authorization, so every field is visible.

```python
# pip install "eth-account>=0.13" requests
import base64, json, os, time
import requests
from eth_account import Account
from eth_account.messages import encode_typed_data

API = "https://api-production-c74b9.up.railway.app"
acct = Account.from_key(os.environ["AGENT_KEY"]) if "AGENT_KEY" in os.environ else Account.create()
b64 = lambda o: base64.b64encode(json.dumps(o).encode()).decode()
unb64 = lambda s: json.loads(base64.b64decode(s))

requests.post(f"{API}/v1/faucet", json={"address": acct.address})  # free ITC, once per 24 h

body = {"model": "auto", "messages": [{"role": "user", "content": "Say hello in five words."}], "max_tokens": 64}
r = requests.post(f"{API}/v1/chat/completions", json=body)
assert r.status_code == 402, r.text
required = unb64(r.headers["PAYMENT-REQUIRED"])
req = required["accepts"][0]                      # scheme "exact", network "eip155:<chainId>"
assert (req["network"], req["asset"].lower()) == ("eip155:1874", "0x2e672dfe33ea977fd064e01ade7d8c73b3be7fbb"), req  # ITC only
assert int(req["amount"]) <= 1_000_000, req       # never sign more than 1 ITC for one request

nonce = os.urandom(32)                             # random bytes32, never reused
auth = {"from": acct.address, "to": req["payTo"], "value": req["amount"], "validAfter": "0",
        "validBefore": str(int(time.time()) + req["maxTimeoutSeconds"]), "nonce": "0x" + nonce.hex()}
typed = {
    "types": {
        "EIP712Domain": [{"name": "name", "type": "string"}, {"name": "version", "type": "string"},
                         {"name": "chainId", "type": "uint256"}, {"name": "verifyingContract", "type": "address"}],
        "TransferWithAuthorization": [{"name": "from", "type": "address"}, {"name": "to", "type": "address"},
            {"name": "value", "type": "uint256"}, {"name": "validAfter", "type": "uint256"},
            {"name": "validBefore", "type": "uint256"}, {"name": "nonce", "type": "bytes32"}],
    },
    "primaryType": "TransferWithAuthorization",
    "domain": {"name": req["extra"]["name"], "version": req["extra"]["version"],
               "chainId": int(req["network"].split(":")[1]), "verifyingContract": req["asset"]},
    "message": {**auth, "value": int(auth["value"]), "validAfter": 0, "validBefore": int(auth["validBefore"]), "nonce": nonce},
}
sig = Account.sign_message(encode_typed_data(full_message=typed), acct.key).signature
payment = {"x402Version": 2, "resource": required.get("resource"), "accepted": req,
           "payload": {"authorization": auth, "signature": "0x" + bytes(sig).hex()}}

r = requests.post(f"{API}/v1/chat/completions", json=body, headers={"PAYMENT-SIGNATURE": b64(payment)})  # same body
print(r.status_code, r.headers.get("x-inferit-model"), r.json()["choices"][0]["message"]["content"])  # the model that answered
print(unb64(r.headers["PAYMENT-RESPONSE"]))
```

### curl: see the 402 without paying

```sh
curl -sS -D - https://api-production-c74b9.up.railway.app/v1/chat/completions \
  -H 'content-type: application/json' \
  -d '{"model":"auto","messages":[{"role":"user","content":"Hi"}],"max_tokens":64}'
# HTTP/2 402
# payment-required: eyJ4NDAyVmVyc2lvbiI6Mi...   (base64 JSON; the body carries the same document)

curl -s https://api-production-c74b9.up.railway.app/.well-known/x402 | jq     # scheme, network, asset, payTo, extra (EIP-712 name and version)
```

### Which model and seller answered?

Every served response names them, before you read a byte of the body:

- `x-inferit-model`: the catalog id of the model that served the request. With model auto, the model Inferit picked.
- `x-inferit-route`: `direct` (you named the model) or `auto:balanced`, `auto:cheap`, `auto:best`.
- `x-inferit-offer`: an opaque id of the offer that served you, not the seller's identity.
- `x-inferit-buyer-cost-micro`: what the request cost you, in millionths of a dollar.

What you can check before you pay:

- `GET https://api-production-c74b9.up.railway.app/v1/routing`: the models auto can choose from now (`candidates_now`, in auto's order, with their quality scores).
- `GET https://api-production-c74b9.up.railway.app/v1/models`: each model's `best_price` (all-in, per 1M tokens) and its `discount_pct` under the list price, and `live`: healthy and listed sellers, 24 h uptime (0 to 1) and time to first token (p50, p95, in ms), `null` where there is no data yet.
- `GET https://api-production-c74b9.up.railway.app/v1/models/<url-encoded model id>/endpoints`: each offer of one model, with its seller's wallet shortened (`0x45A9…7CDE`), all-in price, context length, quantization, health, 24 h uptime and time to first token.
- `GET https://api-production-c74b9.up.railway.app/api/markets/<url-encoded model id>`: each price level carries `offers` and `healthyOffers`. No healthy offer means no seller is serving that model right now (a request naming it answers 503 `no_available_offers`).

## Pay on Stellar

While `GET https://api-production-c74b9.up.railway.app/v1/rails` lists a rail with `"id": "stellar"`, the same 402 also lists a Stellar entry, network `stellar:testnet`: one transfer of ITC to Inferit's treasury account, signed with a Stellar key. Inferit's facilitator pays the network fee, so the payment costs the agent no XLM.

1. Create the account with free XLM from friendbot (`https://friendbot.stellar.org?addr=G...`), then add a trustline to ITC. Its code and issuer are in `GET https://api-production-c74b9.up.railway.app/v1/rails`, the rail with `"id": "stellar"`, with its Stellar Asset Contract (`assetContract`, the x402 `asset`) and the treasury (`treasury`, the x402 `payTo`).
2. Claim ITC: `POST https://api-production-c74b9.up.railway.app/v1/faucet/stellar` with `{"address":"G..."}`, once per address per 24 h.
3. Register the official Stellar scheme in the x402 client: `ExactStellarScheme` from `@x402/stellar` 2.28.0, with `createEd25519Signer(secret, "stellar:testnet")`, and allow ITC's contract in its spend controls.
4. ITC on Stellar has 7 decimals: the amount is 10 base units per millionth of a dollar (`"100000"` = $0.01), and must be paid exactly.
5. The payment is credited to your balance with Inferit (base units divided by 10, rounded down), and the request is charged its exact cost against it, never more than that payment. A call without a key never draws on what earlier payments left; an API key does: sign in with the same Stellar key (`POST https://api-production-c74b9.up.railway.app/v1/auth/stellar/challenge`, then `/verify` with the message signed as a SEP-53 message) and make a key with `POST https://api-production-c74b9.up.railway.app/v1/keys`. Inferit holds that balance: at most $25 per address (a payment that would pass it is refused with `invalid_exact_stellar_balance_over_limit`), and at most $5 per payment.

Stellar addresses are case-sensitive: never lower-case one. The code: https://inferit.cc/docs/payments/stellar.md

## Or use an API key

The same wallet signs in with an off-chain text signature (EIP-4361; it moves no tokens), then mints a key. The key spends your escrow balance: what x402 payments credited, or what you deposited yourself with `depositAndSetCap` (that deposit is a transaction you send, so it needs WBT).

1. `POST https://api-production-c74b9.up.railway.app/v1/auth/evm/challenge` with `{"address":"0x..."}` returns `{"message","nonce","expiresAt"}`.
2. Sign `message` (EIP-191 `personal_sign`), then `POST https://api-production-c74b9.up.railway.app/v1/auth/evm/verify` with `{"message","signature"}`. It returns a session token.
3. `POST https://api-production-c74b9.up.railway.app/v1/keys` with `Authorization: Bearer <session token>` and `{"name":"my-agent"}` returns `{"key":"ik_..."}`, shown once. Optional fields: `spendLimitMicro`, `minDiscountPct`.
4. Call the API with `Authorization: Bearer ik_...`.

```ts
// Same wallet as the x402 payer: sign in (EIP-4361, an off-chain text signature; it moves no tokens) and mint an API key.
const post = (path: string, body: unknown, token?: string) =>
  fetch(`https://api-production-c74b9.up.railway.app${path}`, {
    method: 'POST',
    headers: { 'content-type': 'application/json', ...(token ? { authorization: `Bearer ${token}` } : {}) },
    body: JSON.stringify(body),
  }).then((r) => r.json());

const { message } = await post('/v1/auth/evm/challenge', { address: account.address });
const { token } = await post('/v1/auth/evm/verify', { message, signature: await account.signMessage({ message }) });
const { key } = await post('/v1/keys', { name: 'agent' }, token);   // shown once; ik_…
// From here on: Authorization: Bearer <key>, spending what is left of your balance. No payment step.
```

```sh
curl https://api-production-c74b9.up.railway.app/v1/chat/completions \
  -H "Authorization: Bearer $INFERIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "stream": true,
    "messages": [{"role": "user", "content": "Say hello in five words."}]
  }'
```

Every OpenAI-compatible client works with the base URL `https://api-production-c74b9.up.railway.app/v1`. To require a minimum discount against the list price, call `/min{N}/v1/chat/completions` or send `x-min-discount: N`.

## Inferit's ITC faucet

```sh
curl -s -X POST https://api-production-c74b9.up.railway.app/v1/faucet -H 'content-type: application/json' -d '{"address":"0xYourAddress"}'
```

- It mints 1,000 ITC to the address, at most once per 24 h per address (the token enforces it), and at most 10 calls an hour per IP. The server also caps sponsored mints at 120 an hour in total (`429 rate_limit_exceeded`).
- Inferit pays the gas, so a fresh address with zero WBT can claim and then pay with x402.
- It is Inferit's ITC faucet, not a WBT faucet.
- `503 faucet_pending` (with `retry-after: 15`): the mint was sent but is not confirmed yet. Check the balance before you claim again: a claim after it lands gets `429 faucet_cooldown`.

A successful claim returns:

```json
{
  "address": "0xYourAddress",
  "amountMicro": "1000000000",
  "token": { "address": "0x2E672dFE33EA977FD064E01aDe7d8c73B3Be7fBB", "symbol": "ITC", "decimals": 6 },
  "network": "eip155:1874",
  "transaction": "0x…",
  "explorerUrl": "https://explorer.testnet.whitechain.io/tx/0x…",
  "next": "Pay for inference with x402: POST https://api-production-c74b9.up.railway.app/v1/chat/completions without credentials …"
}
```

## Discovery

`GET https://api-production-c74b9.up.railway.app/.well-known/x402` lists the paid resources and the requirement a client signs for: scheme, network, asset, `payTo`, the token's EIP-712 name and version, and the minimum payment. Pin the network and the asset in your own code rather than trusting the server that is being paid. The values:

| Field | Value |
| --- | --- |
| Network | Whitechain Sepolia, chain id 1874 (`eip155:1874`) |
| Asset (ITC, 6 decimals; TestCredit contract rev. 2) | `0x2E672dFE33EA977FD064E01aDe7d8c73B3Be7fBB` |
| `extra` (the token's EIP-712 domain) | `name` (the token's EIP-712 name: sign with the exact string `extra.name` carries), `version: "1"` (the domain version, not the contract revision) |
| `payTo` (MarketEscrow v0.3) | `0x705dD9eCffa888FbcF2849eAE2D3b136eb78B7e0` |
| Minimum amount | `"10000"` ($0.01 = 0.01 ITC) |
| Explorer | https://explorer.testnet.whitechain.io |

## Limits

| What | Default | Why |
| --- | --- | --- |
| Minimum payment | $0.01 (0.01 ITC) | Each payment is an on-chain deposit whose gas the facilitator pays. x402 itself could express a millionth of a dollar; the request is still charged its exact cost |
| Signature validity | 120 s (`maxTimeoutSeconds`) | The client sets `validBefore` = now + this; the API refuses authorizations close to expiry |
| Quote pin | 120 s, per request (path, routing headers and JSON body) | The paid retry verifies against the quote it was shown; a changed request gets a new 402 |
| Signer | A plain key (EOA), 65-byte signature, x402 version 2 | Smart-wallet signatures (ERC-1271, ERC-6492) and the Permit2 transfer method are not accepted |
| One payment per authorization | Each nonce is accepted once | A replayed payment is refused |
| General rate limit | 1,200 requests a minute per IP (hosted default) | Every route; `429 rate_limit_exceeded` with `retry-after`. Responses carry no RateLimit headers |
| Sign-in | 30 requests a minute per IP | `/v1/auth/*` |
| x402 payments | 30 paid attempts a minute per paying address, 60 per IP | On top of the general limit |
| ITC faucet | 1,000 ITC per address per 24 h, 10 calls an hour per IP, 120 sponsored mints an hour per server | Keeps the sponsored gas budget bounded |
| Credit expiry | Each x402 credit extends your cap's expiry to at least 30 days from the payment | What you pay through x402 stays spendable |
| Escrow paused | No new payments | Pausing blocks deposits, including x402; withdrawals keep working |

If inference fails after the payment settled, the payment stays in your escrow balance and the error says so.

## Errors

Errors are OpenAI-shaped: `{"error":{"message","type","code"}}`.

| Status | Code | Meaning |
| --- | --- | --- |
| 402 | (the x402 challenge) | No credentials: the body is the x402 `PaymentRequired` document |
| 402 | (a refused payment) | The payment did not verify; the reason is in `error` |
| 400 | `invalid_request` | The body does not parse or a field is invalid (a hint included); the message names it. Its `type` is `invalid_request_error` |
| 400 | `invalid_auto_policy` | A model id that starts with `auto:` or `inferit/auto` but names no policy: use `auto`, `auto:cheap` or `auto:best` |
| 400 | `invalid_address` | `POST /v1/faucet` (or sign-in) with an address that is not 0x-prefixed 20-byte hex |
| 401 | `missing_credentials`, `invalid_api_key` | An account route without a token, or a key that is wrong or revoked. Inference without any key answers 402 instead |
| 402 | `insufficient_funds` | An API-key request costs more than your balance or ceiling allows, or the ceiling has expired |
| 402 | `spend_limit_exceeded` | The API key has reached its own spend limit |
| 404 | `model_not_found` | The model is neither in the catalog nor listed by a seller (`GET /v1/models` lists both), or send model auto |
| 404 | `model_not_servable` | A closed model: a reference row (`servable: false`) that no seller can list |
| 404 | `faucet_disabled` | This server runs no sponsored faucet |
| 429 | `rate_limit_exceeded` | Too many requests from this IP or paying address, or the faucet's hourly server budget is spent; honour `retry-after` |
| 429 | `faucet_cooldown` | This address claimed less than 24 h ago; `retry-after` says when the next claim works |
| 501 | `not_implemented` | `/anthropic/v1/messages` and legacy `/v1/completions`; use `/v1/chat/completions` |
| 503 | `no_available_offers` | No healthy seller for that model right now (with auto: every attempt failed before any byte); honour `retry-after` |
| 503 | `no_eligible_model` | Model auto: no model can serve this request right now. The message says why, and `error.reasons` counts each reason; `retry-after` only when seller health is the only cause |
| 503 | `rail_unavailable` | The chain could not be read to check your funding (or, on seller routes, your registration). Nothing was charged; honour `retry-after` (5 s). Without `retry-after`, your selected rail is not enabled here: pick another with `PUT /v1/buyer/rail` |
| 503 | `funding_busy` | A settlement landed while your funding was being read. Nothing was charged; retry after 1 s (`retry-after: 1`) |
| 503 | `faucet_unavailable` | The faucet cannot mint right now; retry after 60 s |
| 503 | `faucet_pending` | The mint was sent but is not confirmed yet; check the balance after `retry-after` (15 s) before claiming again |
| 503 | `x402_settlement_pending`, `x402_unavailable` | The payment path failed; the error says whether anything was charged |

Every response carries `x-request-id` and `x-inferit-network`.

## Who runs what

- Inferit's API settles x402 payments with its own x402 v2 facilitator on Whitechain Sepolia, self-hosted and operated by Inferit (key `0xc8c8E79E2547ba1D81FAC12c84867B1DbD83e602`): the party that sells the request also submits the payment. Its key pays gas only, and it can credit a payment only to the wallet that signed it.
- The seller that serves a request sees it. The API stores token counts and amounts, never prompts or responses.
- whitechain-x402-facilitator, the first public x402 v2 facilitator for Whitechain, is a separate open-source project (Apache-2.0) for other Whitechain merchants, live on Whitechain Sepolia: https://github.com/InferitAI/whitechain-x402-facilitator. Inferit operates a public instance of it; it does not settle Inferit's own payments.

---

Canonical page: https://inferit.cc/agents
All pages as markdown: https://inferit.cc/llms.txt
