Repository navigation
feat(openai-compat): let a custom server declare each model's reasoning-effort levels - #100
Open
PranitSakhuja wants to merge 1 commit into
Open
PranitSakhuja wants to merge 1 commit into
PranitSakhuja wants to merge 1 commit into
Conversation
…ng-effort levels Effort was offered only on OpenAI's and Gemini's own addresses. An effortLevels map in the instance config now names the levels each model takes; they are offered on that model alone and sent as reasoning_effort. Models not listed keep what the address implies.
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.
What and why
A custom OpenAI-compatible server never offered a reasoning effort.
openai-compat.tsgave effort only to Gemini's and OpenAI's own addresses, with a fixed low/medium/high, so a relay serving a model that takesreasoning_effort(the report'sgpt-6.1-sol, which takes up tomax) showed no effort step and was never sent one.An OpenAI-compatible server can now declare the levels each model takes, in its instance config:
A declared model takes exactly those levels, and they go out as
reasoning_effortthrough the existingchosenEffortpath. A model that isn't listed keeps what the address implies: OpenAI's and Gemini's rules on their own APIs, and none anywhere else. The engine advertises the union of its levels witheffortByModel, so the picker offers a level only on the models that take it, as it already does for OpenAI and xAI.decodeConfigrefuses anything other than a map of model IDs to known levels, with a message naming the levels. The instance PATCH merges into the existing config, so a declared map survives the reply-wait setting being changed.Closes #98 for servers set up in
config.json.How it was checked
server/drivers/openai-compat.test.ts:reasoning_effort: "xhigh"for it and nothing for its other model;The first two fail on
mainand pass with the change.pnpm exec vitest run server/drivers/openai-compat.test.ts server/drivers/api-effort.test.tspasses all 55 tests.tscwith the server config passes andpnpm lintis clean.vitest run server/drivers/openai-compat server/drivers/api-effort server/drivers/openai-chat server/routes/instances server/configpasses all 603 tests. The fullpnpm testruns in CI.New behaviour has a test
No secrets, personal data or local paths in the diff
Notes for reviewers
This is the server half only. The custom-server form in Settings doesn't have an effort field yet, so for now the levels are set in
config.json. If you're happy with the config shape, I can add the field to the form as a follow-up.