AgentRouter

Using AgentRouter with Qwen Code

Complete guide to set up Qwen Code with AgentRouter API

Using AgentRouter with Qwen Code

This guide will help you configure Qwen Code (Alibaba's AI coding assistant) to use AgentRouter as your API provider.

Install Qwen Code

pnpm install -g @qwen-code/qwen-code
npm install -g @qwen-code/qwen-code
yarn global add @qwen-code/qwen-code

Configure Environment Variables

Set the environment variables to use AgentRouter's OpenAI-compatible API:

# Set your AgentRouter API key (get it from https://agentrouter.org/console/token)
export OPENAI_API_KEY="sk-xxx"

# Set AgentRouter's API base URL
export OPENAI_BASE_URL="https://agentrouter.org/v1"

# Optional: Set the model (gpt-5, deepseek-v3.1, deepseek-v3.2, etc.)
export OPENAI_MODEL="gpt-5"
# Set your AgentRouter API key (get it from https://agentrouter.org/console/token)
$env:OPENAI_API_KEY="sk-xxx"

# Set AgentRouter's API base URL
$env:OPENAI_BASE_URL="https://agentrouter.org/v1"

# Optional: Set the model (gpt-5, deepseek-v3.1, deepseek-v3.2, etc.)
$env:OPENAI_MODEL="gpt-5"
# Set your AgentRouter API key (get it from https://agentrouter.org/console/token)
set OPENAI_API_KEY="sk-xxx"

# Set AgentRouter's API base URL
set OPENAI_BASE_URL="https://agentrouter.org/v1"

# Optional: Set the model (gpt-5, deepseek-v3.1, deepseek-v3.2, etc.)
set OPENAI_MODEL="gpt-5"

Important

Make sure to replace sk-xxx with your actual AgentRouter API token. Get your API key from AgentRouter Console.

Launch Qwen Code

After configuring the environment variables, navigate to your project directory and start Qwen Code:

# Navigate to your project directory
cd my-project

# Launch Qwen Code
qwen

Persist Configuration

Add the environment variables to your shell configuration file to avoid setting them manually each time:

Add to ~/.bashrc or ~/.zshrc:

export OPENAI_API_KEY="sk-xxx"
export OPENAI_BASE_URL="https://agentrouter.org/v1"
export OPENAI_MODEL="gpt-5"

Add to your PowerShell profile ($PROFILE):

$env:OPENAI_API_KEY="sk-xxx"
$env:OPENAI_BASE_URL="https://agentrouter.org/v1"
$env:OPENAI_MODEL="gpt-5"

Set environment variables permanently via System Properties or use a batch script:

set OPENAI_API_KEY="sk-xxx"
set OPENAI_BASE_URL="https://agentrouter.org/v1"
set OPENAI_MODEL="gpt-5"

Available Models

ModelDescription
gpt-5Latest GPT model
deepseek-v3.1DeepSeek V3.1 model
deepseek-v3.2DeepSeek V3.2 model
glm-4.5GLM 4.5 model
glm-4.6GLM 4.6 model
Ctrl+I
AgentRouter AI
English

How can I help?

Ask me about configuration, installation, or specific features.