Qwen Code

Connect Qwen Code to APIClaw with OpenAI-compatible environment variables or settings.json.

Prerequisites

  1. Create an API key in the API Keys dashboard.
  2. Copy a full model ID from the model hub.

Quick configure with env vars

bash
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:

json
{
  "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/.

SettingValue
Base URLhttps://apiclaw.biz/v1
API KeyYour APIClaw API key
ModelFull 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.