Tool setup
Qwen Code CLI
Set three OPENAI_* variables and run qwen against the gateway.
Qwen Code CLI is a terminal coding agent that speaks the OpenAI API. Three environment variables point it at the gateway.
What you get
- Qwen Code running against any model on the gateway, billed to your project's sponsor budget.
Prerequisites
-
Your project access key and base URL from your project control panel —
YOUR_PROJECT_KEYandhttps://v1.opentokenmarket.dev. -
Qwen Code installed:
npm install -g @qwen-code/qwen-code
Configure
export OPENAI_BASE_URL="https://v1.opentokenmarket.dev"
export OPENAI_API_KEY="YOUR_PROJECT_KEY"
export OPENAI_MODEL="qwen3-coder-plus"
OPENAI_BASE_URLincludes/v1.- Set
OPENAI_MODELto any name from the model catalog — it does not have to be a Qwen model.
Put these in your shell profile, or in a .env file that Qwen Code loads from the project
directory.
Run
qwen
Verify
curl https://v1.opentokenmarket.dev/chat/completions \
-H "Authorization: Bearer YOUR_PROJECT_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"qwen3-coder-plus","messages":[{"role":"user","content":"ping"}]}'
Troubleshooting
404on requests —OPENAI_BASE_URLis missing the trailing/v1.401 Unauthorized—OPENAI_API_KEYisn't your project access key.model not found—OPENAI_MODELisn't on this gateway. Check the model catalog.budget has been exceeded— ask your sponsor to top up the project.
Which model names to use
OPENAI_MODEL must match the Model name column in the model catalog.