AiMo Network plugin for ElizaOS - decentralized AI inference marketplace using SVM/EVM wallet signing.
This plugin provides ElizaOS agents with access to AiMo Network's decentralized AI inference marketplace. Unlike traditional API-based providers, AiMo Network uses blockchain wallet authentication (Solana SVM or Ethereum EVM) for payments and identity.
- ✅ Text Generation (small and large models)
- ✅ Object Generation (structured data)
- ✅ Dual Wallet Support (Solana SVM and Ethereum EVM)
- ✅ Wallet-Based Authentication (no API keys required)
- ✅ Automatic Payment Handling (via x402 protocol)
- 🚧 Embeddings (planned for future release)
- 🚧 Image Generation/Description (planned for future release)
This plugin does not support browser execution. Browser support is planned for future releases using:
- WalletConnect integration
- Proxy-based solutions
For web-based agents, use a server-side API endpoint that proxies requests to this plugin.
bun install plugin-aimo-routerSet the following environment variables to configure the plugin:
| Variable | Required | Description | Default |
|---|---|---|---|
AIMO_WALLET_TYPE |
✅ Yes | Wallet type: svm (Solana) or evm (Ethereum) |
- |
AIMO_PRIVATE_KEY |
✅ Yes | Wallet private key (base58 for SVM, hex with 0x for EVM) | - |
AIMO_CHAIN_ID |
❌ No | Blockchain network ID | Mainnet |
AIMO_BASE_URL |
❌ No | AiMo Network API URL | https://beta.aimo.network |
AIMO_SMALL_MODEL |
❌ No | Small model for text/object generation | openai/gpt-4o-mini |
AIMO_LARGE_MODEL |
❌ No | Large model for text/object generation | openai/gpt-4o |
SMALL_MODEL |
❌ No | Fallback for small model name | openai/gpt-4o-mini |
LARGE_MODEL |
❌ No | Fallback for large model name | openai/gpt-4o |
Solana (SVM):
- Format: base58 encoded string
- Length: 58 characters (64 bytes when decoded)
- Example:
5K9x...jZ3n
Ethereum (EVM):
- Format: hex string with
0xprefix - Length: 66 characters (32 bytes)
- Example:
0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
Solana:
- Mainnet:
solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp - Devnet:
solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1 - Testnet:
solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z
Ethereum:
- Mainnet:
eip155:1 - Sepolia:
eip155:11155111
Create a .env file:
# For Solana wallet
AIMO_WALLET_TYPE=svm
AIMO_PRIVATE_KEY=5yourBase58EncodedPrivateKey...
AIMO_CHAIN_ID=solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
# OR for Ethereum wallet
AIMO_WALLET_TYPE=evm
AIMO_PRIVATE_KEY=0x1234567890abcdef...
AIMO_CHAIN_ID=eip155:1In your ElizaOS configuration:
import { aimoRouterPlugin } from "plugin-aimo-router";
const config = {
plugins: [aimoRouterPlugin],
// ... other config
};The plugin automatically registers model handlers:
// Text generation (small model)
const smallText = await runtime.useModel(ModelType.TEXT_SMALL, {
prompt: "What is AiMo Network?"
});
// Text generation (large model)
const largeText = await runtime.useModel(ModelType.TEXT_LARGE, {
prompt: "Explain decentralized AI in detail"
});
// Streaming text
const result = await runtime.useModel(ModelType.TEXT_SMALL, {
prompt: "Count from 1 to 5",
stream: true,
onStreamChunk: (chunk) => console.log(chunk)
});
// Object generation
const data = await runtime.useModel(ModelType.OBJECT_SMALL, {
prompt: "Create a user object",
schema: {
type: "object",
properties: {
name: { type: "string" },
age: { type: "number" }
}
}
});-
Private Keys: The plugin uses private keys for wallet signing. Never commit these to version control or share them.
-
Environment Variables: Store private keys in environment variables or secure secrets management (e.g., AWS Secrets Manager, HashiCorp Vault).
-
Payment: AiMo Network automatically handles payments via x402 protocol. Ensure your wallet has sufficient balance.
-
Future Improvement: This implementation uses environment variables for simplicity. Future versions should support:
- Hardware wallet integration
- Key management services (KMS)
- Multi-signature wallets
- Signer Factory (
src/utils/signer.ts): Creates SVM/EVM signers with validation - Provider (
src/providers/aimo-router.ts): AiMo Network integration with browser check - Model Handlers (
src/models/): Text and object generation - Config Utils (
src/utils/config.ts): Configuration management and validation - Initialization (
src/init.ts): Configuration validation on startup
- Initialization: Plugin validates wallet configuration on startup
- Signer Creation: Creates appropriate signer (SVM or EVM) from private key
- Provider Setup: Uses
@aimo.network/providerfor API integration - Request Processing: Each request is signed by the wallet automatically
- Payment Handling: x402 protocol handles micropayments automatically
# Build the plugin
bun run build
# Run tests
bun testError: Invalid private key format for svm wallet. Expected: base58 encoded (64 bytes when decoded)
Solution: Ensure private key format matches wallet type:
- SVM: base58 encoded (58 chars)
- EVM: hex with 0x prefix (66 chars)
Error: Payment required - insufficient balance
Solution: Ensure your wallet has sufficient USDC or compatible tokens on AiMo Network.
Error: AiMo plugin does not support browser execution
Solution: This is expected. Use Node.js environment or wait for browser support release.
bun run buildbun run devbun run formatContributions are welcome! Areas for improvement:
- Browser Support: Implement WalletConnect or proxy-based solutions
- Embeddings: Add when AiMo Network supports embeddings API
- Image Generation: Add when AiMo Network supports image models
- Security: Implement hardware wallet integration
- Caching: Add response caching for better performance
See LICENSE file for details.