Skip to content

Add modelProviders configuration guide to Qwen Code user guide (+177 lines)#12

Merged
wenshao merged 4 commits into
mainfrom
feat/qwen-code-model-providers
Mar 29, 2026
Merged

Add modelProviders configuration guide to Qwen Code user guide (+177 lines)#12
wenshao merged 4 commits into
mainfrom
feat/qwen-code-model-providers

Conversation

@wenshao

@wenshao wenshao commented Mar 28, 2026

Copy link
Copy Markdown
Owner

Summary

在 Qwen Code 用户指南中新增 modelProviders 配置章节(+177 行),覆盖自定义模型提供商的完整配置方法。

新增内容

  • ModelConfig 字段参考:id、name、envKey、baseUrl、generationConfig
  • generationConfig 字段:timeout、contextWindowSize、reasoning、samplingParams 等
  • 6 个提供商配置示例
    • DashScope(阿里云百炼编码计划)
    • DeepSeek(OpenAI 兼容)
    • OpenRouter(100+ 模型聚合)
    • Ollama(本地模型,无需付费)
    • Anthropic(Claude 系列)
    • Google Gemini
  • 多提供商组合配置:一个 settings.json 接入 5+ 提供商
  • 5 个注意事项:envKey 安全、重复 id、项目级覆盖、静默忽略、qwen-oauth 不可覆盖

来源

  • 源码:packages/core/src/models/types.ts(ModelConfig 接口)
  • 源码:packages/core/src/core/contentGenerator.ts(generationConfig)
  • 官方文档:docs/users/configuration/model-providers.md

Test plan

  • 验证 ModelConfig 字段与源码 types.ts 一致
  • 验证 DashScope baseUrl 格式正确
  • 验证 Ollama 配置可用(localhost:11434)

🤖 Generated with Claude Code

…lines)

- Full ModelConfig field reference (id, name, envKey, baseUrl, generationConfig)
- generationConfig fields (timeout, contextWindowSize, reasoning, samplingParams)
- 6 provider examples: DashScope, DeepSeek, OpenRouter, Ollama, Anthropic, Gemini
- Multi-provider combined config example
- 5 behavioral notes (envKey security, duplicate handling, project override, etc.)
- Source: packages/core/src/models/types.ts (ModelConfig interface)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@wenshao wenshao left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Qwen-Code + GLM-5.1

逐一对照 Qwen Code 源码 packages/core/src/models/types.tspackages/core/src/core/contentGenerator.ts,发现以下问题:

1. envKey 标注为「必须」,实际为可选 ❌

源码中 envKey?: stringoptional 字段(注意问号)。某些 authType(如 qwen-oauth)不需要 API Key,因此 envKey 并非必填。文档标注为「是」会造成误导。

2. ModelConfig 表缺少 capabilities 字段 ❌

源码定义了 capabilities?: ModelCapabilities(含 vision?: boolean),PR 完全遗漏了该字段。

3. generationConfig 表只列了 7/11 个字段 ⚠️

源码 ModelGenerationConfig = Pick<ContentGeneratorConfig, ...> 包含 11 个字段,PR 遗漏了 4 个:

  • retryErrorCodes: number[] — 自定义触发重试的 HTTP 状态码
  • schemaCompliance: 'auto' | 'openapi_30' — Schema 合规模式
  • extra_body: Record<string, unknown> — 额外请求体参数(仅 OpenAI 兼容)
  • modalities: InputModalities — 输入模态控制(如 { image: true }

4. reasoning 描述不完整 ⚠️

PR 写为 { effort: "low"|"medium"|"high" },但源码还支持 budget_tokens?: number 参数,用于控制推理 token 预算。

5. 源码引用不完整 ⚠️

PR 描述中提到了 contentGenerator.ts 作为 generationConfig 的来源,但文档正文的源码引用只列了 types.ts。建议补充 contentGenerator.ts 的引用。


Review by Qwen-Code + GLM-5.1 | 基于源码验证

Comment thread docs/guides/qwen-code-user-guide.md Outdated
| `id` | string | **是** | 发送给 API 的模型 ID(如 `"gpt-4o"`、`"deepseek-chat"`) |
| `name` | string | 否 | UI 显示名称(默认为 id) |
| `description` | string | 否 | 模型描述 |
| `envKey` | string | **是** | 存放 API Key 的**环境变量名**(如 `"OPENAI_API_KEY"`) |

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Qwen-Code + GLM-5.1] envKey 标注为「必须」(是),但源码 packages/core/src/models/types.tsenvKey?: stringoptional 字段(注意 ? 问号)。某些 authType(如 qwen-oauth)不需要 API Key。应改为「否」并补充说明哪些场景下需要/不需要。

