Skip to content

feat(codex): add OpenCode Go provider preset#3534

Open
cxyfer wants to merge 1 commit into
farion1231:mainfrom
cxyfer:feat/codex-opencode-go-preset
Open

feat(codex): add OpenCode Go provider preset#3534
cxyfer wants to merge 1 commit into
farion1231:mainfrom
cxyfer:feat/codex-opencode-go-preset

Conversation

@cxyfer
Copy link
Copy Markdown
Contributor

@cxyfer cxyfer commented Jun 1, 2026

Summary / 概述

Add OpenCode Go as a Codex provider preset to fix endpoint path resolution.

Problem / 根因

When using the same base URL (https://opencode.ai/zen/go) as the OpenCode Go preset in Claude Code, requests work correctly in Claude Code but fail with upstream HTTP 404 in Codex.

The root cause is in forwarder.rs: two endpoint rewrite functions output inconsistent paths for the same upstream target (Chat Completions API):

Function Returns target_path
rewrite_codex_responses_endpoint_to_chat /chat/completions
rewrite_claude_transform_endpoint /v1/chat/completions

The Codex side is missing /v1, which causes CodexAdapter::build_url to treat https://opencode.ai/zen/go as a custom prefix and not prepend /v1. The request ultimately lands on /zen/go/chat/completions. On the Claude side, the endpoint already carries /v1, so ClaudeAdapter::build_url directly concatenates to produce the correct path /zen/go/v1/chat/completions.

Claude: https://opencode.ai/zen/go + /v1/chat/completions → OK ✅
Codex:  https://opencode.ai/zen/go + /chat/completions    → 404 ❌

Since fixing Codex-side path normalization globally could break other providers, a dedicated preset with the correct /v1 suffix in the base URL is added instead.

Changes / 变更

src/config/codexProviderPresets.ts — one new preset entry after DeepSeek:

Field Value
Provider opencode_go
Base URL https://opencode.ai/zen/go/v1
Default Model deepseek-v4-flash
API Format openai_chat
Model Catalog deepseek-v4-flash, deepseek-v4-pro
Reasoning thinking via reasoning_content

Related Issue / 关联 Issue

#3528

Checklist / 检查清单

  • pnpm typecheck passes
  • pnpm format:check passes

OpenCode Go endpoint (https://opencode.ai/zen/go) requires /v1 suffix
for OpenAI-compatible requests. Without it, requests fail with HTTP 404
because the base URL mapped to /chat/completions instead of
/v1/chat/completions.

Since the endpoint normalization behavior cannot be changed without
potentially breaking other providers, a dedicated preset with the
correct /v1 base URL is added instead.

Closes farion1231#3528
@farion1231
Copy link
Copy Markdown
Owner

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0afc5f744a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +305 to +309
codexChatReasoning: {
supportsThinking: true,
thinkingParam: "thinking",
outputFormat: "reasoning_content",
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve DeepSeek effort settings for OpenCode Go

For this preset, the explicit codexChatReasoning object short-circuits backend inference in resolve_codex_chat_reasoning_config, and normalizeCodexChatReasoningForSave treats the omitted supportsEffort as false/effortParam: "none". That means OpenCode Go's DeepSeek V4 models will ignore Codex's configured model_reasoning_effort = "high", even though the adjacent DeepSeek preset for the same model family enables supportsEffort: true with effortValueMode: "deepseek"; users selecting OpenCode Go will silently lose effort control unless these fields are included here.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

@cxyfer cxyfer Jun 2, 2026

Choose a reason for hiding this comment

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

This is an intentional design, as OpenCode Go will include models from other providers, and adding supportsEffort might be incompatible with other providers.

@lovingfish
Copy link
Copy Markdown

OpenCode Go 是异构聚合服务,不是一个行为稳定的单一 OpenAI Chat provider(这家应该是采购api + 自己租卡卖token 混着来的),已预感到即将 会有 一大波 issue 丢个截图问,“为什么我用了 ccs 里 opencode go 的预设 codex 还是不能用啊!” (无恶意,只是想到这个语义下可能会被人误解做了 preset 就会被认为 做了全部的兼容支持,但很显然完美兼容 opencode go是一件roi 较低的事情)

@farion1231
Copy link
Copy Markdown
Owner

farion1231 commented Jun 2, 2026 via email

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.

3 participants