Nbility logoNbility Docs

Search documentation

Search guides and API reference content

Qwen Code supports OpenAI-compatible providers. Recent versions recommend modelProviders and envKey; legacy security.auth.apiKey and security.auth.baseUrl fields are being removed. See the official model provider guide.

Install

Official installer for macOS and Linux:

bash -c "$(curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh)" -s --source website

Or use npm:

npm install -g @qwen-code/qwen-code@latest

Add this to ~/.qwen/settings.json:

{
  "modelProviders": {
    "openai": {
      "protocol": "openai",
      "models": [
        {
          "id": "gpt-5.4",
          "name": "GPT-5.4 via Nbility",
          "baseUrl": "https://api.nbility.ai/v1",
          "envKey": "NBILITY_API_KEY"
        },
        {
          "id": "claude-sonnet-4-6",
          "name": "Claude Sonnet 4.6 via Nbility",
          "baseUrl": "https://api.nbility.ai/v1",
          "envKey": "NBILITY_API_KEY"
        }
      ]
    }
  }
}

Inject the key and start Qwen Code:

export NBILITY_API_KEY="YOUR_API_KEY"
qwen

Run /model and select a configured entry. Use Models as the source of truth for IDs.

One-off CLI configuration

For automation, pass the provider directly:

qwen --auth-type openai \
  --model gpt-5.4 \
  --openai-api-key "$NBILITY_API_KEY" \
  --openai-base-url https://api.nbility.ai/v1

Troubleshooting

  • No /model entry: validate the modelProviders.openai.models JSON structure and IDs.
  • 401: make sure envKey matches the actual environment variable.
  • 404: the Base URL must include /v1.
  • Legacy configuration stopped working: migrate from security.auth.apiKey and security.auth.baseUrl to modelProviders.

A dedicated Qwen Code key makes quotas, expiration, and usage easier to manage.