源码原文:

/** Environment variable name to read API key from */
envKey?: string;

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修正:envKey "必须" → "否",补充说明"自定义提供商通常需要,qwen-oauth 不需要"。源码确认 envKey?: string(optional)。

Claude Opus 4.6

| `description` | string | 否 | 模型描述 |
| `envKey` | string | **是** | 存放 API Key 的**环境变量名**(如 `"OPENAI_API_KEY"`) |
| `baseUrl` | string | 否 | API 端点覆盖(自定义提供商必须) |
| `generationConfig` | object | 否 | 生成参数(见下方) |

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Qwen-Code + GLM-5.1] ModelConfig 字段表缺少 capabilities 字段。源码定义了:

capabilities?: ModelCapabilities;
// where ModelCapabilities = { vision?: boolean }

建议在 generationConfig 行之后补充一行:
| capabilities | object | 否 | 模型能力标记(如 { vision: true }),预留字段 |

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已补充 capabilities 字段({ vision: true },预留字段)。

Claude Opus 4.6

Comment thread docs/guides/qwen-code-user-guide.md Outdated
| `baseUrl` | string | 否 | API 端点覆盖(自定义提供商必须) |
| `generationConfig` | object | 否 | 生成参数(见下方) |

**generationConfig 常用字段**:

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Qwen-Code + GLM-5.1] generationConfig 表遗漏了 4 个字段(源码共 11 个,PR 只列了 7 个):

遗漏字段 类型 说明
retryErrorCodes number[] 自定义触发重试的 HTTP 状态码
schemaCompliance 'auto' | 'openapi_30' Schema 合规模式
extra_body Record<string, unknown> 额外请求体参数(仅 OpenAI 兼容)
modalities InputModalities 输入模态控制(如 { image: true }

源码定义:

type ModelGenerationConfig = Pick<ContentGeneratorConfig,
  | 'samplingParams' | 'timeout' | 'maxRetries' | 'retryErrorCodes'
  | 'enableCacheControl' | 'schemaCompliance' | 'reasoning'
  | 'customHeaders' | 'extra_body' | 'contextWindowSize' | 'modalities'
>;

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已补充 4 个遗漏字段(retryErrorCodes、schemaCompliance、extra_body、modalities),generationConfig 表现在覆盖全部 11/11 字段。

Claude Opus 4.6

Comment thread docs/guides/qwen-code-user-guide.md Outdated
| `maxRetries` | 速率限制重试次数 |
| `contextWindowSize` | 覆盖自动检测的上下文窗口大小 |
| `enableCacheControl` | 启用缓存控制(DashScope 提供商) |
| `reasoning` | 推理模式:`false` 或 `{ effort: "low"\|"medium"\|"high" }` |

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Qwen-Code + GLM-5.1] reasoning 描述不完整。源码支持 budget_tokens 参数,完整格式应为:

reasoning: false | { effort?: "low"|"medium"|"high", budget_tokens?: number }

budget_tokens 用于控制推理过程的 token 预算上限。建议更新表格说明。

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已补充 budget_tokens:{ effort?: "low"|"medium"|"high", budget_tokens?: number }

Claude Opus 4.6

Comment thread docs/guides/qwen-code-user-guide.md Outdated
| `id` | string | **是** | 发送给 API 的模型 ID(如 `"gpt-4o"`、`"deepseek-chat"`) |
| `name` | string | 否 | UI 显示名称(默认为 id) |
| `description` | string | 否 | 模型描述 |
| `envKey` | string | **是** | 存放 API Key 的**环境变量名**(如 `"OPENAI_API_KEY"`) |

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Qwen-Code + GLM-5.1] envKey 标注为「必须」(是),但源码 packages/core/src/models/types.tsenvKey?: stringoptional 字段(注意 ? 问号)。某些 authType(如 qwen-oauth)不需要 API Key。应改为「否」并补充说明哪些场景下需要/不需要。

源码原文:

/** Environment variable name to read API key from */
envKey?: string;

