Qwen Code (gateway)
Route Qwen Code ’s LLM calls through the Respan gateway for automatic logging, caching, and model switching. Qwen Code supports any OpenAI-compatible endpoint, so only your RESPAN_API_KEY is needed.
Paste this into your coding agent:
Help me set up the Respan gateway with the Qwen Code integration.
Follow https://www.respan.ai/docs/integrations/gateway/qwen-code.mdSetup
Install Qwen Code
npm install -g @qwen-code/qwen-code@latestSet environment variables
Add to your shell profile (.bashrc, .zshrc, or PowerShell $PROFILE), or to ~/.qwen/.env:
export OPENAI_API_KEY="YOUR_RESPAN_API_KEY"
export OPENAI_BASE_URL="https://gateway.respan.ai"
export OPENAI_MODEL="gpt-4o"Then tell Qwen Code to use the OpenAI-compatible auth type without the interactive /auth prompt. Add to ~/.qwen/settings.json:
{
"security": {
"auth": {
"selectedType": "openai"
}
}
}No separate provider key needed. The Respan gateway handles provider authentication.
Run Qwen Code
qwenFor a one-shot, non-interactive run:
qwen -p "your prompt"All LLM calls now route through Respan.
Switch models
Change OPENAI_MODEL to use any of the 1000+ models available through the gateway.
export OPENAI_MODEL="gpt-4o"
# export OPENAI_MODEL="claude-sonnet-4-5-20250929"
# export OPENAI_MODEL="gemini/gemini-3.5-flash"See the full model list .