Legion CLI supports 500+ AI models with intelligent selection based on task requirements.
Best for complex coding tasks, architecture, and detailed analysis:
| Model | Provider | Strengths |
|---|---|---|
| Claude 3.5 Sonnet | Anthropic | Coding, analysis, long context |
| GPT-4o | OpenAI | General purpose, fast |
| Gemini 1.5 Pro | Long context, multimodal | |
| Claude 3 Opus | Anthropic | Reasoning, complex tasks |
Best for simple tasks, titles, and quick operations:
| Model | Provider | Strengths |
|---|---|---|
| Claude 3.5 Haiku | Anthropic | Fast, cheap |
| GPT-4o-mini | OpenAI | Fast, cost-effective |
| Gemini 1.5 Flash | Ultra-fast |
Best for math, logic, and complex reasoning:
| Model | Provider | Strengths |
|---|---|---|
| o1 | OpenAI | Step-by-step reasoning |
| Claude 3 Opus | Anthropic | Deep analysis |
| Task | Recommended Model |
|---|---|
| Code generation | Claude 3.5 Sonnet, GPT-4o |
| Code review | Claude 3.5 Sonnet |
| Bug fixing | Claude 3.5 Sonnet, GPT-4o |
| Refactoring | Claude 3.5 Sonnet |
| Documentation | Claude 3.5 Haiku, GPT-4o-mini |
| Testing | Claude 3.5 Haiku |
| Architecture | Claude 3 Opus, o1 |
| Quick edits | Claude 3.5 Haiku |
| Context | Models |
|---|---|
| Small (< 10K tokens) | Any model |
| Medium (10K-100K) | Claude 3.5, GPT-4o |
| Large (100K-200K) | Claude 3.5, Gemini 1.5 |
| Huge (200K+) | Gemini 1.5 (1M context) |
| Cost | Models |
|---|---|
| Low | Haiku, GPT-4o-mini, Flash |
| Medium | Claude 3.5 Sonnet, GPT-4o |
| High | Claude 3 Opus, o1 |
{
"model": "anthropic/claude-sonnet-4"
}
For simple tasks like title generation:
{
"small_model": "anthropic/claude-haiku-4"
}
For background tasks:
{
"subagent_model": "anthropic/claude-sonnet-4"
}
# Use specific model
legion run "implement feature" --model openai/gpt-4o
# Use small model for quick task
legion run "generate title" --model anthropic/claude-haiku-4
Legion automatically selects models based on:
Models that support image input:
Models that support function calling:
All modern models support streaming.
Models with reliable JSON output:
{
"providers": {
"custom": {
"type": "openai",
"baseUrl": "https://your-api.com/v1",
"apiKey": "env:CUSTOM_API_KEY",
"models": ["model-1", "model-2"]
}
}
}
{
"models": {
"custom-model": {
"provider": "custom",
"id": "model-1",
"name": "Custom Model",
"capabilities": ["tools", "streaming"],
"contextWindow": 128000
}
}
}
Track token usage:
legion usage show
legion usage show --model anthropic/claude-sonnet-4
Set cost limits:
{
"providers": {
"anthropic": {
"costLimit": {
"daily": 10.00,
"monthly": 100.00
}
}
}
}
Configure fallbacks for cost optimization:
{
"model": "anthropic/claude-sonnet-4",
"fallback": {
"model": "anthropic/claude-haiku-4",
"onCostLimit": true
}
}