AiMo Network - Service Provider Guide
Welcome to the AiMo Network Service Provider Guide. This documentation will help you connect your AI model services to the AiMo Network, enabling you to offer your AI models to users in a decentralized marketplace.
Overview
As a service provider on AiMo Network, you can:
- Connect your existing AI model APIs to the network
- Receive automatic payments for model usage
- Serve users through a decentralized, peer-to-peer architecture
- Maintain control over your models and pricing
How It Works
- Set up API Key: Generate your provider API key for authentication
- Set up API Endpoint: Ensure your service is OpenAI-compatible
- Configure Proxy: Create a configuration file for the AiMo proxy
- Run the Proxy: Start the proxy to connect your service to the network
- Retrieve Earning Tokens: Withdraw your earnings from the network
Getting Started
Follow these steps to become an AiMo Network provider:
Prerequisites
Before connecting to AiMo Network, ensure you have:
- A Solana wallet with some SOL for transaction fees
- An HTTP-based AI model service (REST API) that's OpenAI-compatible
- Your service accessible via HTTP/HTTPS endpoints
- The AiMo Proxy installed (via Cargo or Docker)
Step 1: Set Up API Key
You have two options to generate your provider API key:
Option A: Using the Web Console
Generate your provider API key through the AiMo Network web dashboard:
- Navigate to the AiMo Network Dashboard
- Connect your Solana wallet
- Go to the API Keys section
- Click "Generate Provider Key"
- Copy and securely store your API key
Your API key will look like: aimo-sk-v2-[base58-encoded-key]
Option B: Using AiMo CLI
Generate a provider API key using the command line:
# Install the CLI if you haven't already
cargo install aimo-cli
# Generate a provider API key (requires Solana wallet signature)
aimo keygen --tag dev --valid-for 90 --scopes completion_modelNote: Provider keys require Solana wallet signature for generation via CLI, unlike user API keys.
Step 2: Set Up API Endpoint (OpenAI Compatible)
Your service must be compatible with OpenAI's chat completion API format:
Request Format
Your endpoint should accept POST requests with this structure:
{
"model": "your-model-name",
"messages": [
{"role": "user", "content": "Hello, AI!"}
],
"stream": false,
"max_tokens": 150,
"temperature": 0.7
}Response Format (Non-streaming)
{
"choices": [
{
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 8,
"total_tokens": 18
}
}Response Format (Streaming)
For streaming responses, return Server-Sent Events:
Content-Type: text/event-stream
data: {"choices":[{"delta":{"content":"Hello"}}]}
data: {"choices":[{"delta":{"content":" there"}}]}
data: {"choices":[{"delta":{"content":"!"}}],"finish_reason":"stop","usage":{"prompt_tokens":10,"completion_tokens":3}}
data: [DONE]Step 3: Configure Proxy with Config File
Configuration File Introduction
The AiMo proxy uses a configuration file to manage your service settings. Create a config.toml file with your service configuration:
# config.toml
[router]
url = "https://devnet.aimo.network"
# prefix with `std::env::` to read from env vars
api_key = "std::env::AIMO_PROVIDER_KEY"
# Model metadata
[[models]]
name = "gpt-4o"
display_name = "OpenAI: GPT-4o"
provider_name = "openai"
# optional
context_length = 128000
# optional
input_modalities = ["text"]
output_modalities = ["text"]
[models.pricing]
# USDC per million token
prompt = 2.5
# USDC per million token
completion = 10.0
# USDC per image input (optional)
# image = 1.0
# How to access the model
[models.params]
model = "gpt-4o"
api_base = "https://api.openai.com/v1"
# prefix with `std::env::` to read from env vars
api_key = "std::env::OPENAI_API_KEY"
# Add more models by repeating the [[models]] section
[[models]]
name = "deepseek-chat-v3"
display_name = "DeepSeek: DeepSeek V3"
provider_name = "deepseek"
context_length = 64000
[models.pricing]
# USDC per million token
prompt = 0.5
completion = 1.0
[models.params]
model = "deepseek-chat"
api_base = "https://api.deepseek.com/v1"
api_key = "std::env::DEEPSEEK_API_KEY"
# Another example model
[[models]]
name = "gemini-2.5-flash"
display_name = "Google: Gemini 2.5 Flash Preview 05-20"
provider_name = "google"
[models.pricing]
prompt = 0.3
completion = 0.85
[models.params]
model = "gemini-2.5-flash"
api_base = "https://generativelanguage.googleapis.com/v1"
api_key = "std::env::GOOGLE_API_KEY"Using Environment Variables
Set your API keys as environment variables for security:
export AIMO_PROVIDER_KEY="aimo-sk-v2-your-provider-key-here"
export OPENAI_API_KEY="sk-your-openai-key"
export DEEPSEEK_API_KEY="sk-your-deepseek-key"
export GOOGLE_API_KEY="your-google-api-key"Step 4: Install and Run the Proxy
Install AiMo Proxy
You can install the proxy via Cargo or use Docker:
Option A: Install via Cargocargo install aimo-proxySee the Docker Deployment Guide for detailed Docker setup instructions.
Run the Proxy
Start the proxy using your configuration file:
aimo-proxy --config config.tomlStep 5: Retrieve Earning Tokens
How Payments Work
- User Escrow: Users deposit USDC into escrow accounts
- Request Locking: Before each request, estimated cost is locked
- Usage Tracking: Your service reports actual token usage
- Settlement: Payments are automatically settled based on actual usage
- Provider Earnings: Accumulated earnings can be withdrawn
Withdrawing Earnings
Your earnings accumulate in a managed provider account. To withdraw:
Using the Dashboard (In Development)
- Navigate to the provider dashboard
- Go to the earnings section
- Specify the withdrawal amount
- Confirm the transaction with your wallet
- The dashboard handles the router coordination and transaction submission
Welcome to AiMo Network! Start earning from your AI models today.