AiMo Network

For User

get started with AiMo Network as client user

Welcome to AiMo Network - the decentralized intelligence marketplace with a permissionless unified API. Access hundreds of AI models through a single, OpenAI-compatible endpoint.

Quick Start

Get started in 3 simple steps and make your first API call in under 5 minutes.

Step 1: Create Your Account

Visit the AiMo Network and create your account.

Step 2: Fund Your Account

Add USDC to your account at Balance Management.

Step 3: Generate an API Key

  1. Go to API Keys
  2. Click "Generate API Key"
  3. Copy your API key (format: aimo-sk-v2-[base58-encoded-key])

Store your API key securely. It cannot be retrieved again after generation. Never expose API keys in client-side code or public repositories.

Making Your First Request

Basic 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! What can you help me with?"}
    ],
    "max_tokens": 200
  }'

Code Examples

const response = await fetch('https://devnet.aimo.network/api/v1/chat/completions', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer aimo-sk-v2-[your-api-key]',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'anthropic/claude-3-5-sonnet',
    messages: [
      { role: 'user', content: 'Explain how AiMo Network works' }
    ],
    max_tokens: 300
  })
});

const data = await response.json();
console.log(data.choices[0].message.content);
import requests

response = requests.post(
    'https://devnet.aimo.network/api/v1/chat/completions',
    headers={
        'Authorization': 'Bearer aimo-sk-v2-[your-api-key]',
        'Content-Type': 'application/json'
    },
    json={
        'model': 'openai/gpt-4o',
        'messages': [
            {'role': 'user', 'content': 'What is quantum computing?'}
        ],
        'max_tokens': 300
    }
)

result = response.json()
print(result['choices'][0]['message']['content'])

Using Streaming Responses

For real-time, token-by-token responses, set stream: true:

const response = await fetch('https://devnet.aimo.network/api/v1/chat/completions', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer aimo-sk-v2-[your-api-key]',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'anthropic/claude-3-5-sonnet',
    messages: [
      { role: 'user', content: 'Tell me a short story' }
    ],
    stream: true,  // Enable streaming
    max_tokens: 500
  })
});

// Process streaming response
const reader = response.body.getReader();
const decoder = new TextDecoder();

while (true) {
  const { done, value } = await reader.read();
  if (done) break;

  const chunk = decoder.decode(value);
  const lines = chunk.split('\n').filter(line => line.trim());

  for (const line of lines) {
    if (line.startsWith('data: ')) {
      const data = line.slice(6);
      if (data === '[DONE]') continue;

      try {
        const parsed = JSON.parse(data);
        const content = parsed.choices[0]?.delta?.content;
        if (content) {
          process.stdout.write(content);
        }
      } catch (e) {
        // Skip parsing errors
      }
    }
  }
}
import requests
import json

response = requests.post(
    'https://devnet.aimo.network/api/v1/chat/completions',
    headers={
        'Authorization': 'Bearer aimo-sk-v2-[your-api-key]',
        'Content-Type': 'application/json'
    },
    json={
        'model': 'openai/gpt-4o',
        'messages': [{'role': 'user', 'content': 'Tell me a story'}],
        'stream': True,
        'max_tokens': 500
    },
    stream=True  # Enable streaming in requests
)

for line in response.iter_lines():
    if line:
        line = line.decode('utf-8')
        if line.startswith('data: '):
            data = line[6:]
            if data == '[DONE]':
                break
            try:
                parsed = json.loads(data)
                content = parsed['choices'][0]['delta'].get('content', '')
                if content:
                    print(content, end='', flush=True)
            except json.JSONDecodeError:
                pass

Streaming Response Format (Server-Sent Events):

data: {"choices":[{"delta":{"content":"Hello"}}]}

data: {"choices":[{"delta":{"content":" there"}}]}

data: {"choices":[{"delta":{"content":"!"}}]}

data: [DONE]

Available Models

Discovering Models

List all models via API:

curl "https://devnet.aimo.network/api/v1/models" \
  -H "Authorization: Bearer aimo-sk-v2-[your-api-key]"

Browse visually:

Visit AiMo Marketplace to explore all available models with their capabilities and pricing.

Model Specification

Specify models in two ways:

1. Intelligent Routing (Recommended):

{
  "model": "openai/gpt-4o"
}

The system automatically routes to the best available provider.

2. Direct Provider:

{
  "model": "provider_pubkey:model_name"
}

Route directly to a specific provider. Find provider public keys at the marketplace.

  • OpenAI: openai/gpt-4o, openai/gpt-4-turbo, openai/gpt-3.5-turbo
  • Anthropic: anthropic/claude-3-5-sonnet, anthropic/claude-3-opus
  • DeepSeek: deepseek/deepseek-chat
  • Meta: meta/llama-3-70b
  • And many more...

Request Parameters

Standard OpenAI-compatible parameters are supported:

{
  "model": "openai/gpt-4o",           // Required: Model identifier
  "messages": [                        // Required: Conversation messages
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello!"}
  ],
  "stream": false,                     // Optional: Enable streaming (default: false)
  "max_tokens": 500,                   // Optional: Maximum tokens to generate
  "temperature": 0.7,                  // Optional: Sampling temperature (0.0-2.0)
  "top_p": 1.0,                        // Optional: Nucleus sampling
  "frequency_penalty": 0.0,            // Optional: Frequency penalty
  "presence_penalty": 0.0              // Optional: Presence penalty
}