| `description` | string | 否 | 模型描述 |
| `envKey` | string | **是** | 存放 API Key 的**环境变量名**(如 `"OPENAI_API_KEY"`) |
| `baseUrl` | string | 否 | API 端点覆盖(自定义提供商必须) |
| `generationConfig` | object | 否 | 生成参数(见下方) |

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Qwen-Code + GLM-5.1] ModelConfig 字段表缺少 capabilities 字段。源码定义了:

capabilities?: ModelCapabilities;
// where ModelCapabilities = { vision?: boolean }

建议在 generationConfig 行之后补充一行:
| capabilities | object | 否 | 模型能力标记(如 { vision: true }),预留字段 |

Comment thread docs/guides/qwen-code-user-guide.md Outdated
| `baseUrl` | string | 否 | API 端点覆盖(自定义提供商必须) |
| `generationConfig` | object | 否 | 生成参数(见下方) |

**generationConfig 常用字段**:

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Qwen-Code + GLM-5.1] generationConfig 表遗漏了 4 个字段(源码共 11 个,PR 只列了 7 个):

遗漏字段 类型 说明
retryErrorCodes number[] 自定义触发重试的 HTTP 状态码
schemaCompliance "auto" | "openapi_30" Schema 合规模式
extra_body Record<string, unknown> 额外请求体参数(仅 OpenAI 兼容)
modalities InputModalities 输入模态控制(如 { image: true }

源码定义:

type ModelGenerationConfig = Pick<ContentGeneratorConfig,
  | "samplingParams" | "timeout" | "maxRetries" | "retryErrorCodes"
  | "enableCacheControl" | "schemaCompliance" | "reasoning"
  | "customHeaders" | "extra_body" | "contextWindowSize" | "modalities"
>;

Comment thread docs/guides/qwen-code-user-guide.md Outdated
| `maxRetries` | 速率限制重试次数 |
| `contextWindowSize` | 覆盖自动检测的上下文窗口大小 |
| `enableCacheControl` | 启用缓存控制(DashScope 提供商) |
| `reasoning` | 推理模式:`false` 或 `{ effort: "low"\|"medium"\|"high" }` |

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Qwen-Code + GLM-5.1] reasoning 描述不完整。源码支持 budget_tokens 参数,完整格式应为:

reasoning: false | { effort?: "low"|"medium"|"high", budget_tokens?: number }

budget_tokens 用于控制推理过程的 token 预算上限。建议更新表格说明。

@wenshao

wenshao commented Mar 28, 2026

Copy link
Copy Markdown
Owner Author

Review by Qwen-Code + GLM-5.1

逐一对照 Qwen Code 源码 packages/core/src/models/types.tspackages/core/src/core/contentGenerator.ts,发现以下问题(详见行内评论):

1. envKey 标注为「必须」,实际为可选 ❌

源码中 envKey?: stringoptional 字段(注意问号)。某些 authType(如 qwen-oauth)不需要 API Key,因此 envKey 并非必填。文档标注为「是」会造成误导。

2. ModelConfig 表缺少 capabilities 字段 ❌

源码定义了 capabilities?: ModelCapabilities(含 vision?: boolean),PR 完全遗漏了该字段。

3. generationConfig 表只列了 7/11 个字段 ⚠️

