OpenAI-Compatible Endpoint
Copy
Ask AI
curl https://api.arouter.com/v1/chat/completions \
-H "Authorization: Bearer lr_live_xxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Switch Provider
Copy
Ask AI
# Anthropic via OpenAI-compatible endpoint
curl https://api.arouter.com/v1/chat/completions \
-H "Authorization: Bearer lr_live_xxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4-20250514",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Streaming
Copy
Ask AI
curl https://api.arouter.com/v1/chat/completions \
-H "Authorization: Bearer lr_live_xxxx" \
-H "Content-Type: application/json" \
-N \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Write a poem."}],
"stream": true
}'
The
-N flag disables output buffering so you see tokens as they arrive.Anthropic Native Endpoint
Copy
Ask AI
curl https://api.arouter.com/v1/messages \
-H "X-Api-Key: lr_live_xxxx" \
-H "Content-Type: application/json" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-sonnet-4-20250514",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello!"}]
}'
Gemini Native Endpoint
Copy
Ask AI
curl "https://api.arouter.com/v1beta/models/gemini-2.0-flash:generateContent?key=lr_live_xxxx" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"parts": [{"text": "Hello!"}]}]
}'
List Models
Copy
Ask AI
curl https://api.arouter.com/v1/models \
-H "Authorization: Bearer lr_live_xxxx"
Embeddings
Copy
Ask AI
curl https://api.arouter.com/v1/embeddings \
-H "Authorization: Bearer lr_live_xxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/text-embedding-3-small",
"input": "The quick brown fox"
}'
Key Management
Use a management key (lr_mgmt_) to manage API keys.
Create API Key
Copy
Ask AI
curl -X POST https://api.arouter.com/api/v1/keys \
-H "Authorization: Bearer lr_mgmt_xxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "backend-service",
"allowed_providers": ["openai", "anthropic"],
"limit": 150,
"limit_reset": "monthly"
}'
List API Keys
Copy
Ask AI
curl https://api.arouter.com/api/v1/keys \
-H "Authorization: Bearer lr_mgmt_xxxx"
Update API Key
Copy
Ask AI
curl -X PATCH https://api.arouter.com/api/v1/keys/KEY_HASH \
-H "Authorization: Bearer lr_mgmt_xxxx" \
-H "Content-Type: application/json" \
-d '{"disabled": true}'
Delete API Key
Copy
Ask AI
curl -X DELETE https://api.arouter.com/api/v1/keys/KEY_HASH \
-H "Authorization: Bearer lr_mgmt_xxxx"