Skip to main content
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:
  1. Send a request to the Codex API
  2. The server responds with HTTP 402 Payment Required and a payment challenge
  3. The client pays via stablecoins on Tempo
  4. 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 networkTempo
Payment tokenUSDC
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: 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:
MPPx402
Payment methodsStablecoins, cards, wallets, custom railsBlockchain only
Session paymentsPay-as-you-go with off-chain vouchersPer-request only
CompatibilityCan 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:
  1. Install the presto CLI if needed (handles wallet setup and payments)
  2. Show you the cost of the query
  3. Ask you to confirm the payment
  4. 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:
  1. Add the X-Codex-Payment: mpp header to your request
  2. presto intercepts the 402 response, signs a payment transaction, and retries
  3. 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

  • MPP Documentation — Full protocol docs, SDKs, and guides
  • MPP FAQ — Common questions about the protocol
  • x402 Protocol — The open standard for HTTP-native payments
  • Example repo — Full working example with Codex
  • presto CLI — Command-line client for making paid requests
  • Tempo — The network powering MPP stablecoin payments