Skip to content

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
How it works:
  1. Generate an API key at https://aimo.network/account/keys
  2. Fund your account with USDC at https://aimo.network/account/balance
  3. Make API requests with Authorization: Bearer aimo-sk-v2-[your-api-key] header
  4. Payments are processed automatically via X402 protocol
Example:
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
How it works:
  1. Make a request without Authorization header
  2. Receive a 402 Payment Required response with payment details
  3. Submit payment on Solana or Base
  4. Retry request with payment proof in X-Payment header
Example:
# 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 viem
import { 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

  1. Request: Client makes API request
  2. Payment Required: Server returns 402 with payment options (Solana, Base)
  3. Payment: Client submits USDC payment transaction
  4. Verification: Server verifies payment on-chain
  5. 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:

  1. Visit https://aimo.network/account/balance
  2. Add USDC to your account
  3. 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

FeatureAPI Key MethodDirect X402
Setup RequiredAccount + API keyWallet only
Payment FlowAutomaticManual/SDK
Best ForProduction appsDecentralized apps
IntegrationSimpleAdvanced
Transaction FeesMinimal (managed)Gas fees per request