-
-
Notifications
You must be signed in to change notification settings - Fork 181
feat(usage-doc): update OpenCode config example with GPT-5.2 and Gemini v1beta #597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -543,8 +543,8 @@ | |||||
| "important": "重要", | ||||||
| "importantPoints": [ | ||||||
| "cch の管理画面で API Key を作成し、環境変数 CCH_API_KEY を設定してください", | ||||||
| "3 つの provider すべてで baseURL は ${resolvedOrigin}/v1(cch の v1 API ベース URL)", | ||||||
| "モデル選択は provider_id/model_id 形式(例:cchClaude/claude-sonnet-4-5-20250929)" | ||||||
| "cchClaude/openai は ${resolvedOrigin}/v1、cchGemini は ${resolvedOrigin}/v1beta を baseURL に使用します", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The phrasing
Suggested change
|
||||||
| "モデル選択は provider_id/model_id 形式(例:openai/gpt-5.2 または cchClaude/claude-sonnet-4-5-20250929)" | ||||||
| ] | ||||||
| }, | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -543,8 +543,8 @@ | |||||
| "important": "Важно", | ||||||
| "importantPoints": [ | ||||||
| "Создайте API key в панели cch и задайте переменную окружения CCH_API_KEY", | ||||||
| "Все provider используют ${resolvedOrigin}/v1 как baseURL (базовый URL cch v1 API)", | ||||||
| "При выборе модели используйте provider_id/model_id (например, cchClaude/claude-sonnet-4-5-20250929)" | ||||||
| "cchClaude/openai используют ${resolvedOrigin}/v1; cchGemini использует ${resolvedOrigin}/v1beta", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The phrasing
Suggested change
|
||||||
| "При выборе модели используйте provider_id/model_id (например, openai/gpt-5.2 или cchClaude/claude-sonnet-4-5-20250929)" | ||||||
| ] | ||||||
| }, | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -539,8 +539,8 @@ | |||||
| "important": "重要说明", | ||||||
| "importantPoints": [ | ||||||
| "请先在 cch 后台创建 API Key,并设置环境变量 CCH_API_KEY", | ||||||
| "三个 provider 的 baseURL 都使用 ${resolvedOrigin}/v1(cch v1 API 地址)", | ||||||
| "模型选择时使用 provider_id/model_id 格式(例如 cchClaude/claude-sonnet-4-5-20250929)" | ||||||
| "cchClaude/openai 使用 ${resolvedOrigin}/v1,cchGemini 使用 ${resolvedOrigin}/v1beta", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The phrasing
Suggested change
|
||||||
| "模型选择时使用 provider_id/model_id 格式(例如 openai/gpt-5.2 或 cchClaude/claude-sonnet-4-5-20250929)" | ||||||
| ] | ||||||
| }, | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -539,8 +539,8 @@ | |||||
| "important": "重要說明", | ||||||
| "importantPoints": [ | ||||||
| "請先在 cch 後台創建 API Key,並設置環境變量 CCH_API_KEY", | ||||||
| "三個 provider 的 baseURL 都使用 ${resolvedOrigin}/v1(cch v1 API 地址)", | ||||||
| "模型選擇時使用 provider_id/model_id 格式(例如 cchClaude/claude-sonnet-4-5-20250929)" | ||||||
| "cchClaude/openai 使用 ${resolvedOrigin}/v1,cchGemini 使用 ${resolvedOrigin}/v1beta", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The phrasing
Suggested change
|
||||||
| "模型選擇時使用 provider_id/model_id 格式(例如 openai/gpt-5.2 或 cchClaude/claude-sonnet-4-5-20250929)" | ||||||
| ] | ||||||
| }, | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1080,6 +1080,8 @@ gemini`} | |
| $schema: "https://opencode.ai/config.json", | ||
| theme: "opencode", | ||
| autoupdate: false, | ||
| model: "openai/gpt-5.2", | ||
| small_model: "openai/gpt-5.2-small", | ||
|
Comment on lines
+1083
to
+1084
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The model references use These model references should either:
Based on the i18n examples (which use Prompt To Fix With AIThis is a comment left during a code review.
Path: src/app/[locale]/usage-doc/page.tsx
Line: 1083:1084
Comment:
The model references use `openai/gpt-5.2` and `openai/gpt-5.2-small`, expecting a provider named `openai`. However, the GPT provider is named `cchGPT` at line 1099. This mismatch will cause OpenCode to fail when trying to resolve these models because it won't find a provider with ID `openai`.
These model references should either:
1. Be changed to `cchGPT/gpt-5.2` and `cchGPT/gpt-5.2-small` to match the provider name, OR
2. The provider at line 1099 should be renamed from `cchGPT` to `openai`
Based on the i18n examples (which use `openai/gpt-5.2`) and the test expectations, option 2 (renaming provider to `openai`) appears to be the intended fix.
How can I resolve this? If you propose a fix, please make it concise. |
||
| provider: { | ||
| cchClaude: { | ||
| npm: "@ai-sdk/anthropic", | ||
|
|
@@ -1100,16 +1102,34 @@ gemini`} | |
| options: { | ||
| baseURL: `${resolvedOrigin}/v1`, | ||
| apiKey: "{env:CCH_API_KEY}", | ||
| store: false, | ||
| setCacheKey: true, | ||
| }, | ||
| models: { | ||
| "gpt-5.2": { name: "GPT-5.2" }, | ||
| "gpt-5.2": { | ||
| name: "GPT-5.2", | ||
| options: { | ||
| reasoningEffort: "xhigh", | ||
| store: false, | ||
| include: ["reasoning.encrypted_content"], | ||
| }, | ||
| }, | ||
| "gpt-5.2-small": { | ||
| id: "gpt-5.2", | ||
| name: "GPT-5.2 Small", | ||
| options: { | ||
| reasoningEffort: "medium", | ||
| store: false, | ||
| include: ["reasoning.encrypted_content"], | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| cchGemini: { | ||
| npm: "@ai-sdk/google", | ||
| name: "Gemini via cch", | ||
| options: { | ||
| baseURL: `${resolvedOrigin}/v1`, | ||
| baseURL: `${resolvedOrigin}/v1beta`, | ||
| apiKey: "{env:CCH_API_KEY}", | ||
| }, | ||
| models: { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -69,18 +69,28 @@ describe("UsageDoc - OpenCode 配置教程", () => { | |||||
| expect(text).toContain('"baseURL": "http://localhost:23000/v1"'); | ||||||
|
|
||||||
| expect(text).toContain('"npm": "@ai-sdk/anthropic"'); | ||||||
| expect(text).toContain('"npm": "@ai-sdk/openai"'); | ||||||
| expect(text).toContain('"npm": "@ai-sdk/google"'); | ||||||
| expect(text).not.toContain('"npm": "@ai-sdk/openai"'); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test assertion appears to be incorrect. The
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: rg -n "@ai-sdk/openai" --type=ts --type=tsx -g '!node_modules/**'Repository: ding113/claude-code-hub Length of output: 94 🏁 Script executed: head -n 95 tests/unit/usage-doc/opencode-usage-doc.test.tsx | tail -n 30Repository: ding113/claude-code-hub Length of output: 1351 🏁 Script executed: git log --oneline -n 20 -- tests/unit/usage-doc/opencode-usage-doc.test.tsxRepository: ding113/claude-code-hub Length of output: 153 🏁 Script executed: find . -name "page.tsx" -path "*/usage-doc/*" -type fRepository: ding113/claude-code-hub Length of output: 104 🏁 Script executed: rg -n "ai-sdk/openai" -t=ts -t=jsx -t=js -g '!node_modules' -g '!*.test.*'Repository: ding113/claude-code-hub Length of output: 94 🏁 Script executed: fd -e tsx -e ts "usage-doc" | grep -E "(page|config)" | head -20Repository: ding113/claude-code-hub Length of output: 111 🏁 Script executed: cat -n ./src/app/[locale]/usage-doc/page.tsx | head -200Repository: ding113/claude-code-hub Length of output: 7379 🏁 Script executed: grep -n "openai\|@ai-sdk" ./src/app/[locale]/usage-doc/page.tsxRepository: ding113/claude-code-hub Length of output: 500 🏁 Script executed: sed -n '1080,1110p' ./src/app/[locale]/usage-doc/page.tsxRepository: ding113/claude-code-hub Length of output: 1123 🏁 Script executed: sed -n '1095,1135p' ./src/app/[locale]/usage-doc/page.tsxRepository: ding113/claude-code-hub Length of output: 1377 🏁 Script executed: git diff ./src/app/[locale]/usage-doc/page.tsxRepository: ding113/claude-code-hub Length of output: 49 🏁 Script executed: git status ./src/app/[locale]/usage-doc/page.tsxRepository: ding113/claude-code-hub Length of output: 132 🏁 Script executed: cat -n tests/unit/usage-doc/opencode-usage-doc.test.tsxRepository: ding113/claude-code-hub Length of output: 6386 🏁 Script executed: sed -n '1050,1200p' ./src/app/[locale]/usage-doc/page.tsx | grep -n "CodeBlock\|config\|JSON\|stringify"Repository: ding113/claude-code-hub Length of output: 1501 🏁 Script executed: grep -n "JSON.stringify\|<CodeBlock" ./src/app/[locale]/usage-doc/page.tsx | head -20Repository: ding113/claude-code-hub Length of output: 791 🏁 Script executed: sed -n '1070,1160p' ./src/app/[locale]/usage-doc/page.tsxRepository: ding113/claude-code-hub Length of output: 3184 配置中 第 73 行的断言 需要对齐实现与测试:要么从 🤖 Prompt for AI Agents |
||||||
| expect(text).not.toContain("@ai-sdk/openai-compatible"); | ||||||
|
|
||||||
| expect(text).toContain("claude-haiku-4-5-20251001"); | ||||||
| expect(text).toContain("claude-sonnet-4-5-20250929"); | ||||||
| expect(text).toContain("claude-opus-4-5-20251101"); | ||||||
|
|
||||||
| expect(text).toContain('"model": "openai/gpt-5.2"'); | ||||||
| expect(text).toContain('"small_model": "openai/gpt-5.2-small"'); | ||||||
|
|
||||||
| expect(text).toContain("gpt-5.2"); | ||||||
| expect(text).toContain("gpt-5.2-small"); | ||||||
| expect(text).toContain('"reasoningEffort": "xhigh"'); | ||||||
| expect(text).toContain('"reasoningEffort": "medium"'); | ||||||
| expect(text).toContain('"store": false'); | ||||||
| expect(text).toContain('"setCacheKey": true'); | ||||||
| expect(text).toContain("reasoning.encrypted_content"); | ||||||
|
|
||||||
| expect(text).toContain("gemini-3-pro-preview"); | ||||||
| expect(text).toContain("gemini-3-flash-preview"); | ||||||
| expect(text).toContain('"baseURL": "http://localhost:23000/v1beta"'); | ||||||
|
|
||||||
| unmount(); | ||||||
| }); | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The phrasing
cchClaude/openai use...could be slightly confusing, as it might be misinterpreted as a single provider namedcchClaude/openai. To improve clarity, consider rephrasing to explicitly state that these are two separate providers.