Payments
AiMo Network uses X402 protocol for seamless cryptocurrency payments on AI inference. There are two ways to access the API with different payment flows.
Payment Methods
Method 1: API Key with Managed Payments (Recommended)
Use an API key from the dashboard - payments are handled automatically using Coinbase server wallets implementing the X402 flow.
Best for:- Production applications
- High-volume usage
- Users who want simple integration
- Generate an API key at https://aimo.network/account/keys
- Fund your account with USDC at https://aimo.network/account/balance
- Make API requests with
Authorization: Bearer aimo-sk-v2-[your-api-key]header - Payments are processed automatically via X402 protocol
curl -X POST "https://devnet.aimo.network/api/v1/chat/completions" \
-H "Authorization: Bearer aimo-sk-v2-[your-api-key]" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o",
"messages": [
{"role": "user", "content": "Hello!"}
],
"max_tokens": 100
}'Method 2: Direct X402 Payment
Call the API without an Authorization header and implement the X402 payment flow yourself.
Best for:- Blockchain-native applications
- Pay-per-use scenarios
- Decentralized integrations
- Testing without account setup
- Make a request without Authorization header
- Receive a 402 Payment Required response with payment details
- Submit payment on Solana or Base
- Retry request with payment proof in
X-Paymentheader
# Initial request (no auth header)
curl -X POST "https://devnet.aimo.network/api/v1/chat/completions" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}],
"max_tokens": 100
}'
# Response: 402 Payment Required with payment options
# After submitting payment, retry with proof:
curl -X POST "https://devnet.aimo.network/api/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "X-Payment: base:0x[transaction-hash]" \
-d '{...same request...}'Using X402 SDK
For direct X402 payments, use the official SDK to handle the payment flow automatically:
npm install x402-fetch viemimport { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { wrapFetchWithPayment } from "x402-fetch";
import { base } from "viem/chains";
const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const client = createWalletClient({
account,
transport: http(),
chain: base,
});
const fetchWithPay = wrapFetchWithPayment(fetch, client);
const response = await fetchWithPay("https://devnet.aimo.network/api/v1/chat/completions", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
model: "openai/gpt-4o",
messages: [{ role: "user", content: "Hello!" }],
max_tokens: 100
})
});
const data = await response.json();
console.log(data);How X402 Payments Work
- Request: Client makes API request
- Payment Required: Server returns 402 with payment options (Solana, Base)
- Payment: Client submits USDC payment transaction
- Verification: Server verifies payment on-chain
- Response: Server processes request and returns result
Supported Networks
- Solana Mainnet: USDC payments
- Base Mainnet: USDC payments
Funding Your Account
For API Key Users
Fund your account through the web dashboard:
- Visit https://aimo.network/account/balance
- Add USDC to your account
- Your balance is used automatically for API requests
For Direct X402 Users
Ensure your wallet has USDC on Solana or Base:
- Solana: USDC token address
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v - Base: USDC token address
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
Usage Tracking
Payments are calculated based on:
- Token Usage: Input tokens (prompt) and output tokens (completion)
- Provider Pricing: Each provider sets their own pricing per token
- Model Type: Different models may have different pricing
Check your usage and spending in the dashboard.
Onramp/Offramp Guide
To use AiMo Network, you need USDC cryptocurrency. Here's how to get it:
Recommended: MoonPay
MoonPay is a popular onramp/offramp provider supporting multiple cryptocurrencies and fiat currencies.
Alternative: Exchange P2P
For users facing geo-restrictions, use P2P services from mainstream exchanges:
- Binance
- OKX
- Other licensed exchanges in your country
Need Help?
Join our Discord server for support with funding and payments.
Payment Security
- On-chain Verification: All payments are verified on the blockchain
- Atomic Transactions: Payment and service delivery are atomic
- No Double-Spending: Each payment can only be used once
- Transparent Pricing: All costs are shown upfront
Comparison
| Feature | API Key Method | Direct X402 |
|---|---|---|
| Setup Required | Account + API key | Wallet only |
| Payment Flow | Automatic | Manual/SDK |
| Best For | Production apps | Decentralized apps |
| Integration | Simple | Advanced |
| Transaction Fees | Minimal (managed) | Gas fees per request |