@ordlibrary/create-x402
v0.1.0
Published
Create and deploy your own X402 Solana AI agents
Maintainers
Readme
Create X402 - Build & Deploy Solana AI Agents
The easiest way to create, customize, and deploy Solana AI agents
🚀 Quick Start
Create your first X402 agent in under 2 minutes:
bun create x402Or with npm/npx:
npx @elizaos/create-x402📦 What is X402?
X402 is a powerful framework for building Solana AI agents with:
- 🤖 Multi-Provider AI - Google Gemini, OpenAI, Anthropic, xAI Grok
- ⛓️ Solana Integration - Built-in Helius RPC, Jupiter DEX, Metaplex NFTs
- 🎨 Content Creation - AI image, video, 3D, and music generation
- 💬 Social Platforms - Twitter, Discord, Telegram automation
- 🚀 One-Click Deploy - Railway, Vercel, Render, Fly.io
- 📊 Web Dashboard - Manage agents from beautiful UI
🏗️ Agent Types
1. Trading Agent
Automated Solana trading with risk management
- Jupiter DEX integration
- Real-time market analysis
- Position management
- Risk controls
2. Content Creator
AI-powered media generation
- Images (FAL, Stability, Runway)
- Videos (Kling, Veo, Hunyuan)
- 3D models (Tripo3D, Trellis)
- Music & audio (ElevenLabs, MMAudio)
3. Social Media Agent
Autonomous social engagement
- Twitter posting & replies
- Discord community management
- Telegram bot interactions
4. Developer Agent
Code generation & deployment
- GitHub integration
- E2B sandboxing
- Vercel deployments
- Code reviews
5. Custom Agent
Full X402 capabilities - build anything!
🎯 Features
Multi-Provider AI
// Automatically uses best provider MODEL_PROVIDER=gemini // or openai, anthropic, xai GEMINI_MODEL=gemini-2.5-flash GEMINI_THINKING_ENABLED=true
### Solana Integration
// Helius RPC with DAS API
HELIUS_API_KEY=your-key
HELIUS_RPC_URL=https://mainnet.helius-rpc.com/?api-key=${HELIUS_API_KEY}
// Built-in wallet
SOLANA_PRIVATE_KEY=your-private-keyOne-Command Deployment
# Deploy to Railway
create-x402 --deploy railway
# Deploy to Vercel
create-x402 --deploy vercel
# Deploy to Render
create-x402 --deploy render📚 Usage
Interactive CLI
bun create x402Follow the prompts:
- Choose agent name
- Select agent type
- Configure API keys
- Choose deployment platform
- Deploy! 🚀
Programmatic API
import { createX402Agent } from '@elizaos/create-x402';
await createX402Agent({
name: 'my-trading-agent',
type: 'trading',
deployment: 'railway',
apiKeys: {
gemini: 'your-gemini-key',
helius: 'your-helius-key',
}
});🔑 Required API Keys
Essential (Free Tier Available)
- Google Gemini - https://aistudio.google.com/app/apikey
- Helius - https://helius.dev (Solana RPC)
Optional Providers
- OpenAI - https://platform.openai.com/api-keys
- Anthropic - https://console.anthropic.com/
- xAI Grok - https://console.x.ai
Agent-Specific
Trading Agent:
- Solana private key (for trading)
Content Creator:
- FAL AI - https://fal.ai
- Runway - https://runwayml.com
- Stability AI - https://platform.stability.ai
Social Agent:
- Twitter API - https://developer.twitter.com
- Discord Bot Token - https://discord.com/developers
- Telegram Bot Token - https://t.me/botfather
🏗️ Project Structure
my-x402-agent/
├── src/
│ ├── character.ts # Agent personality & config
│ ├── index.ts # Entry point
│ └── plugin.ts # Custom plugins
├── .env # API keys & config
├── package.json
├── tsconfig.json
└── railway.toml # Deployment config⚙️ Configuration
Environment Variables
# AI Provider
GEMINI_API_KEY=your-key
MODEL_PROVIDER=gemini
# Blockchain
HELIUS_API_KEY=your-key
SOLANA_PRIVATE_KEY=your-key
# Database (optional)
POSTGRES_URL=postgresql://...
# Logging
LOG_LEVEL=infoCharacter Customization
Edit src/character.ts:
export const character: Character = {
name: 'YourAgent',
plugins: [
'@elizaos/plugin-sql',
'@elizaos/plugin-google-genai',
'@elizaos/plugin-solana-agent-kit',
],
system: `You are a helpful AI agent...`,
bio: ['Expert in Solana', 'AI-powered'],
};🚀 Deployment
Railway (Recommended)
cd my-x402-agent
railway login
railway upVercel
cd my-x402-agent
vercel login
vercelRender
cd my-x402-agent
render login
render deployFly.io
cd my-x402-agent
flyctl auth login
flyctl deploy📊 Web Dashboard
Access the X402 Dashboard to manage your agents:
bun x402 dashboardFeatures:
- 📈 Agent analytics & metrics
- ⚙️ Configuration management
- 🔄 Real-time monitoring
- 💬 Message history
- 💰 Revenue tracking
🔧 Advanced Usage
Custom Plugins
// src/plugin.ts
import { Plugin } from '@elizaos/core';
export const myPlugin: Plugin = {
name: 'my-custom-plugin',
actions: [/* ... */],
providers: [/* ... */],
services: [/* ... */],
};Multi-Agent Setup
// src/index.ts
export const project: Project = {
agents: [
{ character: tradingAgent },
{ character: socialAgent },
{ character: contentAgent },
],
};Custom Deployment
// deploy.ts
import { X402Deployer } from '@elizaos/create-x402';
const deployer = new X402Deployer({
platform: 'railway',
projectName: 'my-agent',
envVars: { /* ... */ },
});
await deployer.deploy();🛠️ Development
Local Development
cd my-x402-agent
bun install
bun dev # Start with hot reloadBuild
bun run buildTest
bun test📖 Examples
Trading Bot
bun create x402 --template tradingContent Creator
bun create x402 --template contentSocial Agent
bun create x402 --template social🤝 Support
📄 License
MIT License - see LICENSE file for details
🙏 Credits
Built with:
- ElizaOS - AI agent framework
- Google Gemini - AI models
- Helius - Solana infrastructure
- Jupiter - Solana DEX aggregator
