[KongchangAI]
Product通义灵码CLI / Qwen Code 2.0

Qwen Code

Qwen Code is a command-line AI coding assistant released by Alibaba Cloud, developed on the Gemini CLI architecture and integrated with the Qwen series of large language models. Targeting developers, it supports programming assistance tasks including code generation, completion, debugging, and codebase comprehension. It features large context window handling and enables interactive dialogue with codebases directly from a terminal environment.

Core Facts

Timeline (last 90 days)

Oct 18

Setting maxRetries to 0 in generationConfig removes SDK-layer retries, so an endpoint that keeps returning 503 receives only 7 requests (about 74 seconds) before ending with [API Error: 503 upstream busy] and exit code 1.

Unverified50%
Oct 18

Running qwen -p "Say hi" non-interactively sends two requests: the first is the answer request (the system prompt is about 30,553 characters, plus a skills and memory paths block of about 10,963 characters and six tool definitions); the second is the managed memory extraction subagent request, used to update the memory files under ~/.qwen/.

Unverified50%
Oct 18

Managed auto memory can be turned off by setting "memory": {"enableManagedAutoMemory": false, "enableManagedAutoDream": false} in the configuration, after which qwen -p "Say hi" sends only one request.

Unverified50%
Oct 18

When the server keeps returning 503, Qwen Code's default retry behavior is: the OpenAI SDK retries three times per attempt (backoff of about 0.4, 0.9, and 1.8 seconds), and Qwen Code's own retry loop repeats these groups at intervals of about 2, 3, 7, 14, 30, and 30 seconds, so seven groups totaling 28 requests take about 107 seconds, after which the CLI prints Retrying in 60s (attempt 1/10) and starts a new round.

Unverified50%
Oct 18

Qwen Code is a terminal coding agent launched by the Tongyi team, originally forked from Gemini CLI and switched to the OpenAI Chat Completions protocol.

Unverified50%
Oct 18

Using the three environment variables OPENAI_API_KEY, OPENAI_BASE_URL and OPENAI_MODEL, Qwen Code can be configured to connect to a custom OpenAI-compatible API without a configuration file.

Unverified50%
Oct 18

Qwen Code uses the official OpenAI Node SDK and appends /chat/completions after OPENAI_BASE_URL, so the base URL must retain the /v1 path, otherwise most gateways return 404.

Unverified50%
Oct 18

When Qwen Code is configured via environment variables, each request carries max_tokens: 32000 by default.

Unverified50%
Oct 18

When the API key is wrong, Qwen Code sends only one request, reports [API Error: 401 Invalid API key], and exits with code 1 without retrying.

Unverified50%
Oct 18

For daily use, Qwen Code recommends configuring modelProviders in ~/.qwen/settings.json, with key fields including id, name, envKey, baseUrl, and a nested generationConfig (containing timeout, maxRetries, contextWindowSize and samplingParams).

Unverified50%

7 more timeline events

All Facts (18)

Verified

Qwen Code is a fork of Gemini CLI that replaces the underlying model with Alibaba Cloud's Qwen series.

65%
Unverified

Setting maxRetries to 0 in generationConfig removes SDK-layer retries, so an endpoint that keeps returning 503 receives only 7 requests (about 74 seconds) before ending with [API Error: 503 upstream busy] and exit code 1.

50%
Unverified

Running qwen -p "Say hi" non-interactively sends two requests: the first is the answer request (the system prompt is about 30,553 characters, plus a skills and memory paths block of about 10,963 characters and six tool definitions); the second is the managed memory extraction subagent request, used to update the memory files under ~/.qwen/.

50%
Unverified

Managed auto memory can be turned off by setting "memory": {"enableManagedAutoMemory": false, "enableManagedAutoDream": false} in the configuration, after which qwen -p "Say hi" sends only one request.

50%
Unverified

When the server keeps returning 503, Qwen Code's default retry behavior is: the OpenAI SDK retries three times per attempt (backoff of about 0.4, 0.9, and 1.8 seconds), and Qwen Code's own retry loop repeats these groups at intervals of about 2, 3, 7, 14, 30, and 30 seconds, so seven groups totaling 28 requests take about 107 seconds, after which the CLI prints Retrying in 60s (attempt 1/10) and starts a new round.

50%
Unverified

Qwen Code is a terminal coding agent launched by the Tongyi team, originally forked from Gemini CLI and switched to the OpenAI Chat Completions protocol.

50%
Unverified

Using the three environment variables OPENAI_API_KEY, OPENAI_BASE_URL and OPENAI_MODEL, Qwen Code can be configured to connect to a custom OpenAI-compatible API without a configuration file.

50%
Unverified

Qwen Code uses the official OpenAI Node SDK and appends /chat/completions after OPENAI_BASE_URL, so the base URL must retain the /v1 path, otherwise most gateways return 404.

50%
Unverified

When Qwen Code is configured via environment variables, each request carries max_tokens: 32000 by default.

50%
Unverified

When the API key is wrong, Qwen Code sends only one request, reports [API Error: 401 Invalid API key], and exits with code 1 without retrying.

50%
Unverified

For daily use, Qwen Code recommends configuring modelProviders in ~/.qwen/settings.json, with key fields including id, name, envKey, baseUrl, and a nested generationConfig (containing timeout, maxRetries, contextWindowSize and samplingParams).

50%
Unverified

Keys under modelProviders must be real protocol names (openai, anthropic, gemini, vertex-ai); self-invented keys are skipped with a warning unless mapped in a top-level providerProtocol block.

50%
Unverified

The key pointed to by envKey can be placed in a .env file in the project directory or in ~/.qwen/.env; if neither exists, Qwen Code stops before sending the request and indicates that the API key is missing.

50%
Unverified

After configuring modelProviders, the request body becomes temperature: 0.2 and max_tokens: 4096, and the default value of 32000 disappears.

50%
Unverified

In Qwen Code, when a modelProviders entry is selected, its generationConfig replaces the top-level configuration of the same name wholesale, and samplingParams, customHeaders, and extra_body are all replaced as whole objects rather than merged.

50%
Unverified

Runtimes supported by SpaceApp include OpenCode, Codex, Gemini, Qwen Code, Kimi Code, Grok Build, and an experimental DeepSeek CLI; Claude Code has a separate, owner-initiated installation process.

50%
Unverified

GitSpawn affects seven coding agents, including Claude Code, OpenAI Codex, Cursor, Grok Build, Goose, Hermes Agent, and Qwen Code, with eight findings reported in total.

50%
Unverified

Qwen Code 分支项目允许在 settings 中设置 tools.approvalMode 为 yolo,依赖文件夹信任机制提供保护,与 Gemini CLI 的保守路线不同。

50%

Source Articles