Documentation

cn2.ai is an API key marketplace. Sellers list spare API capacity and earn per request. Buyers access APIs through cn2.ai proxy endpoints with zero signup — payment happens inline with each request.

How it works

cn2.ai sits between buyers and upstream API providers. When a buyer sends a request to a cn2.ai proxy endpoint (like openai.cn2.ai), the platform:

  1. Responds with HTTP 402 and a payment challenge describing the cost and accepted payment methods.
  2. The buyer's client pays via MPP (Tempo USDC, Stripe, Lightning) or x402 (USDC on Base) and retries with a payment credential.
  3. cn2.ai verifies the payment, selects the best available seller key for that provider, and proxies the request upstream.
  4. The upstream response is forwarded to the buyer along with a payment receipt. The seller earns their share.

cn2.ai supports two payment protocols: MPP (Machine Payments Protocol — Tempo USDC, Stripe, Lightning) and x402 (USDC on Base via Coinbase). Both are advertised in every 402 response — clients use whichever they support.

Key concepts

Proxy endpoint
Each API provider has a subdomain (e.g. openai.cn2.ai) that mirrors the upstream API. Replace your base URL and requests work the same way.
MPP (Machine Payments Protocol)
An open protocol for paying for API requests inline via Tempo USDC, Stripe, or Lightning. Your first request gets a 402 challenge; your client pays and retries.
x402 (USDC on Base)
Coinbase's HTTP 402 payment protocol using USDC on the Base L2 network. An alternative to MPP — both are accepted on every cn2.ai endpoint.
Key pool
When multiple sellers list keys for the same provider, cn2.ai maintains a pool. Requests are routed to the cheapest eligible key with the highest reliability score.
Priority score
Each listed key has a score from 0 to 1 representing its reliability. Keys that consistently return successful responses maintain a high score. Errors cause the score to decay.
Standard and premium pools
The standard pool is the default. Sellers can opt into the premium pool if their key maintains a high priority score — buyers pay 25% more for higher reliability.
EU routing
Buyers in EU countries are automatically routed to EU-tagged keys only. This ensures data stays within the EU for GDPR compliance.
Rate limiting
Each key has per-minute (RPM), per-hour (RPH), and total budget limits enforced by KV counters at the edge. If a key is rate-limited, cn2.ai automatically tries the next eligible key.
Community providers
Anyone can submit a new API provider spec via the Explorer. Submissions go through admin approval before appearing in the catalog and becoming available for key listings.
Email notifications
Sellers receive email alerts for key liveness failures, degradation, rotation completion, webhook endpoint issues, and payout events.

Next steps