Quickstart
Get started with AssistantRouter in under 5 minutes.
Quickstart
Get your first AI assistant up and running in under 5 minutes.
Create an Account
Sign up for AssistantRouter at app.assistantrouter.com. You'll be guided through:
- Creating your workspace
- Adding initial credits to your wallet
- Generating your first API key
Get Your API Key
Navigate to Settings > API Keys in the dashboard and create a new key. Your API key will look like:
sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxKeep your API key secure! Never expose it in client-side code or public repositories.
Create an Assistant
Assistants are pre-configured AI agents with custom instructions, model settings, and optional tools (web search, RAG).
- Go to Assistants in the sidebar
- Click New Assistant
- Configure:
- Name: My First Assistant
- System Prompt: You are a helpful customer support agent.
- Model: Claude Sonnet 4.5 or GPT-5.1
- Click Create
Copy the Assistant ID (a UUID like 550e8400-e29b-41d4-a716-446655440000).
Assistants are managed through the dashboard, not the API. This keeps your configuration secure and allows for easy versioning.
Install the SDK
Use the official OpenAI SDK - AssistantRouter is fully compatible.
npm install openaipnpm add openaiyarn add openaipip install openaiMake Your First Request
Use your assistant ID to make a chat completion request:
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://api.assistantrouter.com/v1',
apiKey: process.env.ASSISTANTROUTER_API_KEY,
});
async function main() {
const response = await client.chat.completions.create({
// @ts-ignore - assistant_id is our extension
assistant_id: 'your-assistant-uuid',
messages: [
{ role: 'user', content: 'What is AssistantRouter?' },
],
});
console.log(response.choices[0].message.content);
}
main();import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.assistantrouter.com/v1",
api_key=os.environ["ASSISTANTROUTER_API_KEY"],
)
response = client.chat.completions.create(
extra_body={"assistant_id": "your-assistant-uuid"},
messages=[
{"role": "user", "content": "What is AssistantRouter?"},
],
)
print(response.choices[0].message.content)curl https://api.assistantrouter.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ASSISTANTROUTER_API_KEY" \
-d '{
"assistant_id": "your-assistant-uuid",
"messages": [
{"role": "user", "content": "What is AssistantRouter?"}
]
}'When using an assistant, your system prompt, model, and tools are automatically applied. Alternatively, you can use the API in direct mode by providing model instead of assistant_id for a pure OpenAI-compatible experience.
Enable Streaming
For real-time responses, enable streaming:
const stream = await client.chat.completions.create({
// @ts-ignore
assistant_id: 'your-assistant-uuid',
messages: [{ role: 'user', content: 'Tell me a story.' }],
stream: true,
});
for await (const chunk of stream) {
const content = chunk.choices[0]?.delta?.content || '';
process.stdout.write(content);
}What's Next?
Now that you have the basics, explore more features:
- Chat Completions - Full API reference with all options
- Conversations - Manage conversation history
- RAG Guide - Add document knowledge to your assistant
- Tools Guide - Enable web search and function calling
- Billing Guide - Understand the wallet system
Configuration Options
You can override assistant settings per-request:
const response = await client.chat.completions.create({
// @ts-ignore
assistant_id: 'your-assistant-uuid',
messages: [{ role: 'user', content: 'Hello!' }],
// Optional overrides
model: 'openai/gpt-5.1', // Override the model
temperature: 0.7, // Override temperature
max_tokens: 1000, // Limit output length
// Tracking
user_id: 'user_123', // Track by user
conversation_id: 'conv_abc', // Continue a conversation
});