x402
x402 — Pay-Per-Intelligence
Partial Rollout — Conversation write overage payments are now supported. Premium model-tier upgrades and full SDK abstractions are still in progress. APIs and interfaces may evolve as rollout continues. Join our Discord for updates.
What is this?
Milo will use the x402 protocol to let you pay for smarter AI models on-the-fly. Instead of fixed subscription tiers, you pay per request — upgrade the brain behind any API call by attaching a stablecoin micropayment.
No signup. No billing portal. Just an HTTP header.
x402 in 30 seconds (for new users)
If this is your first time seeing 402 Payment Required, the flow is:
You send your normal API request.
If free quota is exhausted, Milo returns
402with exact payment requirements (recipient + accepted options).You submit the payment transfer on Solana.
You retry the same API request with
X-PAYMENTthat includes:recipient(from server response)asset+amount(from server response)unique one-time
paymentIdconfirmed
txSignaturefor that payment transfer
Milo verifies on-chain and processes the request.
Think of X-PAYMENT as a payment receipt attached to the retry request.
Live Today: Conversation Overage Payments
Conversation write endpoints currently include a free tier and paid overage:
Free tier:
2writes per60sper API key (shared across conversations)Overage response:
402 Payment RequiredPayment header:
X-PAYMENTRecipient wallet:
TREASURY_WALLETAccepted prices per extra write:
0.25 USDC0.01 SOL
Anti-replay: include a unique one-time
paymentIdper paid request.On-chain verification: include
txSignaturefor a confirmed Solana transfer toTREASURY_WALLETwith matching asset+amount.
When over free quota, Milo returns payment requirements in both headers and JSON error.details:
X-Payment-Required: trueX-Payment-Header: X-PAYMENTX-Payment-Recipient: <TREASURY_WALLET>X-Payment-Options: USDC:0.25,SOL:0.01X-Payment-Id-Field: paymentIdX-Payment-Tx-Field: txSignature
When a paid overage retry is accepted (2xx), Milo returns:
PAYMENT-RESPONSE: <base64-json-settlement>(x402-style acceptance payload)X-PAYMENT-RESPONSE: <same-value>(legacy mirror)X-Billing-Mode: payg
Paid retry example:
Security Rules (Important)
Never share a private key or seed phrase with Milo, CLI flags, logs, or support channels.
Milo only needs proof of payment (
txSignature) — not wallet secrets.Always use the current
402response to determine recipient and accepted options.Do not hardcode payment recipient/amount in autonomous agents without validating server response.
Use a new one-time
paymentIdfor every paid retry (replays are rejected).A paid proof is single-use: one overage request only.
Wait for transaction confirmation before retrying with
txSignature.Treat
X-PAYMENTvalues as sensitive operational data; avoid logging full headers in production.
How it will work
Every Milo API endpoint that involves AI reasoning (conversations, position analysis, auto-trade decisions) will accept an optional x402 payment. When you pay, Milo routes your request to a more capable model with deeper analysis, more tool calls, and longer context.
You call a Milo endpoint as usual
If you want the premium model, include the
X-PAYMENTheader with your x402 payment payloadMilo verifies the payment via the x402 facilitator on Solana
Your request is routed to the upgraded model
If you don't pay, you still get the standard model — nothing breaks
Model Tiers (Planned)
Standard
Free (with API key)
Default model. Fast responses, good for routine tasks
Pro
~$0.01 USDC
Smarter model. Deeper analysis, more tool calls, better trade reasoning
Ultra
~$0.05 USDC
Best available model. Maximum context, multi-step research, institutional-grade analysis
Pricing is per-request and settled instantly on Solana in USDC. Final pricing will be announced closer to launch.
Which endpoints will support it?
Create conversation (market-analyst)
yes
yes
yes
Create conversation (auto-trader)
yes
yes
yes
Send message
yes
yes
yes
List positions (with PnL analysis)
yes
yes
—
Auto-trade rebalance decisions
automatic
—
—
The auto-trader agent will benefit the most from upgrades — Pro and Ultra models evaluate more signals, consider longer price history, and produce more detailed theses before entering or exiting positions.
Quick Example (Planned)
Once live, upgrading a request will look like this:
Standard request (free):
Pro request (with x402 payment):
Same endpoint. Same request body. The only difference is the X-PAYMENT header. Premium tier routing is not live yet — we will announce rollout timing.
SDK Integration (Coming Soon)
We're building SDK wrappers that handle payment construction automatically. You'll set a budget and the SDK handles the rest.
JavaScript / TypeScript
Status: Coming soon. The SDK will wrap
@x402/svmfor Solana payment construction and handle retry logic when the facilitator returns settlement confirmation.
Python
Status: Coming soon.
Raw HTTP (via x402 libraries)
Once Milo endpoints support x402, you'll also be able to use any x402 client library (@x402/fetch, @x402/axios) directly without the Milo SDK:
The x402 fetch wrapper handles the 402 → payment → retry flow automatically.
Status: Coming soon for premium tier upgrades. Conversation overage payments are already supported.
Spending Controls (Coming Soon)
The SDK will include safety rails so autonomous agents don't overspend:
maxSpendPerRequest
Max USDC per single API call
maxSpendPerHour
Hourly budget cap
maxSpendPerDay
Daily budget cap
modelTier
Default tier (standard, pro, ultra)
autoUpgrade
Auto-upgrade to Pro if Standard response quality is low
Why x402?
No subscriptions — Pay only for what you use
Instant settlement — Payments settle on Solana in ~400ms
Agent-native — Your trading bot can decide when to pay for better analysis
Transparent pricing — Cost is per-request, visible before you pay
Backward compatible — Standard tier always works without payment
Roadmap
Conversation write overage payments (2/min free, then paid)
Live
x402 payment verification on API
Coming soon
Pro tier (conversations, analysis)
Coming soon
Ultra tier (deep research, portfolio review)
Coming soon
TypeScript SDK (@milo/sdk)
Coming soon
Python SDK
Coming soon
Spending controls & budget caps
Coming soon
Auto-upgrade (smart tier selection)
Coming soon
Pay-per-trade execution priority
Planned
Get Notified
Want early access? Join our Discord and ask about the x402 beta.
Last updated