Authentication & Security

API Key Management

View and manage your keys:

Visit API Keys Dashboard to:

  • Generate new API keys
  • View all active keys
  • Monitor usage per key
  • Revoke compromised keys

Security Best Practices

  1. Store keys securely - Use environment variables, never commit to version control
  2. Rotate regularly - Generate new keys periodically for enhanced security
  3. Monitor usage - Track usage patterns through the dashboard
  4. Revoke immediately - If a key is compromised, revoke it and generate a new one

Using environment variables:

# Set environment variable
export AIMO_API_KEY="aimo-sk-v2-[your-key]"
// Use in code
const apiKey = process.env.AIMO_API_KEY;
# Use in code
import os
api_key = os.environ.get('AIMO_API_KEY')

Key Revocation

If your API key is compromised:

  1. Go to API Keys
  2. Find the compromised key
  3. Click "Revoke" to disable it immediately
  4. Generate a new key to replace it

Usage & Billing

How Costs Work

Payments are calculated based on:

  • Token Usage: Input tokens (prompt) + output tokens (completion)
  • Provider Pricing: Each provider sets their own per-token pricing
  • Model Type: Different models have different pricing

Monitor Your Usage

Track your spending and usage at Balance Management:

  • Current balance
  • Usage history
  • Spending by model
  • Transaction history

Funding Your Account

Add USDC to your account through:

  • Onramper - Buy crypto with credit/debit card like MoonPay, Coinbase Onramp
  • Exchange P2P - Transfer from Binance, OKX, etc.
  • Wallet Transfer - From Solana or Base wallets

Supported Networks:

  • Solana Mainnet (USDC)
  • Base Mainnet (USDC)

AiMo Network works seamlessly with popular AI frameworks:

OpenAI SDK

import OpenAI from 'openai';

const openai = new OpenAI({
  apiKey: process.env.AIMO_API_KEY,
  baseURL: 'https://devnet.aimo.network/api/v1'
});

const completion = await openai.chat.completions.create({
  model: 'openai/gpt-4o',
  messages: [{ role: 'user', content: 'Hello!' }]
});

LangChain

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="openai/gpt-4o",
    openai_api_key="aimo-sk-v2-[your-key]",
    openai_api_base="https://devnet.aimo.network/api/v1"
)

response = llm.invoke("What is AiMo Network?")

Vercel AI SDK

import { openai } from '@ai-sdk/openai';
import { generateText } from 'ai';

const { text } = await generateText({
  model: openai('gpt-4o', {
    baseURL: 'https://devnet.aimo.network/api/v1',
    apiKey: process.env.AIMO_API_KEY
  }),
  prompt: 'Explain quantum computing'
});

See more integrations: Integrations Guide

Troubleshooting

Common Issues

Invalid API Key Error?

{
  "error": {
    "message": "Invalid API key",
    "type": "unauthorized"
  }
}

Solutions:

  • Verify your key starts with aimo-sk-v2-
  • Check for extra spaces or line breaks
  • Generate a new key at dashboard

Insufficient Balance Error?

{
  "error": {
    "message": "Insufficient balance in escrow account",
    "type": "insufficient_balance"
  }
}

Solutions:

  • Top up USDC at balance page
  • Check your current balance and estimated costs

Model Not Found Error?

{
  "error": {
    "message": "Model not found: [model_name]",
    "type": "invalid_model"
  }
}

Solutions:

  • List available models: GET /v1/models
  • Browse models at marketplace
  • Check model name spelling and format

Debug Information

When reporting issues, provide:

  • Request/response details (sanitize your API key!)
  • Error messages and HTTP status codes
  • Timestamp of the issue
  • Model and parameters used

Key Features

OpenAI-Compatible API

Drop-in replacement for OpenAI's API with minimal code changes. Use your existing OpenAI SDK code by just changing the base URL and API key.

Decentralized & Permissionless

  • No vendor lock-in - Choose from multiple providers
  • Transparent pricing - On-chain payment verification
  • Privacy-focused - See Privacy & Logging
  • Provider competition - Best pricing through marketplace dynamics

Intelligent Provider Routing

When you specify openai/gpt-4o, the system:

  1. Finds all providers offering that model
  2. Selects the best provider based on uptime, latency, and price
  3. Automatically retries with backup providers if needed

Learn more: Provider Routing

Multiple Payment Options

API Key Method (Recommended):

  • Automatic payments from your account balance
  • Simple integration with standard HTTP clients
  • Managed by Coinbase server wallets

Direct X402 Protocol:

  • Blockchain-native pay-per-use
  • No account required
  • Use your own wallet directly

For detailed payment information, see the dedicated payment sections in the documentation.

What's Next?

  • Tutorial - Integration guides for OpenAI SDK, LangChain, Vercel AI SDK, and more
  • API Reference - Complete technical documentation
  • Provider Guide - Want to become a provider? Learn how to offer your models
  • AI Agent Guide - Onboard autonomous AI agents to AiMo Network