# Qwen Code

Project-scoped local CLI configuration.

Source: https://zrelay.net/docs/agents/coding-agents/qwen-code/

## Manual setup

1. Check qwen --version. Merge the JSON below into the project .qwen/settings.json, appending modelProviders.openai entries and preserving OAuth credentials, other models and preferences. Do not replace ~/.qwen/settings.json.

2. Use a GPT key for gpt-6.1-sol Chat Completions in Flex/Prime. Enter ZRELAY_API_KEY locally using hidden input, export it in the launch process and run qwen from the project. Use /model to inspect the exact Zrelay GPT 6.1 Sol entry.

3. Use envKey, an array at modelProviders.openai, and generationConfig inside that entry. Model name and baseUrl are paired in project scope. Do not invent apiKeyEnvVar, a models object or $version.

4. A model-only CLI flag can select the first duplicate ID; do not use it as a universal shortcut. /model persists in the nearest scope defining modelProviders. Global configuration requires a deliberate user-scope entry and changes persisted selection.

## Configuration and commands

```
{
  "model": {
    "name": "gpt-6.1-sol",
    "baseUrl": "https://api.zrelay.net/v1"
  },
  "security": { "auth": { "selectedType": "openai" } },
  "modelProviders": {
    "openai": [
      {
        "id": "gpt-6.1-sol",
        "name": "Zrelay GPT 6.1 Sol",
        "envKey": "ZRELAY_API_KEY",
        "baseUrl": "https://api.zrelay.net/v1",
        "wireApi": "chat-completions",
        "generationConfig": {
          "contextWindowSize": 128000,
          "samplingParams": { "max_tokens": 4096 }
        }
      }
    ]
  }
}
```

## Alternative: ask an AI assistant

Copy this complete prompt into your coding assistant. It describes configuration work; installation and paid tests need your authorization.

```
Configure my locally installed Qwen Code for Zrelay. Detect OS and Qwen Code version; inspect the matching official configuration documentation and https://keys.zrelay.net/api/catalog. Ask before installing/upgrading anything or making any paid inference request. Preserve existing settings, model entries and OAuth credentials. Merge a project-scoped .qwen/settings.json provider entry using modelProviders.openai[], id gpt-6.1-sol, name Zrelay GPT 6.1 Sol, envKey ZRELAY_API_KEY, baseUrl https://api.zrelay.net/v1, wireApi chat-completions and generationConfig.samplingParams.max_tokens 4096. In that project scope set security.auth.selectedType=openai and model.name=gpt-6.1-sol paired with model.baseUrl=https://api.zrelay.net/v1. Confirm the model is currently enabled for /v1/chat/completions and my key's provider/pool; respect current input/output limits. Never read, print, request in chat, or commit my actual key; provide local hidden-entry instructions. Launch without model overrides; /model can inspect the exact Zrelay route. Do not rely on model-only CLI selection when duplicate IDs exist. Validate configuration statically without inference. Report inspected settings, any unsupported version fields and untested streaming/tool behavior; do not claim a successful connection without an authorized runtime test.
```

## Limits and verification

OPENAI_MODEL/QWEN_MODEL can override selection. Respect 128000 input/4096 output. No minimum release is asserted without checking the installed schema; runtime streaming and tools remain untested.

These recipes were reviewed against documentation and public catalog data. No client installation, authenticated request, paid inference, streaming or tool loop was executed. Validate configuration first; a later short text test does not establish complete agent compatibility.

Recheck the [live catalog](https://keys.zrelay.net/api/catalog) and your key’s provider/pool. The reviewed examples have 128000 input and 4096 output maxima unless a client limitation above prevents controlling the request. Never print, log or commit credentials.

## Official sources

Documentation checked 2026-11-09; mutable sources can differ from your installed version.

[https://keys.zrelay.net/api/catalog](https://keys.zrelay.net/api/catalog)

[https://qwenlm.github.io/qwen-code-docs/en/users/configuration/model-providers/](https://qwenlm.github.io/qwen-code-docs/en/users/configuration/model-providers/)

[https://qwenlm.github.io/qwen-code-docs/en/users/configuration/auth/](https://qwenlm.github.io/qwen-code-docs/en/users/configuration/auth/)

[https://qwenlm.github.io/qwen-code-docs/en/users/configuration/settings/](https://qwenlm.github.io/qwen-code-docs/en/users/configuration/settings/)

[https://raw.githubusercontent.com/QwenLM/qwen-code/main/packages/cli/src/utils/modelConfigUtils.ts](https://raw.githubusercontent.com/QwenLM/qwen-code/main/packages/cli/src/utils/modelConfigUtils.ts)

[https://keys.zrelay.net/api/catalog](https://keys.zrelay.net/api/catalog)
