Repository navigation
Conversation
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.
PR: raccoon — take a model's thinking levels from the catalog
What this fixes
packages/raccoongives every modelreasoning: trueandvariants: {}. Thevendor does not take OpenAI's
reasoning_effortat all: it takes a privatefield,
raccoon_thinking_level, whose values arelevel_1…level_5, and thevalid set differs per model. Because the plugin neither reads that capability
from the catalog nor maps an effort onto it, no client can make a Raccoon model
think — the effort name is silently ignored upstream.
Measured against
https://xiaohuanxiong.com/api/web/llm/v2/chat/completionsdirectly (same prompt,
temperature: 0):reasoning_tokensraccoon_thinking_level: level_5raccoon_thinking_level: level_5reasoning_effort: maxThat last row matters: sending
reasoning_effortdoes not raise effort there, itlowers it. So the plugin should translate the effort and not forward it.
What changed
packages/raccoon/index.mjs:parseCatalogreadsparams.raccoon_thinking(supported,can_disable,default_level,display_levels) and keeps it asthinkingon the model.
reasoningnow comes fromsupportedinstead of beinghardcoded — a catalog that names no
raccoon_thinkingat all keeps the oldtrue, so nothing regresses before the vendor serves the field.runtimeModelbuildsvariantsfrom those levels:offwhen the modelcan be disabled, plus
minimal / low / medium / high / max, each mapped to thelevel the vendor accepts.
fetchrewrites the request body: it mapsreasoning_effortonto the model's level, sets
raccoon_thinking_level, and removesreasoning_effort. A request with no effort is left byte-for-byte alone, sothe vendor's own default still applies.
The mapping is the vendor's own: the catalog labels
level_1…level_5asMinimal / Low / Medium / High / Max, so an effort name maps to the level of the
same number — one to one on a model that publishes all five. A level the model
does not publish rounds up to the next one it does; only at the top does it
fall back to the highest available.
level_1/3/5(qwen4)level_1/2/4/5(flash-lite)The catalog is warmed once inside the loader if it is not cached yet, so a
request that arrives before any model listing still gets levelled.
Tests
packages/raccoon/thinking.test.mjs, 17 tests,bun test:Covered: the capability shape and its refusals; the ranking on three- and
four-level models; exact level names;
offwith and withoutcan_disable;unknown effort names; bodies that are not JSON;
variants;parseCataloghonouring
supported: falsewhile staying compatible with a catalog that has nosuch field; and three end-to-end runs through the plugin's own loader against a
fake vendor — effort translated, effort-less request untouched, and a
provider-prefixed model name (
raccoon/sn-qwen4-max) still levelled.Verified against the vendor, without a gateway
The plugin's own loader was run directly against
https://xiaohuanxiong.com/api/web/llm/v2, with a real account, same prompt:reasoning_tokensreasoning_effort: "max"raccoon_thinking_level: "level_5", noreasoning_effortOne thing that had to be handled: the catalog now spells some ids with a
-psuffix (
sn-qwen4-max-p) while a request asks forsn-qwen4-max, and the gatewayprefixes its own provider on top.
thinkingOfnormalises all three beforematching, so the levels are found however the name is written.
Not in this PR
providers, so a user cannot inject
raccoon_thinking_levelfrom the UI today.With this change that is no longer needed: the agent's own effort setting is
what selects the level.
sn-kimi-k3-1-prorejectstemperature: 0outright (400 "temperature only 1 is allowed for this model"). Separate issue, untouched here.Verification recipe
Then, against a real account: point a client at the provider, send
reasoning_effort: maxforsn-qwen4-max, and expectreasoning_tokens > 0where it used to be 0. A model named by magpie with the provider prefix
(
raccoon/sn-qwen4-max) behaves the same as the bare id.