Getting Started
Get started with AgentRouter in 5 minutes
Getting Started
This guide will help you get up and running with AgentRouter in 5 minutes.
Step 1: Register an Account
- Visit the AgentRouter website
- Click the "Sign Up" button
- Register with email or GitHub/Google account
- After registration, you'll automatically receive a $1 welcome bonus
Step 2: Create an API Key
- After logging in, go to the API Keys Management page
- Click the "Create API Key" button
- Set a key name (optional)
- Configure rate limits (optional):
- Request limit - Maximum requests per time window
- Reset interval - How often to reset the counter (seconds)
- Click "Create"
- Important: Copy and save your API key - it will only be shown once!
API key format: sk-ar-xxxxxxxxxxxxxxxx
Step 3: Make Your First Request
Using Python (OpenAI SDK)
from openai import OpenAI
# Initialize client
client = OpenAI(
api_key="sk-ar-your-api-key", # Replace with your API key
base_url="https://your-agentrouter.com/v1" # Replace with your AgentRouter URL
)
# Call GPT-4
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "user", "content": "Hello!"}
]
)
print(response.choices[0].message.content)Using Node.js (OpenAI SDK)
import OpenAI from 'openai';
// Initialize client
const client = new OpenAI({
apiKey: 'sk-ar-your-api-key', // Replace with your API key
baseURL: 'https://your-agentrouter.com/v1' // Replace with your AgentRouter URL
});
// Call GPT-4
const response = await client.chat.completions.create({
model: 'gpt-4o',
messages: [
{ role: 'user', content: 'Hello!' }
]
});
console.log(response.choices[0].message.content);Using curl
curl https://your-agentrouter.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-ar-your-api-key" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'Step 4: Try Other Models
Just change the model parameter to access different providers:
# DeepSeek
response = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "Hello!"}]
)
# Moonshot
response = client.chat.completions.create(
model="moonshot-v1-8k",
messages=[{"role": "user", "content": "Hello!"}]
)Using Anthropic Format
from anthropic import Anthropic
# Initialize client
client = Anthropic(
api_key="sk-ar-your-api-key",
base_url="https://your-agentrouter.com"
)
# Call Claude
response = client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
messages=[
{"role": "user", "content": "Hello!"}
]
)
print(response.content[0].text)Check Your Balance
Each request deducts the corresponding cost from your wallet. You can:
- Visit the Wallet page to check your balance
- View detailed transaction history
- Learn about billing rates for each model
FAQ
What prefix do API keys use?
All AgentRouter API keys start with sk-ar-.
How do I top up?
Currently, you need to contact the administrator for top-ups. Self-service wallet features are in development.
Which models are supported?
See Supported Models for the complete list.
How do I handle errors?
See Troubleshooting for common errors and solutions.
Next Steps
- OpenAI Integration Guide - Detailed OpenAI SDK usage
- Anthropic Integration Guide - Detailed Anthropic SDK usage
- Supported Models - View all available models
- API Reference - Complete API documentation