Get started
Every AI model, one API.
Every model below its source price, and the cheapest provider wins every request. Pay from one USDF balance with an API key, or per request with no account.
On this page
Get started
Make a first request, with or without an account.
Pay per request
Quote, sign one payment and send the request again.
API reference
Every endpoint with its parameters and samples.
Models and tools
Every model below its source price, and every tool at cost plus 5% at most, on one balance. The cheapest provider wins every request.
Agents
Agents with their own balance, key and spending policy.
Platforms and providers
Sub-keys for platforms, and earning USDF from your own endpoint or machine.
Foundry gives you every AI model through one API, each below its source price, and sends every request to the cheapest provider that meets your rules. You pay from one balance in USDF, the dollar for compute. 1 USDF = $1 of compute, redeemable 1:1 for USDG at any time. Every USDF is backed 1:1 by USDG in a stock contract, and it never expires.
USDF keeps its full 1:1 backing while you use it. Buying deposits USDG into the USDF contract one to one and redeeming returns it, with no fee either way. Spend it on any model or tool, or send it to anyone. People, apps and agents all pay with it, per request. Global Dollar (USDG), issued by Paxos, retains pause and freeze powers over its own token.
| Reason | What it means |
|---|---|
| Zero fee in, zero fee out | Buying deposits USDG into the USDF contract one to one and redeeming returns it. The contract takes no fee, and the gateway pays the gas on gasless USDG deposits and on withdrawals. |
| Still your dollar | Withdraw it, send it to anyone by link or address, or trade it. |
| Earning | USDF earns nothing, plain or held in any other token or vault. |
| Agents hold it | An agent pays per request in USDF with no account and no API key. |
| Backed 1:1, in public | A stock OpenZeppelin contract with no owner. Redemption is permissionless, and the reserve is onchain and published at Transparency. |
| Property | Typical compute credit | USDF |
|---|---|---|
| Cash out | Not redeemable for cash | Redeems 1:1 for USDG at any time |
| Backing | A balance on the platform's books | A full 1:1 USDG reserve, checkable every block |
| Supply | One provider account | Every provider on the network competes for each request |
| Privacy | Set by the platform | Zero retention by default wherever a zero-retention route exists |
| Agents | Need an account and a key | Pay per request with no account |
Network revenue is what the network earns. 60% goes to the Foundry coin's stakers, 30% to buy and burn and 10% to the treasury.
| Source | State | What it is |
|---|---|---|
| Compute | Live | Net revenue from every request Dispatch routes, each below its source price. |
| Tools and services | Live | Tool calls cost plus 5% at most, with no minimum. |
USDF is a dollar for compute on Robinhood Chain. 1 USDF = $1 of compute, redeemable 1:1 for USDG at any time.
The gateway at https:/ serves chat, embeddings, images, speech, transcription, music, rerank and video through one OpenAI-compatible API. Every request is priced in USDF below the model's source price, goes to the cheapest provider that meets your rules, and returns a receipt.
Agents pay per call with no account and no key. Their owners set budgets and limits.
There are two ways to pay. Pay per request needs no account and no key: ask for a quote, sign one payment, send the request again. An account with API keys suits sustained volume, paid from its own Foundry wallet.
Every surface, its address and what it takes:
| Surface | URL | Auth |
|---|---|---|
| Pay per request | https://api.usdf.fi/x402/v1/… | A signed payment per request |
| OpenAI-compatible API | https:/ | API key |
| MCP server | https://api.usdf.fi/mcp | API key, or a payment per call |
| Receipt of any request | https://api.usdf.fi/x402/v1/receipts/{id} | None |
| Agent skill | https://api.usdf.fi/skill.md | None |
| Machine-readable map | https://api.usdf.fi/llms.txt | None |
| Signed model catalog | https://api.usdf.fi/v1/catalog | API key |
The chain and the token:
| Item | Value |
|---|---|
| Chain | Robinhood Chain (eip155:4663) |
| RPC URL | https:/ |
| Explorer | https://robinhoodchain.blockscout.com |
| USDF contract | 0x4A35a5eC2A50A4d2957B2F2366E017f526cAB318 |
| USDG contract | 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168 |
| Decimals | 6 decimals, for both tokens |
| Base unit | 1 unit = $0.000001 |
Samples use deepseek-v4..
You need a wallet on Robinhood Chain that holds USDG or USDF. Need USDF? Buy it on the Buy page, or swap any token for it. Payments cost no gas: the gateway submits every transfer.
- A wallet that holds USDG needs no setup: no approval and no gas.
- A wallet that pays in USDF gives one approval to the signature-transfer contract, once. It is the only transaction you send, and it needs a little ETH on Robinhood Chain for gas. The SDK sends it for you with
approve: true.
1. Pay with the SDK
The TypeScript SDK asks for the quote, signs one payment and sends the request again. As written it pays in USDF, and sends the approval first if your wallet has not given it. Set PAYER_ to the wallet's private key.
Paid request
npm install @usdf/sdk viem
import { USDF } from "@usdf/sdk";
import { createWalletClient, defineChain, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
const robinhood = defineChain({
id: 4663,
name: "Robinhood Chain",
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
rpcUrls: { default: { http: ["https://rpc.mainnet.chain.robinhood.com"] } },
});
const wallet = createWalletClient({
account: privateKeyToAccount(process.env.PAYER_KEY as `0x${string}`),
chain: robinhood,
transport: http(),
});
// Pays in USDF. approve: true sends the one-time approval first if the
// wallet has not given it. A wallet that holds USDG instead needs no setup:
// new USDF({ wallet, asset: "USDG" }).
const usdf = new USDF({ wallet, approve: true });
const result = await usdf.run("gemma-3-4b-it", "Hello", { max_tokens: 100000 });
console.log(result.text);max_ sets the quote: the most the request can cost, with the answer counted at max_. A quote below the network's minimum charge is raised to that minimum and charged in full. At 100,000 the quote clears the minimum, so you are charged what the request uses and the rest comes back to your wallet.
2. Read the answer and its receipt
The answer is a normal chat completion with a receipt. The request is charged what it used, and the rest of the payment goes back to your wallet in the asset you paid with. The receipt shows both.
Response, excerpt
{
"id": "<request_id>",
"choices": [ … ],
"receipt": {
"request_id": "<request_id>",
"paid": { "units": "<units>", "usd": "<usd>", "usdf": "<usdf>" },
"usage_cost": { "units": "<units>", "usd": "<usd>", "usdf": "<usdf>" },
"refund": { … },
"payment": { "tx": "<transaction hash>", "asset": "USDF", "method": "permit2" },
"settlement": { "scheme": "x402 exact", "network": "eip155:4663" }
}
}Without the SDK
Send the request with no credentials, to the same path under /. The gateway answers 402 with the exact amount and the two payments it accepts. An unpaid quote costs nothing.
Request
curl -i https://api.usdf.fi/x402/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "gemma-3-4b-it", "messages": [{"role": "user", "content": "Hello"}], "max_tokens": 100000 }'
Response, trimmed
402 Payment Required payment-required: <base64 JSON: x402Version, resource, accepts> www-authenticate: Payment id="…", method="evm", intent="charge", … { "error": { "message": "payment required", "type": "payment_required", "code": "x402" }, "quote": { "model": "gemma-3-4b-it", "max_tokens": 100000, "price_version": "<price sheet>", "amount": { "units": "<units>", "usd": "<usd>", "usdf": "<usdf>" }, "accepted": [ { "symbol": "USDF", "method": "permit2" }, { "symbol": "USDG", "method": "eip3009" } ] }, "x402": { "x402Version": 2, "accepts": [ … ] } }
Sign one of the accepted payments in code, then send the identical request with it in PAYMENT-SIGNATURE. The signing code is in Pay in USDF and Pay in USDG.
The same request, paid
curl https://api.usdf.fi/x402/v1/chat/completions \ -H "Content-Type: application/json" \ -H "PAYMENT-SIGNATURE: <encoded payment>" \ -d '{ "model": "gemma-3-4b-it", "messages": [{"role": "user", "content": "Hello"}], "max_tokens": 100000 }'
<encoded payment> is the signed payment, base64-encoded JSON.
Use an account and API keys for sustained volume. Each request is checked against your Foundry wallet, charged what it used and receipted.
1. Sign in and create a key
Sign in, then create a key on the API keys tab. A key starts with sk_ and is shown once. Store it as USDF_.
2. Add funds
Buy by card on the Balance tab, or buy on the Buy page. Every way is in Fund the balance.
3. Set the base URL
Point any OpenAI-compatible client at:
https://api.usdf.fi/v1
4. Send a request
Chat completion
curl https://api.usdf.fi/v1/chat/completions \ -H "Authorization: Bearer $USDF_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek-v4.1-flash", "messages": [{"role": "user", "content": "Hello"}], "max_tokens": 256 }'
Response
{
"id": "<request_id>",
"object": "chat.completion",
"model": "deepseek-v4.1-flash",
"choices": [ … ],
"usage": { "prompt_tokens": …, "completion_tokens": … },
"receipt": {
"request_id": "<request_id>",
"status": "ok",
"cost": { "units": "<units>", "usd": "<usd>", "usdf": "<usdf>" },
"balance": { "units": "<units>", "usd": "<usd>", "usdf": "<usdf>" },
"settlement": {
"status": "unsettled",
"lookup": "https://api.usdf.fi/v1/receipts/<request_id>"
}
}
}The TypeScript sample uses top-level await, so Node runs it only as a module: save it as a . file, or set "type": "module" in package..
From Python
The usdf package, version 0.1.6 on PyPI, charges the key's balance and returns each answer with its receipt. It reads the key from USDF_.
The usdf package
pip install usdf==0.1.6
from usdf import USDF client = USDF() # reads USDF_API_KEY result = client.run("deepseek-v4.1-flash", "Hello", max_tokens=256) print(result.text) print(result.receipt.request_id, result.receipt.cost.usdf, "USDF")
The openai package works the same way, pointed at https:/:
The openai package
pip install openai
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.usdf.fi/v1",
api_key=os.environ["USDF_API_KEY"],
)
completion = client.chat.completions.create(
model="deepseek-v4.1-flash",
messages=[{"role": "user", "content": "Hello"}],
max_tokens=256,
)
print(completion.choices[0].message.content)
# Fields the SDK does not model stay on the response object.
receipt = completion.model_extra["receipt"]
print(receipt["request_id"], receipt["cost"]["usdf"], "USDF")With a coding agent
Claude Code takes the gateway's address without / and your key as its auth token. Its default model and its opus, sonnet and haiku choices work with no model setting. Replace sk_ with your key, then start claude from that shell.
Claude Code
export ANTHROPIC_BASE_URL=https://api.usdf.fi export ANTHROPIC_AUTH_TOKEN=sk_YOUR_KEY claude
The settings file for every session, the models to pin, the Claude desktop app and a fix for each error are on Claude Code and the Claude app. Cursor, Codex and Cline: coding agents. Moving from another router: switch in two lines.
Authentication
Each credential goes in one header. Keys are stored only as a hash.
| Credential | Header | Used for |
|---|---|---|
| API key | Authorization: Bearer sk_ | / and MCP |
| Session token | Authorization: Bearer <session token> | Account, keys and agents |
| x402 payment | PAYMENT-SIGNATURE: <encoded payment> | / |
| MPP credential (Machine Payments Protocol) | Authorization: Payment <credential> | / |
| Read token | Authorization: Bearer <read_ | A video job paid per request |
Holds and charges
The ledger is the gateway's record of every balance, hold and charge. Spend in it settles onchain in batches; see Settlement.
- Before a request runs, a hold for its worst case is taken: the prompt plus
max_.tokens - The charge is the provider's reported usage at the sheet price, rounded to the nearest unit. The rest of the hold is released.
- A request that fails after its hold is marked
failed_, with cost zero.refunded
Pay per request works the same way: the payment is the hold, the charge is what the request used, and the rest is refunded. A small minimum that follows the network's gas applies: a request quoted below it is charged that minimum (minimum_ in each quote). The rates in force are not locked: a later price sheet may change them, and each request is charged the lowest price for its usage among the sheet in force and every earlier sheet whose 30-day promise still holds.
Receipts
Every response carries a receipt:
- Its id is the
x-request-idheader. On a chat or text completion it is also the response'sid. - A response that is not streamed also sends the cost in
x-cost-units. A chat or text completion paid per request does not: readreceipt..paid - A stream sends the receipt as its last comment line, before
[DONE].
Receipt, trimmed
"receipt": { "request_id": "<request_id>", "model": "deepseek-v4.1-flash", "status": "ok", "usage": { "prompt_tokens": …, "completion_tokens": … }, "price": { "version": "<price sheet>", "input": …, "output": … }, "cost": { "units": "<units>", "usd": "<usd>", "usdf": "<usdf>" }, "settlement": { "status": "unsettled", "next_batch_after": "<time>" } }
Look one up with GET /v1/receipts/{id} and the key that made it, or with GET /x402/v1/receipts/{id} and no key at all.
See receipts, settlement and the public log
Units
Every amount is an integer number of units. USDF and USDG both have 6 decimals.
| Amount | Units | Value |
|---|---|---|
| 1 unit | 1 | $0.000001 |
| 1 USDF | 1,000,000 units | $1 |
| 1 USDG | 1,000,000 units | 1 USDF |
Amounts come back as { "units", "usd", "usdf" } strings, so no precision is lost. Prices are per 1M tokens for text, embeddings and rerank, per million UTF-8 bytes of input for speech, per minute for transcription, per image unit for images and per second for video. Each model's unit is in GET /v1/pricing.
These are the gateway's default limits; signed in, every figure is read live from GET /v1/limits. A request over the gateway's limit gets 429, the error code shown, and Retry-After in seconds. Over the edge's limit, requests from the address are refused with 429 for 10 seconds; webhook deliveries are not counted.
Requests with an API key have no request-rate cap, and neither does a single payer: a key is held to one only where its owner sets one. Key budgets, what a key has left and the headers of a 429: Limits.
| Applies to | Scope | Limit | Error code |
|---|---|---|---|
| Every request, at the edge | per caller IP address | 1500 requests per 10 s | 429 |
| Requests with an API key | per API key | No limit (1–5999 req/min, configurable) | rate_ |
| Public reads with no key | per caller IP address | 120 req/min | rate_ |
| Pay per request with no key (x402 or MPP), per caller address | per caller address | 30 req/min | rate_ |
| Payments settling, every payer | gateway-wide | 60 req/min | payments_ |
| Payments from one payer | per payer address | 1 payment settling at a time | payment_ |
| Agent writes | per caller IP address | 10 req/min | rate_ |
| Platform key calls | per platform key | 120 req/min | rate_ |
What each one covers:
- Requests with an API key: chat and text completions, every modality endpoint, batch submissions,
POST /v1/tools, and the MCPchat,balanceandreceipttools. They share one count per key. - Public reads with no key: /v1/index and its history, /v1/holders/windows, /v1/holders/rewards, /v1/holders/rewards/{address}, /v1/holders/roots, /v1/holders/roots/{hour}, /v1/holders/proof/{address}, /v1/tools, /v1/reserve/attestations and /history, /v1/agents reads except the payments feed, /v1/privacy/attestation, /v1/platform/embed/{id}, /v1/referrals/terms, /v1/ecosystem, /v1/stats/site, /v1/stats/gate, /v1/fees, /v1/addresses, /v1/free-credits/pool, /v1/free-credits/campaigns/{code}, /v1/free-tier, each model's stats (/v1/models/{id}/stats) and /v1/pricing/compare.
- Paid requests: every paid attempt from one IP address, on any endpoint and with either scheme. A payer settles one payment at a time.
- Settling payments are also capped at 8 in flight at once, across every payer. A payer the gateway has settled for before, and a contract wallet's signature check, each have a budget of their own of the same size.
- The paid MCP
chattool used with no key counts against the pay-per-request limits. - A sub-key is an ordinary API key, with the per-key limit.
Other public reads and jobs carry their own limits:
| Applies to | Scope | Limit | Error code |
|---|---|---|---|
| GET /v1/zap/quote (the pay-with-anything quote) | per caller IP address | 30 req/min | rate_ |
| GET /v1/pool (the USDF/USDG pool: price, tick, reserves) | per caller IP address | 60 req/min | rate_ |
| GET /v1/peg (the peg: the pool's price against its band) | per caller IP address | 60 req/min | rate_ |
| GET /v1/links/{token} (a send link's public read) | per caller IP address | 60 req/min | rate_ |
| GET /x402/v1/videos/{id}[/content] (a video job's no-key read) | per caller address | 120 req/min | rate_ |
| GET /v1/batches/{id}/result (each read is a read of the upstream's batch API; the gateway keeps no copy) | per batch job | 20 req/min | rate_ |
| GET /v1/messages/batches/{id}/results (each read reads every request's result from the upstream's batch API) | per Message Batch | 2 req/min | rate_ |
| video jobs started and not billed until fetched or expired | per key, or per address with no key | 2 open jobs at once | too_ |
Session and dashboard calls have per-account limits too. They are listed in Account limits.
A refused request has this shape, on every endpoint:
{ "error": { "message": "…", "type": "…", "code": "…" } }type is the class of error and code the exact reason. The common ones:
| Status | Common code | What to do |
|---|---|---|
400 | null for a plain validation error, or a reason such as context_ | Fix the request. Sending it again unchanged fails again. |
401 | invalid_ | Send a valid key as a Bearer token. |
402 | insufficient_ or x402 | Fund the balance, or pay the quote. |
403 | key_ | Resume the key, or use another one. |
429 | rate_ | Wait for Retry-After, then send it again. |
502 | upstream_ | Every provider for the model failed. Nothing was charged. Retry, or pick another model. |
Every docs page, by what you are doing:
Get started
- Pay per requestQuote, sign one payment and send the request again. No account and no key.
- Accounts and keysSign in, link a wallet, fund a balance, and give each key its own caps.
Build
- API referenceThe model endpoints, chat parameters, streaming, models, batch jobs, tools and public data.
- ModalitiesEmbeddings, images, speech, transcription, music, rerank and video on one balance.
- RoutingRouting shortcuts, provider preferences, a price ceiling and fallbacks.
- Prompt cachingWhat is cached, breakpoints, the cached tokens in each answer and the cache rates.
- LimitsRequests with an API key have no request-rate cap. Key budgets, what a key has left, and the 429 and 402.
- ErrorsStatus codes, error codes by area, whether anything was charged, and what to do.
Models and tools
Agents and integrations
- AgentsAgents with their own balance, key, spending policy and approvals.
- SDKs and MCPThe TypeScript SDK, the AI SDK provider, OpenAI clients, MCP and the CLI.
- Claude Code and the Claude app
- Kilo CodeKilo Code with a custom OpenAI-compatible provider.
- LibreChatLibreChat with a custom endpoint in librechat.yaml.
- Open WebUIOpen WebUI with an OpenAI API connection.
- n8nn8n's OpenAI credential and its chat model node.
- LiteLLMLiteLLM's SDK and proxy with the openai/ prefix.
- Switch from another routerMoving from another router: change the base URL and the key.
- Platforms and providersSub-keys for platforms, referrals, your own endpoint, and a node on a Mac or a GPU.
Providers
- For providersList your endpoint or your marketplace on the network and get paid in USDF.
Partners
Account and trust
- CreditsCredits: who gets them, and the rules they follow.
- ReferralsShare a referral link and earn from the requests it brings, paid in USDF.
- PrivacyWhat the gateway keeps and for how long, and how private inference works.
- SecurityWhat you can check yourself: the token contract, the reserve, receipts and keys.
Does USDF change in price?
1 USDF = $1 of compute, redeemable 1:1 for USDG at any time. At the token contract the rate never moves: anyone can deposit USDG for USDF and redeem USDF for USDG 1:1, with no fee. USDF also trades in the USDF/USDG pool in the swap market, where the market sets the price and it can differ from 1:1; the contract's 1:1 is there beside it at any time. Global Dollar (USDG), issued by Paxos, retains pause and freeze powers over its own token.
Does USDF expire?
Never.
Do I need an account?
A wallet is enough to buy, swap, redeem and send USDF, and to pay per request. An account adds API keys, its own Foundry wallet and linking X.
Which clients work?
Any OpenAI chat completions client, the AI SDK, LangChain, and any MCP client. See SDKs and MCP.
Is the Responses API served?
Yes. POST /v1/responses is stateless: send the conversation in the input.
Which base URL do coding-agent tools use?
Messages-format tools use https:/ with an sk_ key. Chat-completions and Responses tools use https:/.
How is the reserve verified?
Read it live on Transparency, or run its checks in your browser on Verify.