Why use Qwen Code with Together AI?
- Model Choice: Access to a wide variety of models beyond Qwen models
- Transparent Pricing: Clear token-based pricing with no surprises
- Enterprise Control: Use your own API keys and have full control over usage
- Specialized Models: Access to coding-specific models like Kimi K2.7 Code and Qwen3 Coder Next
1. Install Qwen Code
Install Qwen Code globally via npm:2. Configure Together AI
Instead of using the default Qwen OAuth, you’ll configure Qwen Code to use Together AI’s OpenAI-compatible API.Method 1: Environment variables (recommended)
Set up your environment variables:Method 2: Project .env file
Create a.env file in your project root:
Get your Together AI credentials
- API Key: Get your Together AI API key
- Base URL: Use
https://api.together.ai/v1for Together AI - Model: Choose from Together AI’s model catalog
3. Choose your model
Select from Together AI’s powerful model selection:Recommended models for coding
For General Development:moonshotai/Kimi-K2.7-Code- Purpose-built for coding agents.Qwen/Qwen3-Coder-Next-FP8- Fast, cost-effective coding model.
zai-org/GLM-5.2- Strong all-rounder with a large context window.deepseek-ai/DeepSeek-V4-Pro- Advanced reasoning capabilities.
Example configuration
4. Launch and use Qwen Code
Navigate to your project and start Qwen Code:Advanced tips
Token optimization
- Use
/compressto maintain context while reducing token usage - Set appropriate session limits based on your Together AI plan
- Monitor usage with
/statscommand
Model selection strategy
- Use Kimi K2.7 Code for general coding tasks.
- Switch to GLM 5.2 or DeepSeek V4 Pro for complex reasoning.
- Use Qwen3 Coder Next for faster, cost-effective operations.
Context window management
Qwen Code is designed to handle large codebases beyond traditional context limits:- Automatically chunks and processes large files
- Maintains conversation context across multiple API calls
- Optimizes token usage through intelligent compression
Troubleshooting
Common issues
Authentication Errors:- Verify your Together AI API key is correct
- Ensure
OPENAI_BASE_URLis set tohttps://api.together.ai/v1 - Check that your API key has sufficient credits
- Verify the model name exists in Together AI’s catalog
- Ensure the model name is exactly as listed (case-sensitive)
Getting started checklist
- ✅ Install Node.js 20+ and Qwen Code
- ✅ Get your Together AI API key
- ✅ Set environment variables or create
.envfile - ✅ Choose your preferred model from Together AI
- ✅ Launch Qwen Code in your project directory
- ✅ Start coding with AI assistance!