Overview
The--model (or -m) option allows you to specify which AI model Qwen Code should use for the session. Different models offer different capabilities, speeds, and costs.
Syntax
Available Models
Qwen Models (Dashscope)
- qwen-coder-plus
- qwen-max
- qwen-turbo
Best for complex coding tasksSpecifications:
- Context: 256K tokens
- Quality: Highest
- Speed: Medium
- Cost: $$$
- Multi-file refactoring
- Complex algorithms
- Architecture decisions
- Large codebase navigation
OpenAI Models
When using OpenAI authentication:Anthropic Models
When using Anthropic authentication:Basic Usage
Specify Model at Launch
With Other Options
Model Selection Strategy
For Development Tasks
For Different Project Sizes
Model Comparison
| Model | Context | Speed | Quality | Cost | Best For |
|---|---|---|---|---|---|
| qwen-coder-plus | 256K | ⭐⭐ | ⭐⭐⭐ | $$$ | Complex coding |
| qwen-max | 200K | ⭐⭐ | ⭐⭐ | $$ | General purpose |
| qwen-turbo | 128K | ⭐⭐⭐ | ⭐⭐ | $ | Quick tasks |
| gpt-4-turbo | 128K | ⭐⭐ | ⭐⭐⭐ | $$$$ | Advanced reasoning |
| claude-3-opus | 200K | ⭐⭐ | ⭐⭐⭐ | $$$$ | Complex analysis |
| claude-3-haiku | 200K | ⭐⭐⭐ | ⭐⭐ | $ | Fast responses |
Configuration
Via Settings File
Set a default model:Via Environment Variable
Project-Specific Defaults
Precedence Order
- Command-line
--modelflag (highest priority) - Environment variable
QWEN_MODEL - Project settings
.qwen/settings.json - Global settings
~/.qwen/settings.json(lowest priority)
Advanced Usage
Switch Models Mid-Session
In interactive mode:Model-Specific Prompts
Cost Optimization
Custom Models
OpenAI-Compatible APIs
Use custom or self-hosted models:Configuration for Custom Models
Model Capabilities
Tool Support
All models support Qwen Code tools: ✅ File operations (read, write, edit)✅ Shell commands
✅ Code search
✅ Git operations
✅ Web search
Feature Comparison
| Feature | qwen-coder-plus | qwen-max | qwen-turbo |
|---|---|---|---|
| Multi-file edits | Excellent | Good | Basic |
| Code generation | Excellent | Good | Good |
| Explanations | Excellent | Excellent | Good |
| Debugging | Excellent | Good | Basic |
| Speed | Medium | Medium | Fast |
| Context size | 256K | 200K | 128K |
Real-World Examples
Web Development
Data Science
DevOps
Performance Tips
Match Model to Task
Use Fast Models for Iteration
Monitor Token Usage
Troubleshooting
Model Not Available
-
Check authentication:
-
Verify model name:
-
Check API access:
Authentication Issues
Invalid Model Name
- ✅
qwen-coder-plus(notqwen-coder) - ✅
qwen-turbo(notqwen-fast) - ✅
qwen-max(notqwen-large)
Best Practices
Start Fast, Scale Up
Start Fast, Scale Up
Begin with fast models, upgrade as needed:
Project Defaults
Project Defaults
Set appropriate defaults per project:
Cost Awareness
Cost Awareness
Monitor costs and adjust:
Context Window Management
Context Window Management
Choose models with appropriate context:
See Also
/model Command
Switch models in interactive mode
Authentication
Set up model provider authentication
Model Comparison
Detailed model benchmarks and comparison
Configuration
Configure default models and settings
