Skip to content

feat(adapter-openai-like): support additional request headers - #1037

Merged
dingyi222666 merged 1 commit into
v1-devfrom
feat/openai-like-addition-headers
Sep 12, 2026
Merged

dingyi222666 merged 1 commit into
v1-devfrom
feat/openai-like-addition-headers

Conversation

@dingyi222666

@dingyi222666 dingyi222666 commented Sep 12, 2026

Copy link
Copy Markdown
Member

Changes

  • Add an additionHeaders option to the openai-like adapter for custom request headers (e.g. x-opencode-session).
  • Custom headers are applied first, then the built-in headers (Authorization, Content-Type, Cookie, etc.) are applied on top, so critical headers cannot be overridden.
  • Fix additionCookies concatenation: it was treated as an object although its type is [string, string][], which produced values like 0=name,value; it is now mapped as tuples into key=value; key2=value2.
  • Add zh-CN/en-US config descriptions.

Verification

  • yarn fast-build adapter-openai-like
  • tsc --noEmit -p packages/adapter-openai-like/tsconfig.json

Closes #1035

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 1cb926d7-720d-428c-90c1-9af0cdf5eda9

📥 Commits

Reviewing files that changed from the base of the PR and between 74a2063 and fd8527e.

⛔ Files ignored due to path filters (2)
  • packages/adapter-openai-like/src/locales/en-US.schema.yml is excluded by !**/*.yml
  • packages/adapter-openai-like/src/locales/zh-CN.schema.yml is excluded by !**/*.yml
📒 Files selected for processing (2)
  • packages/adapter-openai-like/src/index.ts
  • packages/adapter-openai-like/src/requester.ts

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

配置新增 additionHeaders 字段及默认值。buildHeaders 将配置中的键值对合并到请求头中。

Changes

自定义请求头

Layer / File(s) Summary
配置定义与请求头合并
packages/adapter-openai-like/src/index.ts, packages/adapter-openai-like/src/requester.ts
Config 和配置 Schema 新增 additionHeadersbuildHeaders 将每个键值对写入请求头。

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to fd852

The added custom-header configuration is consistently passed into request construction, with no actionable merge risk identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 标题明确说明为 adapter-openai-like 增加自定义请求头功能,与变更主体一致。
Description check ✅ Passed 描述说明了 additionHeaders 配置、请求行为、配置文档和验证命令,与变更内容相关。
Linked Issues check ✅ Passed [ #1035 ] 要求为 chatluna-openai-like-adapter 增加自定义请求头,以支持 x-opencode-sessionConfig 新增 additionHeaders: [string, string][],配置 Schema 提供空数组默认值。requester.tsbuildHeaders 将每个键值对合并到请求头,因此该配置可以…
Out of Scope Changes check ✅ Passed 当前可审查的变更仅涉及 packages/adapter-openai-like/src/index.tspackages/adapter-openai-like/src/requester.ts。这些变更分别增加配置字段和请求头合并逻辑,均直接支持 #1035。未发现与该目标无关的代码变更。两个 locale schema 文件被明确排除,不能据此判断配置说明是否完整;该排除不构成…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/openai-like-addition-headers

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

小兔添上请求头,
键值成对排好队。
配置写入新字段,
请求携带新标记。
OpenAI-like 轻快跑。

Comment @coderabbitai help to get the list of available commands.

@dingyi222666
dingyi222666 force-pushed the feat/openai-like-addition-headers branch from fd8527e to 511ced8 Compare September 12, 2026 09:25
@dingyi222666
dingyi222666 force-pushed the feat/openai-like-addition-headers branch from 511ced8 to c993022 Compare September 12, 2026 09:26
@dingyi222666
dingyi222666 merged commit 6ee104f into v1-dev Sep 12, 2026
2 checks passed
@dingyi222666
dingyi222666 deleted the feat/openai-like-addition-headers branch September 12, 2026 09:26
@dingyi222666 dingyi222666 changed the title feat(adapter-openai-like): 支持自定义请求头 feat(adapter-openai-like): support additional request headers Sep 12, 2026
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.

chatluna-openai-like-adapter 希望增加自定义请求 header 功能

1 participant