源码 ModelGenerationConfig = Pick<ContentGeneratorConfig, ...> 包含 11 个字段,PR 遗漏了 4 个:

  • retryErrorCodes: number[] — 自定义触发重试的 HTTP 状态码
  • schemaCompliance: "auto" | "openapi_30" — Schema 合规模式
  • extra_body: Record<string, unknown> — 额外请求体参数(仅 OpenAI 兼容)
  • modalities: InputModalities — 输入模态控制(如 { image: true }

4. reasoning 描述不完整 ⚠️

PR 写为 { effort: "low"|"medium"|"high" },但源码还支持 budget_tokens?: number 参数,用于控制推理 token 预算。

5. 源码引用不完整 ⚠️

PR 描述中提到了 contentGenerator.ts 作为 generationConfig 的来源,但文档正文的源码引用只列了 types.ts。建议补充 contentGenerator.ts 的引用。


Review by Qwen-Code + GLM-5.1 | 基于源码验证

1. envKey: "必须" → "否" (source: envKey?: string, optional with ?)
2. Add capabilities field to ModelConfig table ({ vision: true })
3. Add 4 missing generationConfig fields: retryErrorCodes, schemaCompliance,
   extra_body, modalities (7/11 → 11/11)
4. reasoning: add budget_tokens parameter
5. Add contentGenerator.ts to source reference

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@wenshao

wenshao commented Mar 28, 2026

Copy link
Copy Markdown
Owner Author

Round 2 Review — Qwen-Code + GLM-5.1

Claude Code 已修复上一轮全部 5 个问题 ✅。逐项验证后,发现以下新/遗留问题:

✅ 已正确修复

  1. envKey 必须→否 ✅
  2. capabilities 字段已补充 ✅
  3. generationConfig 现为 11/11 字段 ✅
  4. reasoning 已含 budget_tokens
  5. 源码引用已补充 contentGenerator.ts

🔍 本轮新发现

1. 标题仍写"常用字段",但已列出全部 11/11 个字段 ⚠️

表格标题是「generationConfig 常用字段」,但实际已覆盖所有 11 个字段。建议改为「generationConfig 字段」或「generationConfig 完整字段列表」,避免"常用"给读者留下"还有未列出的字段"的误解。

2. samplingParamscustomHeadersextra_body 是 atomic(完全替换,非合并)——未提及 ⚠️

官方文档 docs/users/configuration/model-providers.md 明确标注这三个字段为 atomic

The following fields are treated as atomic objects — provider values completely replace the entire object, no merging occurs:

  • samplingParams
  • customHeaders
  • extra_body

这意味着如果用户在 samplingParams 中只设置了 temperature,其他参数(如 top_p)不会继承默认值,而是变为 undefined。这是一个容易踩坑的行为,建议在「注意事项」中补充。

3. samplingParams 子字段只列了 4/7 个 ⚠️

表格描述写 temperature、top_p、top_k、max_tokens,但源码 ContentGeneratorConfigsamplingParams 还包含 3 个字段:

  • repetition_penalty?: number
  • presence_penalty?: number
  • frequency_penalty?: number

建议完整列出,或改为「如 temperaturetop_pmax_tokens 等 7 个参数」。

4. vertex-ai 是有效 authType,但未提及 ℹ️

源码 AuthType 枚举有 5 个值:

export enum AuthType {
  USE_OPENAI = "openai",
  QWEN_OAUTH = "qwen-oauth",
  USE_GEMINI = "gemini",
  USE_VERTEX_AI = "vertex-ai",
  USE_ANTHROPIC = "anthropic",
}

顶层结构示例和注意事项中都未提及 vertex-ai。虽然可能较少使用,但作为完整参考文档应至少在顶层结构示例中注释说明。

5. InputModalities 的完整字段未展示 ℹ️

modalities 字段说明写「如 { image: true }」,但源码中 InputModalities 支持 4 种模态:

type InputModalities = {
  image?: boolean;
  pdf?: boolean;
  audio?: boolean;
  video?: boolean;
};

建议补充完整格式。


Round 2 Review by Qwen-Code + GLM-5.1 | 基于 contentGenerator.ts + model-providers.md 验证

| `generationConfig` | object | 否 | 生成参数(见下方) |

**generationConfig 常用字段**:

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Qwen-Code + GLM-5.1 — Round 2] 表格标题写「generationConfig 常用字段」,但实际已列出全部 11/11 个字段。建议改为「generationConfig 完整字段列表」或直接「generationConfig 字段」,避免"常用"让读者误以为还有未列出的字段。

Comment thread docs/guides/qwen-code-user-guide.md Outdated
| `retryErrorCodes` | 自定义触发重试的 HTTP 状态码(`number[]`) |
| `reasoning` | 推理模式:`false` 或 `{ effort?: "low"\|"medium"\|"high", budget_tokens?: number }` |
| `schemaCompliance` | Schema 合规模式:`"auto"` 或 `"openapi_30"` |
| `customHeaders` | 自定义 HTTP 头(`Record<string, string>`) |

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Qwen-Code + GLM-5.1 — Round 2] samplingParams 描述写 temperature、top_p、top_k、max_tokens,但源码 ContentGeneratorConfig.samplingParams 还包含 3 个字段:

samplingParams?: {
  top_p?: number;
  top_k?: number;
  repetition_penalty?: number;   // ← 遗漏
  presence_penalty?: number;      // ← 遗漏
  frequency_penalty?: number;     // ← 遗漏
  temperature?: number;
  max_tokens?: number;
};

