Codex supports pay-per-request access using MPP (Machine Payments Protocol) — an open, payment-method agnostic protocol built on HTTP 402. AI agents and scripts can query the Codex API without an API key by paying per request.
MPP is co-authored by Tempo and Stripe, and the core Payment HTTP Authentication Scheme is on the IETF standards track.
How it works
Traditional API access requires account creation, API keys, and prepaid credits. With MPP, the flow is:
- Send a request to the Codex API
- The server responds with
HTTP 402 Payment Required and a payment challenge
- The client pays via stablecoins on Tempo
- The server validates the payment and returns the data
No signup, no API key, no billing dashboard. Just pay and query.
MPP access is ideal for autonomous agents, bots, and scripts that need programmatic access without manual account setup. For human developers building apps, we still recommend getting an API key for the best experience.
Pricing
| |
|---|
| Cost per request | $0.001 USDC |
| Payment network | Tempo |
| Payment token | USDC |
Additional payment networks and Stripe payment methods (cards, wallets) are coming soon.
Supported endpoints
MPP is available for all Codex query endpoints on the free plan. Here are some of the most popular ones:
| Category | Popular endpoints |
|---|
| Token data | filterTokens, token, tokens, getTokenPrices, tokenSparklines, listTopTokens |
| Pair & trading | filterPairs, listPairsForToken, pairMetadata, getDetailedPairStats, getTokenEvents |
| Charts | getBars, getTokenBars, getSymbol |
| Networks | getNetworks, getNetworkStatus |
See the full GraphQL Reference for all available endpoints.
WebSocket subscriptions, webhooks, and wallet endpoints (balances, filterWallets, holders, etc.) are not available via MPP at this time.
MPP vs x402
Both protocols use HTTP 402 to signal that a request requires payment. MPP extends beyond x402 in several ways:
| MPP | x402 |
|---|
| Payment methods | Stablecoins, cards, wallets, custom rails | Blockchain only |
| Session payments | Pay-as-you-go with off-chain vouchers | Per-request only |
| Compatibility | Can consume existing x402 services | — |
MPP is fully compatible with x402 — the core x402 flows map directly onto MPP’s charge intent.
Quick start
The fastest way to try it is with the example repo:
git clone https://github.com/company-z/mpp-example-agent.git
cd mpp-example-agent
npm start
The script will:
- Install the
presto CLI if needed (handles wallet setup and payments)
- Show you the cost of the query
- Ask you to confirm the payment
- Return the top 25 trending tokens from Codex
CODEX API — MPP Payment Request
Query: Top 25 Trending Tokens
Cost: 0.001 USDC
Proceed with payment? [Y/n]
Using it with Claude
Any agent that can run shell commands can use MPP via presto. First, add the MPP skills to Claude Code:
claude -p "Add https://mpp.sh/quickstart/client.md (MPP quickstart) & https://mpp.tempo.xyz/llms.txt (MPP service endpoints) to my SKILLS.md for future reference."
Then ask Claude to query Codex via MPP:
claude -p "Use Codex to fetch the top 25 trending tokens via MPP and display the results."
How the payment works
Under the hood, MPP uses the presto CLI to handle payments. When making a request to the Codex API:
- Add the
X-Codex-Payment: mpp header to your request
presto intercepts the 402 response, signs a payment transaction, and retries
- The API validates the payment and returns the data
// Example: making a paid request with presto
const args = [
"https://graph.codex.io/graphql",
"-X", "POST",
"-H", "X-Codex-Payment: mpp",
"--json", JSON.stringify({
query: `query {
filterTokens(
rankings: [{ attribute: trendingScore24, direction: DESC }]
limit: 10
) {
results {
token { name symbol }
priceUSD
volume24
}
}
}`,
}),
];
Learn more