Skip to content

[PR] docs: opencodex (ocx) as upstream gateway — verified recipe - #5829

Closed
ranxianglei wants to merge 1 commit into
masterfrom
2026-11-06_opencodex-integration-docs
Closed

ranxianglei wants to merge 1 commit into
masterfrom
2026-11-06_opencodex-integration-docs

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #5818

What

One FAQ entry each in README.md / README.zh-CN.md, next to the existing magpie gateway entry: how to run opencodex (ocx) — the local Codex/Claude Code gateway with a ChatGPT account pool — as bili's upstream. Docs only; no code or config changes.

Why

#5818 asked whether the two projects can be combined; lidge-jun/opencodex discussion #6320 shows demand for exactly this from their side. Research conclusion: no code is needed. ocx's data plane is an ordinary OpenAI/Anthropic-compatible endpoint whose default loopback bind reads no token, so bili's existing /bili/ gateway pattern covers it — with bili IN FRONT (client → bili → ocx → model): session identity stays clean on the client-facing hop, and ocx keeps ownership of provider credentials and account pooling at its final hop. The reverse order loses the pool semantics.

Verification (live hermetic chain, 2026-11-06)

client → bili 0.1.212 → ocx 2.97.0 (ocx start, mock OpenAI upstream behind it):

  • OpenAI Chat Completions: non-streaming HTTP 200 + streaming SSE through both hops
  • OpenAI Responses: HTTP 200, valid response object
  • Anthropic Messages: HTTP 200, valid message object (ocx cross-wires to its provider adapter)
  • bili session tracking + injection pipeline active on the chain (session recorded, system-prompt injection observed at the mock)

Config surface

None — docs only.

Verified zero-code chain client -> bili -> ocx -> model over all three wires (OpenAI Chat / Responses / Anthropic Messages) on 2026-11-06, bili 0.1.212 x ocx 2.97.0. Closes #5818
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-06_opencodex-integration-docs (4ebd3d1)

Latest build — install this exact version

npm install -g billion-context@0.0.8394-pr.5829.511c5af

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
4ebd3d1 billion-context@0.0.8394-pr.5829.511c5af build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr5829.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title docs: opencodex (ocx) as upstream gateway — verified recipe [PR] docs: opencodex (ocx) as upstream gateway — verified recipe Nov 6, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重:不重复。 镜像与 GitHub 的 open/closed issues+PRs 均检索过(opencodex / ocx / gateway):唯一相关条目就是本 PR。来源线程 = Discussion #5818(「Can billion-context be integrated with opencodex?」——经 GraphQL 确认存在;REST /issues/{n} 对 discussion 返回 404,所以正文里的 "Closes #5818" 初看像悬空引用,实际指向正确)。

标签:scope/docs + p3(纯文档 FAQ 条目,无代码/配置变更;非缺陷不打 bug;ocx 是上游网关而非宿主车道,不打客户端标签)。