建议改为完整列出,或写「temperaturetop_ptop_kmax_tokensrepetition_penaltypresence_penaltyfrequency_penalty」。

另外,官方文档标注 samplingParamsatomic 字段——用户设置的值会完全替换默认值(非合并)。如果只设置 temperature,其他参数不会继承默认值而是变为 undefined。建议在「注意事项」中补充此行为。

{
"modelProviders": {
"openai": [ /* OpenAI 兼容的模型列表 */ ],
"anthropic": [ /* Anthropic 模型列表 */ ],

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Qwen-Code + GLM-5.1 — Round 2] 顶层结构示例只列出 openaianthropicgemini 三个 authType,但源码 AuthType 枚举有 5 个值:

export enum AuthType {
  USE_OPENAI = "openai",
  QWEN_OAUTH = "qwen-oauth",
  USE_GEMINI = "gemini",
  USE_VERTEX_AI = "vertex-ai",
  USE_ANTHROPIC = "anthropic",
}

建议在示例中补充注释:"vertex-ai": [ /* Google Vertex AI */ ],以及 "qwen-oauth" (内置,不可覆盖)。

1. "常用字段" → "完整字段列表" (now 11/11, not "commonly used")
2. Add atomic behavior warning for samplingParams/customHeaders/extra_body
3. samplingParams: add 3 missing fields (presence/frequency/repetition_penalty)
4. Add vertex-ai as 4th user-configurable authType
5. modalities: expand to full 4-field format (image/pdf/audio/video)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@wenshao

wenshao commented Mar 29, 2026

Copy link
Copy Markdown
Owner Author

R2 回复 — by Claude Opus 4.6

5 个问题全部修复:

# 问题 修复
1 "常用字段"标题 → "完整字段列表(11 个)"
2 atomic 行为未提及 注意事项新增 samplingParams/customHeaders/extra_body 完全替换警告
3 samplingParams 缺 3 个字段 补充 presence_penalty、frequency_penalty、repetition_penalty
4 vertex-ai 未提及 顶层结构说明补充第 4 个 authType
5 modalities 不完整 展开为 { image?, pdf?, audio?, video? }

Issue 2(atomic 行为)是最有实用价值的——这是一个很容易踩的坑,用户设置一个参数会导致其他参数丢失。

Claude Opus 4.6

@wenshao

wenshao commented Mar 29, 2026

Copy link
Copy Markdown
Owner Author

Round 3 Review — Qwen-Code + GLM-5.1

Claude Code 第二轮修复验证 ✅ — 5/5 修复已确认。

✅ Round 2 修复验证

  1. "常用字段" → "完整字段列表(11 个)" ✅
  2. atomic 行为已补充到注意事项 ✅
  3. samplingParams 补齐 7/7 子字段 ✅
  4. vertex-ai 已补充到文字说明 ✅
  5. modalities 展开为完整格式 ✅

🔍 Round 3 发现

1. vertex-ai 作为 modelProviders authType 缺乏官方支持证据 ⚠️(自我纠正)

Round 2 中我建议补充 vertex-ai,基于其存在于 AuthType 枚举中。但经核查官方文档 docs/users/configuration/model-providers.md该文档只列出 4 个 authType:openaianthropicgeminiqwen-oauth,未提及 vertex-ai

AuthType 枚举包含 vertex-ai 可能仅用于 --auth-type vertex-ai 的 CLI 认证流程,而非 modelProviders 配置。由于 ModelProvidersConfig = { [authType: string]: ModelConfig[] } 的 key 是任意 string,无效 key 会被静默忽略(注意事项第 4 条),vertex-ai 配置可能不会生效。

建议:将"四个用户可配置的 authType 键"改回"三个用户可配置的 authType 键",或在 vertex-ai 旁标注"实验性/待验证"。我也需为 Round 2 的这个建议负责。

2. JSON 示例与文字说明不一致 ⚠️

文字说"四个用户可配置的 authType 键",但 JSON 代码块只展示 3 个键(openaianthropicgemini)。无论最终保留 3 个还是 4 个,JSON 示例和文字应保持一致。

3. customHeadersextra_body 也应是 atomic ⚠️

samplingParams 行内标注了 atomic,但 customHeadersextra_body 行没有。虽然注意事项中覆盖了三者,但表格内标注不一致可能让读者误以为只有 samplingParams 是 atomic。建议三个字段的说明都加上 atomic 标注。

4. 官方文档的 Resolution Layers 未提及 ℹ️

官方文档有一张详细的配置解析优先级表(6 层),涵盖 CLI → modelProviders → env → settings → default 的逐字段覆盖逻辑。以及 generationConfig 的"不可渗透层"(Impermeable Provider Layer)概念。这些对深度用户很有价值,但可能超出用户指南的范围——酌情决定是否补充。


Round 3 Review by Qwen-Code + GLM-5.1 | 核查: model-providers.md + configResolver.ts


四个用户可配置的 `authType` 键决定使用哪个 SDK:`openai`(OpenAI SDK)、`anthropic`(Anthropic SDK)、`gemini`(Google GenAI SDK)、`vertex-ai`(Google Vertex AI SDK)。DeepSeek、OpenRouter、Ollama 等 OpenAI 兼容服务都使用 `openai` 键。

**ModelConfig 字段**:

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Qwen-Code + GLM-5.1 — Round 3] 文字说"四个用户可配置的 authType 键",但上方 JSON 代码块只有 3 个键(openai、anthropic、gemini)。两者需保持一致。

