fix: custom headers and compat for custom models - #456
Open
isWittHere wants to merge 1 commit into
Open
Conversation
Custom OpenAI-compatible endpoints often need per-request headers (such as User-Agent for gateway bot detection) and a compat flag to fall back to the system role when the server rejects the developer role. These previously required hand-editing models.json. * headers editor at both provider and model level, with model-level values overriding the provider for that model * supportsDeveloperRole toggle reads the effective provider-plus-model compat value and writes an explicit per-model override
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix
Custom OpenAI-compatible endpoints frequently need per-request headers


(such as
User-Agentfor gateway bot detection) and a compat flag tofall back to the
systemrole when the server rejects thedeveloperrole. Both previously required hand-editing
~/.pi/agent/models.json,because the custom-model UI exposed no headers or generic compat entry.
Changes
New:
components/ModelsConfig.test.mjs— source-level tests asserting theeditors are wired to the provider/model entries (27 lines)
Edited:
components/ModelsConfig.tsx— provider- and model-level headerseditors,
supportsDeveloperRoletoggle that reads the effectiveprovider-plus-model compat value and writes an explicit per-model
override,
ModelEntry.headersfield (90 lines)Net: 2 files, +117/−0
Notes for maintainers:
convention ("API override", "DeepSeek thinking compat", ...). No i18n
keys were added; happy to switch to
models.*flat keys if preferred.sendSessionAffinityHeaders/sessionAffinityFormat) are intentionally out of scope.Testing
node_modules/.bin/tsc --noEmit— passnpx eslint components/ModelsConfig.tsx— passnode --test components/ModelsConfig.test.mjs— 2/2 pass