Review 结论(PR #5829:docs only,单 commit,README.md / README.zh-CN.md 各 +2 行)

① 原 issue 方向:成立。来源是 Discussion #5818 问两项目能否结合,ocx 侧(lidge-jun/opencodex discussion #6320)也有同向需求。「不需要代码」的结论正确:ocx 数据面就是普通的 OpenAI/Anthropic 兼容端点,bili 既有 /bili/<绝对URL> 中继模式全覆盖;bili 放 ocx 前面保住会话身份与账号池语义,反序丢池化——方向判断对。

② 回归审查:不涉及——未触碰任何代码路径,既有行为清单为空。

③ 内容事实核查(逐项独立对照两个仓库,非照抄 PR 声明):

  • bili 默认端口 8787 ✓(src/cli.ts:190)
  • /bili/ 前缀内嵌绝对 URL 模式 ✓(src/discover.ts:15-16、src/launcher.ts:392;与相邻 magpie 条目同一机制,How to integrate https://github.com/yetone/magpie/blob/main/README.zh-CN.md | 如何集成https://github.com/yetone/magpie/blob/main/README.zh-CN.md #4433)
  • models.<name>.context 窗口声明 ✓(CONFIGURATION.md:1183)
  • /acp-cache 的 KEY SWITCHES ✓(src/cache-ledger.ts:2414)
  • ocx 默认绑定 127.0.0.1:10100、回环不读 token ✓(ocx README L99/L202)
  • OpenAI base …/v1 + Anthropic base URL 形态 ✓(ocx README L119)
  • 非回环需 OPENCODEX_API_AUTH_TOKEN + x-opencodex-api-key 头 ✓(ocx README L455-457)
  • provider/model 路由 id 语法 ✓(ocx README L355-364)
  • ChatGPT 账号池描述 ✓(ocx README L89)
  • en/zh 两条目互相对齐,均插在 magpie 条目之后 ✓
  • 版本钉「bili 0.1.212 × ocx 2.97.0」与 master 当前版本 0.1.212 一致 ✓(记录实测时点,历史准确)

④ 测试有效性:docs-only 无需测试;PR 声明的 live hermetic 链路实测(client → bili → ocx,三条线含流式 + 会话跟踪/注入观测)与上游文档常量自洽,以上为独立交叉核对结果。

⑤ diff 整洁度:4 行新增、单 commit、base 即当前 master head、mergeable=true、无无关改动 ✓

CI:全绿——47 项 check 全部 success/skipped(e2e 车道按门控设计跳过),无失败。

八问

  1. 是什么问题:给两份 README 的 FAQ 补上「opencodex (ocx) 作为 bili 上游网关」的已验证接入配方,回答 Discussion Can billion-context be integrated with opencodex? #5818 的真实提问。
  2. 什么原因导致的:纯文档缺口,无缺陷。
  3. 影响范围与严重程度:仅文档面,零运行时影响;p3。
  4. 怎么修复的:复用既有 /bili/ 网关模式写成 FAQ,无新配置、无代码。
  5. 是否有回归问题:无(未触碰代码)。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不变。
  8. 是否引入新配置:无。

判定:可合并。 内容事实逐项成立、CI 绿、diff 最小。唯一小注(无需改):"Closes #5818" 指向 Discussion,Closes 关键字对 discussion 无自动关闭效果,但引用对象本身正确。

@ranxianglei ranxianglei 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.

(ai: vllm-qwen/qwen3.8-27b)

查重:不重复 — full-text search across open+closed issues/PRs ("opencodex"/"ocx", GitHub + local tracker): the only related pre-existing item is the question thread itself (cyrus109's "[Ideas] Can billion-context be integrated with opencodex?", still open); no other PR/issue carries this recipe and no ocx entry exists in README/CLIENTS.md yet. This PR is the sole implementation of that request.

Verdict: APPROVE (posted as a comment review — GitHub rejects approve events on a PR authored by the same account) — docs-only change (README.md + README.zh-CN.md, +4/-0); every factual claim independently verified against both repos' current documentation.

Structured eight questions:

  1. What problem: answers "can bili and opencodex (ocx) be combined?" with a verified recipe — client → bili → ocx through the /bili/<absolute-url> prefix.
  2. Root cause: n/a — docs addition answering a user question ([Ideas] thread above); demand also visible in lidge-jun/opencodex discussion #6320.
  3. Impact scope / severity: zero runtime surface — no code/config/wire/persistence changes; only readers of the two READMEs are affected.
  4. How fixed: one FAQ entry each in en/zh placed next to the existing magpie gateway entry (same bold-question format), reusing the established /bili/ pattern; states why bili goes IN FRONT of ocx (pool semantics live at ocx's final hop).
  5. Regression audit: existing behavior audited = the two FAQ sections' insertion points and surrounding text — the diff touches exactly two added paragraphs plus blank lines (verified at branch head), no other line changed; zh/en kept in sync (§7.3); no headings/anchors added so TOC unaffected; no config/wire/kernel/version fields touched. No regressions.
  6. Cache impact: n/a (no runtime path touched).
  7. Design direction: unchanged.
  8. New config introduced: none (body declares "Config surface: None").

Independent fact-check (not taken from the PR body):

  • ocx default bind 127.0.0.1:10100; OpenAI base http://localhost:10100/v1, Anthropic base http://localhost:10100 — matches lidge-jun/opencodex README (current main).
  • non-loopback bind requires OPENCODEX_API_AUTH_TOKEN + x-opencodex-api-key header — matches ocx README.
  • provider/model routing id syntax — matches ocx README.
  • all three wires accepted by ocx (Responses / Chat Completions / Anthropic Messages) — matches ocx README.
  • version pins are real: bili tag v0.1.212 exists (= current master package.json 0.1.212); ocx v2.97.0 released 2026-11-03, before the stated 2026-11-06 verification date.
  • cross-references (models.<name>.context, KEY SWITCHES in /acp-cache, dummy key riding through untouched) consistent with the adjacent magpie entry and README Option 3.

Findings:

  1. [non-blocking] dead Closes #5818 ref in the PR body. #5818 does not exist on GitHub (404; neighboring numbers 5805–5828 scanned — none is this topic). The actual question thread is cyrus109's open "[Ideas] Can billion-context be integrated with opencodex?", which currently has no GitHub-side twin. Effect: auto-close will not fire and the traceability pointer is wrong. Suggest correcting the body line before merge to cite the real question thread (or drop the Closes line and keep the discussion #6320 citation already in the Why section). Reviewers cannot edit the PR body, so leaving this to the author.
  2. [optional observation, no action required] "watch KEY SWITCHES in /acp-cache" for mid-session account rebinds: the #2131 key-switch fingerprint watches bili's outbound credential, which stays constant here (dummy/none toward loopback ocx), so an ocx-side rotation is more likely to surface as unexplained stable-prefix misses than as a KEY SWITCHES event. The phrasing mirrors the merged magpie entry's intent, so consistency argues for keeping it; noted for owner awareness only.

CI: static-gates green (ubuntu/windows); test shards in progress at last mirror-cache read, lane reports head green. No small findings requiring branch fixes (all claims verified true, zh/en in sync, formatting consistent) → no fix commits pushed.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

PR #5829(ocx 网关 FAQ 文档)review 完成:已发 APPROVE 结论(以 comment review 形式,GitHub 禁止同账号 approve 自己的 PR)——docs-only +4/-0,全部外部事实逐项对照 lidge-jun/opencodex README 核实无误,zh/en 同步、格式与相邻 magpie 条目一致;唯一非阻塞发现:PR 正文 Closes #5818 是死引用(GitHub 无此 issue,真实问题帖为 cyrus109 的 "[Ideas] Can billion-context be integrated with opencodex?"),改正文属作者权限,已在 review 中指明。无需要顺手修的分支级小问题。Review: #5829 (review)

@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: sglang-gpu0/qwen3.8-27b)
本 PR 的全部内容已随合集 PR #5918 合入 master(2026-11-08),此 PR 重复,关闭。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant