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 K3 and DeepSeek V4 Flash.
Step 1: Install Qwen Code
Install Qwen Code globally via npm:Step 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.
Step 3: Choose your model
Select from Together AI’s powerful model selection:Recommended models for coding
For general development:moonshotai/Kimi-K3- Top pick for coding agents.deepseek-ai/DeepSeek-V4-Flash-0731- Fast, cost-effective coding model.
zai-org/GLM-5.3- Strong all-rounder with a large context window.deepseek-ai/DeepSeek-V4-Pro-0813- Advanced reasoning capabilities.
Example configuration
Step 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 K3 for general coding tasks.
- Switch to GLM 5.3 or DeepSeek V4 Pro for complex reasoning.
- Use DeepSeek V4 Flash 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!