Add extra headers support for custom LLM providers#739
Conversation
PR Reviewer Guide 🔍(Review updated until commit ec0a713)Here are some key observations to aid the review process:
|
|
Persistent review updated to latest commit c224c00 |
appergb
left a comment
There was a problem hiding this comment.
Review note: this PR needs full platform CI before it can be considered for merge. I would also like the header handling to explicitly define/guard protocol-critical headers such as Authorization, Content-Type, Accept, Host, and Content-Length so custom extra headers cannot accidentally override built-in request semantics unless that is an intentional supported feature.
|
Persistent review updated to latest commit ec0a713 |
|
Extra headers now reject protocol-critical headers case-insensitively: |
|
@appergb Full CI has passed on my fork for the latest PR head commit
The run completed successfully across Android, macOS, Windows, and Linux jobs. |
User description
背景
部分 OpenAI-compatible 的 custom LLM provider 需要通过自定义 HTTP headers 完成接入。现有配置只支持 Base URL、API Key 和 Model,无法覆盖这类 custom 接入需求,也会影响模型拉取、provider 校验和实际调用链路的一致性。
变更
验证
git diff --checknpm run build -- --mode developmentPR Type
Enhancement
Description
Added extra headers support for custom LLM providers.
Stored in credentials vault with validation (reserved headers, invalid names, line breaks).
Passed to provider config and used in model fetching and validation.
UI: new input field and i18n labels for extra headers.
Diagram Walkthrough
flowchart LR UI["Settings UI"] --> Vault["CredentialsVault"] Vault --> ProviderConfig["ProviderConfig"] ProviderConfig --> Actions["List models / Validate"] Actions --> HTTP["HTTP with extra headers"]File Walkthrough
6 files
Handle extra headers in credential commandsPass extra headers to provider config and requestPass extra headers to LLM provider builderAdd extra headers storage and validationAdd with_extra_headers method to configAdd extra headers input field in settings1 files
Add test for extra headers in model fetching5 files
Add extra headers i18n labelsAdd extra headers i18n labelsAdd extra headers i18n labelsAdd extra headers i18n labelsAdd extra headers i18n labels