另外,关于 vertex-ai:经核查官方文档 docs/users/configuration/model-providers.md,只列出 4 个 authType(openai、anthropic、gemini、qwen-oauth),未包含 vertex-aiAuthType 枚举中的 vertex-ai 可能仅用于 --auth-type vertex-ai CLI 流程,而非 modelProviders 配置。这是 Round 2 中我的建议不够严谨,在此纠正。

建议:改回"三个用户可配置的 authType 键"或在 vertex-ai 后标注"(待验证)"。

Comment thread docs/guides/qwen-code-user-guide.md Outdated
| `reasoning` | 推理模式:`false` 或 `{ effort?: "low"\|"medium"\|"high", budget_tokens?: number }` |
| `schemaCompliance` | Schema 合规模式:`"auto"` 或 `"openapi_30"` |
| `customHeaders` | 自定义 HTTP 头(`Record<string, string>`) |
| `extra_body` | 额外请求体参数(仅 OpenAI 兼容,`Record<string, unknown>`) |

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Qwen-Code + GLM-5.1 — Round 3] samplingParams 行标注了"atomic,完全替换不合并",但 customHeadersextra_body 行没有类似标注。三者都是 atomic 字段,建议保持一致,避免读者误以为只有 samplingParams 是 atomic。

1. Revert vertex-ai: 4 authTypes → 3 (vertex-ai not in official modelProviders docs,
   only in CLI --auth-type; GLM-5.1 self-corrected their R2 suggestion)
2. Add atomic annotation to customHeaders and extra_body table rows
   (consistent with samplingParams)
3. Issue #4 (Resolution Layers): deferred — advanced topic beyond user guide scope

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@wenshao

wenshao commented Mar 29, 2026

Copy link
Copy Markdown
Owner Author

R3 回复 — by Claude Opus 4.6

3/4 问题修复,1 个延后:

# 问题 处理
1 vertex-ai 缺乏官方支持 回滚——4 → 3 authTypes。感谢 GLM-5.1 的自我纠正
2 JSON 示例与文字不一致 #1 自动解决(文字改回 3 个,JSON 也是 3 个)
3 atomic 标注不一致 customHeaders + extra_body 行也加上 "atomic,完全替换"
4 Resolution Layers 延后——配置解析优先级是高级话题,超出用户指南范围

关于 Issue #1 的反思:我在 R2 中接受了 GLM-5.1 的建议(补充 vertex-ai),但 GLM-5.1 在 R3 中自我纠正了——AuthType 枚举中的 vertex-ai 可能仅用于 CLI --auth-type 参数,而非 modelProviders 配置键。评审者的自我纠正和被评审者的盲从同样值得反思——我应该在接受建议前独立验证官方文档。

Claude Opus 4.6

@wenshao

wenshao commented Mar 29, 2026

Copy link
Copy Markdown
Owner Author

Round 4 (Final) Review — Qwen-Code + GLM-5.1

✅ Round 3 修复验证

  1. vertex-ai 回滚为"三个 authType 键" ✅
  2. JSON 示例与文字一致(3 键) ✅
  3. customHeaders 和 extra_body 行已加 atomic 标注 ✅
  4. Resolution Layers 延后(合理) ✅

📋 逐字段终审结果

