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.

650+Models
20,000+Tools
On this page
Anthropicopenai logoOpenAIgoogle logoGoogleDeepSeekMoonshot AIzai logoZ.aiQwenMistral AIxai logoxAISee all developers

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.

SDKs and MCP

The TypeScript SDK, OpenAI clients, MCP and the CLI.

Platforms and providers

Sub-keys for platforms, and earning USDF from your own endpoint or machine.

Trust

Data handling, privacy and verification.

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.

ReasonWhat it means
Zero fee in, zero fee outBuying 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 dollarWithdraw it, send it to anyone by link or address, or trade it.
EarningUSDF earns nothing, plain or held in any other token or vault.
Agents hold itAn agent pays per request in USDF with no account and no API key.
Backed 1:1, in publicA stock OpenZeppelin contract with no owner. Redemption is permissionless, and the reserve is onchain and published at Transparency.
PropertyTypical compute creditUSDF
Cash outNot redeemable for cashRedeems 1:1 for USDG at any time
BackingA balance on the platform's booksA full 1:1 USDG reserve, checkable every block
SupplyOne provider accountEvery provider on the network competes for each request
PrivacySet by the platformZero retention by default wherever a zero-retention route exists
AgentsNeed an account and a keyPay 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.

SourceStateWhat it is
ComputeLiveNet revenue from every request Dispatch routes, each below its source price.
Tools and servicesLiveTool 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://api.usdf.fi 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:

SurfaceURLAuth
Pay per requesthttps://api.usdf.fi/x402/v1/…A signed payment per request
OpenAI-compatible APIhttps://api.usdf.fi/v1API key
MCP serverhttps://api.usdf.fi/mcpAPI key, or a payment per call
Receipt of any requesthttps://api.usdf.fi/x402/v1/receipts/{id}None
Agent skillhttps://api.usdf.fi/skill.mdNone
Machine-readable maphttps://api.usdf.fi/llms.txtNone
Signed model cataloghttps://api.usdf.fi/v1/catalogAPI key

The chain and the token:

ItemValue
ChainRobinhood Chain (eip155:4663)
RPC URLhttps://rpc.mainnet.chain.robinhood.com
Explorerhttps://robinhoodchain.blockscout.com
USDF contract0x4A35a5eC2A50A4d2957B2F2366E017f526cAB318
USDG contract0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168
Decimals6 decimals, for both tokens
Base unit1 unit = $0.000001

Samples use deepseek-v4.1-flash.

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_KEY to the wallet's private key.

Paid request

TypeScript
Install
npm install @usdf/sdk viem
Code
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_tokens sets the quote: the most the request can cost, with the answer counted at max_tokens. 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 /x402. The gateway answers 402 with the exact amount and the two payments it accepts. An unpaid quote costs nothing.

Request

curl
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
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.

See every payment detail and every paid endpoint

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_API_KEY.

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 .mts file, or set "type": "module" in package.json.

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_API_KEY.

The usdf package

Python
Install
pip install usdf==0.1.6
Code
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://api.usdf.fi/v1:

The openai package

Python
Install
pip install openai
Code
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 /v1 and your key as its auth token. Its default model and its opus, sonnet and haiku choices work with no model setting. Replace sk_YOUR_KEY 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.

See keys, caps and balances

See the full API reference

Authentication

Each credential goes in one header. Keys are stored only as a hash.

CredentialHeaderUsed for
API keyAuthorization: Bearer sk_…/v1 and MCP
Session tokenAuthorization: Bearer <session token>Account, keys and agents
x402 paymentPAYMENT-SIGNATURE: <encoded payment>/x402
MPP credential (Machine Payments Protocol)Authorization: Payment <credential>/x402
Read tokenAuthorization: Bearer <read_token>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_refunded, with cost zero.

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_charge 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-id header. On a chat or text completion it is also the response's id.
  • A response that is not streamed also sends the cost in x-cost-units. A chat or text completion paid per request does not: read receipt.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.

AmountUnitsValue
1 unit1$0.000001
1 USDF1,000,000 units$1
1 USDG1,000,000 units1 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 toScopeLimitError code
Every request, at the edgeper caller IP address1500 requests per 10 s429
Requests with an API keyper API keyNo limit (1–5999 req/min, configurable)rate_limited
Public reads with no keyper caller IP address120 req/minrate_limited
Pay per request with no key (x402 or MPP), per caller addressper caller address30 req/minrate_limited
Payments settling, every payergateway-wide60 req/minpayments_busy
Payments from one payerper payer address1 payment settling at a timepayment_in_flight
Agent writesper caller IP address10 req/minrate_limited
Platform key callsper platform key120 req/minrate_limited

What each one covers:

  • Requests with an API key: chat and text completions, every modality endpoint, batch submissions, POST /v1/tools, and the MCP chat, balance and receipt tools. 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 chat tool 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 toScopeLimitError code
GET /v1/zap/quote (the pay-with-anything quote)per caller IP address30 req/minrate_limited
GET /v1/pool (the USDF/USDG pool: price, tick, reserves)per caller IP address60 req/minrate_limited
GET /v1/peg (the peg: the pool's price against its band)per caller IP address60 req/minrate_limited
GET /v1/links/{token} (a send link's public read)per caller IP address60 req/minrate_limited
GET /x402/v1/videos/{id}[/content] (a video job's no-key read)per caller address120 req/minrate_limited
GET /v1/batches/{id}/result (each read is a read of the upstream's batch API; the gateway keeps no copy)per batch job20 req/minrate_limited
GET /v1/messages/batches/{id}/results (each read reads every request's result from the upstream's batch API)per Message Batch2 req/minrate_limited
video jobs started and not billed until fetched or expiredper key, or per address with no key2 open jobs at oncetoo_many_video_jobs

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:

StatusCommon codeWhat to do
400null for a plain validation error, or a reason such as context_length_exceededFix the request. Sending it again unchanged fails again.
401invalid_api_keySend a valid key as a Bearer token.
402insufficient_balance or x402Fund the balance, or pay the quote.
403key_pausedResume the key, or use another one.
429rate_limitedWait for Retry-After, then send it again.
502upstream_unavailableEvery provider for the model failed. Nothing was charged. Retry, or pick another model.

See status codes and error codes by area

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

  • ModelsEvery model, each below its source price.
  • ToolsEvery tool, its price and its input fields, paid from the same balance.

Agents and integrations

Providers

  • For providersList your endpoint or your marketplace on the network and get paid in USDF.

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://api.usdf.fi with an sk_ key. Chat-completions and Responses tools use https://api.usdf.fi/v1.

How is the reserve verified?

Read it live on Transparency, or run its checks in your browser on Verify.

Foundry documentation

Confirm it's you

Confirm to continue the action you started.

Checking confirmation options…