Qwen Code
Connect Qwen Code to APIClaw with OpenAI-compatible environment variables or settings.json.
Prerequisites
- Create an API key in the API Keys dashboard.
- Copy a full model ID from the model hub.
Quick configure with env vars
export OPENAI_API_KEY="sk-your-apiclaw-key"
export OPENAI_BASE_URL="https://apiclaw.biz/v1"
export OPENAI_MODEL="YOUR_MODEL_ID"You can also place the same variables in ~/.qwen/.env or a project .qwen/.env.
Configure ~/.qwen/settings.json
Custom providers live in an array under modelProviders.openai, and envKey names the environment variable holding your key rather than the key itself:
{
"security": { "auth": { "selectedType": "openai" } },
"model": { "name": "YOUR_MODEL_ID" },
"modelProviders": {
"openai": [
{
"id": "YOUR_MODEL_ID",
"name": "APIClaw",
"envKey": "APICLAW_API_KEY",
"baseUrl": "https://apiclaw.biz/v1"
}
]
}
}The security.auth.selectedType and model.name blocks matter: a provider entry alone does not select the auth type, so without them Qwen Code quietly starts on its built-in model. You can set the same thing on first run with /auth → Third-party Providers → OpenAI-compatible.
Put the key itself in ~/.qwen/.env as APICLAW_API_KEY=sk-your-apiclaw-key, and restart the CLI after editing settings.json; it is read at startup. Do not prefix the id with openai/.
| Setting | Value |
|---|---|
| Base URL | https://apiclaw.biz/v1 |
| API Key | Your APIClaw API key |
| Model | Full model ID from the model hub |
Verify
Run a simple coding task in Qwen Code, then confirm the request in logs.
Troubleshooting
Use OpenAI-compatible auth mode, not DashScope-only mode. The DashScope compatible URL shape is different from APIClaw's plain /v1.