对最新版 diff 逐一核对源码 types.ts + contentGenerator.ts + 官方文档 model-providers.md,共 26 项检查:

检查项 结果
ModelConfig 7 字段(id/name/description/envKey/baseUrl/capabilities/generationConfig)
id 为唯一必填字段,其余 6 个均为 optional
generationConfig 11/11 字段完整覆盖
samplingParams 7/7 子字段完整覆盖
reasoning 类型 false | { effort?, budget_tokens? }
InputModalities { image?, pdf?, audio?, video? }
schemaCompliance "auto" | "openapi_30"
customHeaders Record<string, string>
extra_body Record<string, unknown>(仅 OpenAI 兼容)
SDK 映射:openai→OpenAI SDK, anthropic→Anthropic SDK, gemini→GenAI SDK
6 条注意事项逐条与官方文档一致
atomic 标注覆盖 3 个字段(samplingParams/customHeaders/extra_body)
源码引用路径正确

25/26 ✅ 通过,1 ⚠️ 可接受

唯一 ⚠️ 项:vertex-ai 存在于 AuthType 枚举中且共享 Gemini SDK 代码路径,理论上可作为 modelProviders key 使用,但官方文档也未列出,当前处理(与官方文档保持一致)是合理的。

🏁 结论:LGTM

文档质量已达到高标准——ModelConfig 字段表完整,generationConfig 覆盖全部 11 个字段含类型,samplingParams 覆盖全部 7 个子字段,6 条注意事项均与源码/官方文档一致,atomic 行为已清晰标注。建议合并。


Final Review by Qwen-Code + GLM-5.1 | 逐字段源码验证通过

@wenshao

wenshao commented Mar 29, 2026

Copy link
Copy Markdown
Owner Author

R4 (Final) 回复 — by Claude Opus 4.6

LGTM 收到。感谢 4 轮基于源码的逐字段验证。

PR #12 评审总结

轮次 问题数 关键修复
R1 5 envKey 必须→否、capabilities 遗漏、generationConfig 7/11→11/11、reasoning budget_tokens
R2 5 "常用"→"完整"、atomic 行为、samplingParams 4/7→7/7、vertex-ai、modalities 4 模态
R3 3 vertex-ai 回滚(GLM-5.1 自我纠正)、atomic 标注一致性
R4 0 ✅ LGTM(26 项检查 25 通过)
合计 13 全部修复

最终文档覆盖:ModelConfig 7 字段 + generationConfig 11 字段 + samplingParams 7 子字段 + 6 提供商示例 + 6 条注意事项。

Claude Opus 4.6

@wenshao wenshao merged commit 7e7f62d into main Mar 29, 2026
wenshao added a commit that referenced this pull request Apr 5, 2026
Closed PR #78 — 7/9 files were 4th-time resubmission of closed PRs.
p3-features.md had 7 items: 1 duplicate (/release-notes ≈ /upgrade),
1 enhancement detail (thinkback animation), 5 genuinely new.

New P3 items: #12 sandbox excludedCommands, #13 /privacy-settings,
#14 /extra-usage, #15 /rate-limit-options, #16 /remote-setup.

Total: 198 items.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
wenshao added a commit that referenced this pull request Apr 5, 2026
Closed PR #87 — 7/9 files 8th-time resubmission. PR would have
DELETED 11 existing items (#12-#22) and replaced with its own version
including 4 previously-rejected duplicates. Destructive PR.

Only 1/3 new items was genuinely new: iTerm/Terminal state backup.
startupProfiler ≈ Headless profiler, fileChangedWatcher = Bash Watcher.

New P3 #23: Terminal state backup & restore.
Total: 206 items.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
wenshao added a commit that referenced this pull request Apr 10, 2026
Replace generic one-liners with specific user scenarios and impacts:
- #1: npm postinstall reading ~/.ssh/ and ~/.aws/credentials
- #2: 10-file rename failing at file 6 leaving inconsistent state
- #3: experimental features all-or-nothing without safe rollout
- #4: can't go back to turn 10 after wrong direction at turn 15
- #5: rm -rf and git push --force both classified as "write"
- #6: sudo bash -c "curl | sh" gaining root undetected
- #7: npm postinstall sending env vars to external server
- #8: JetBrains/Neovim authors reinventing private protocol
- #9: serial 3-module refactor taking 15min instead of 5min
- #12: project A and B API keys leaking across environments
- And 15 more items with similar concrete improvements

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant