mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7713] [MERGED] fix(models): recognize proxy and gateway model ids on their native provider #7889
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7889
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7713
Author: @Gunterlie
Created: 10/16/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @Gunterlie
Base:
staging← Head:fix/proxy-model-id-recognition📝 Commits (5)
4e876fefix(models): recognize proxy-tagged model ids on their native provider4c3d16efix(models): cover common proxy and gateway id conventions2c285d1fix(models): scan proxy id tags linearly and strip samplers after custom parametersa6e78eefix(models): keep trimmed ids, cap suffix passes, read thinking-disable through the tag677062ffix(models): trim after an @ modifier and read thinking through trailing tags📊 Changes
7 files changed (+457 additions, -59 deletions)
View changed files
📝
packages/server/src/services/generation/provider-generation-runtime.ts(+2 -1)📝
packages/server/src/services/llm/providers/anthropic.provider.ts(+17 -6)📝
packages/server/src/services/llm/providers/google.provider.ts(+2 -1)📝
packages/server/src/services/llm/providers/openai.provider.ts(+18 -15)📝
packages/shared/src/constants/generation-parameter-relevance.ts(+10 -9)📝
packages/shared/src/constants/model-lists.ts(+141 -27)➕
scripts/regressions/proxy-model-ids.regression.ts(+267 -0)📄 Description
Why
This comes from a user report (Android/Termux, v2.5.0, LinkAPI). No issue was opened for it.
The problem is not LinkAPI-specific. Proxies and gateways decorate model ids in a few common ways: reseller channel tags (new-api/one-api forks), thinking/effort switches in the name, organisation or provider paths, date pins, and dotted versions. On a native provider type (for example an Anthropic connection pointed at a proxy), Marinara looked these ids up in its built-in catalog by exact match only, so it treated them as unknown models. Unknown models on a provider with a catalog get only max tokens and custom parameters: no reasoning effort, no thinking, no sampling controls, and no context or output limits. Many capability checks are also anchored at the start of the id (
^gpt-6…,(?:^|\/)gemini-4-argon,(?:^|\/)claude-opus-5[.-]5), so a leading tag defeated them too.What changed
One shared normalizer in
packages/shared/src/constants/model-lists.ts; every capability lookup goes through it. The id sent to the provider is never rewritten: requests carry exactly the id the user configured.capabilityModelId(model)— what every capability predicate,resolveProviderReasoningEffort, the parameter-relevance rules and the providers' model-family checks read: trimmed, lower case, without[次],[SP],[free],【限时】,(…)(new-api/one-api resellers such as LinkAPI);(high)/(8192), Claude Code[1m], new-api@thinking:on, Vertex@20250805.Vendor paths stay, because the OpenRouter rules read them.
findKnownModel— exact match first, then the catalog form of the id:vendor/…, Chutesdeepseek-ai/…, CLIProxyAPIprovider://…;:variantdropped: OpenRouter:free/:thinking, NanoGPT:thinking, Bedrock:0;us.anthropic.claude-…-v1;@YYYYMMDDread as Anthropic's-YYYYMMDD;claude-opus-4.6. This generalises the old Opus/Sonnet 5.5-only alias.Then known proxy suffixes are removed one at a time, only while the id is still unknown:
-thinking,-thinking-<budget>,-nothinkingand effort tails-none/-minimal/-low/-medium/-high/-xhigh/-max;-think,-nothinkand-search;-r;-tee;-YYYYMMDD,-YYYY-MM-DDand-MMDD.Real catalog ids that end the same way (
command-r,gpt-5.1-codex-max,grok-4-0709,grok-4-fast-reasoning,glm-4-32b-0414-128k) match as they are. Real distinct models whose base is not in the catalog (kimi-k2-thinking,grok-4-1-fast-reasoning) stay unknown and do not borrow another model's limits.impliesProxyThinking(model)— ids that make the proxy turn reasoning on whatever the request says:-thinking,-thinking-<budget>, effort tails on Claude/GPT-5/o-series, and@thinking:<on|budget>;-think;(<level|budget>).Off forms (
-nothinking,-thinking-0,@thinking:off,(none),()) do not count. Anthropic rejects sampling and forced tool choice while thinking runs, and GPT-5 rejects temperature while reasoning. So:Before this change these ids were "unknown", so they got no sampling at all. Without this rule, recognising them would have started sending temperature to a proxy that thinks on its own. Thinking/effort settings Marinara sends still apply where the proxy keeps them.
Files touched:
model-lists.ts,generation-parameter-relevance.ts,anthropic.provider.ts,openai.provider.ts,google.provider.ts,provider-generation-runtime.ts.New regression
scripts/regressions/proxy-model-ids.regression.tscovers:body.modelstays[次]claude-opus-4-6-thinking.Sources for the conventions:
/api/pricingrelaykit/relayconvert/reasoning/suffix.go/v1/modelslistsLimits
cc-,sf-,alicloud-), LinkAPI-openai-compact,-instant,-a, and image-c/-hvariants.openai/gpt-5.5on a native OpenAI connection, though the catalog lookup does.anthropic/claude-opus-4.7is unchanged.Validation
node scripts/run-regressions.mjs --filter proxy-model-ids— passedpnpm check— passed (exit 0; one pre-existing client lint warning in an untouched file)coderabbit review --committed, both commits) — completed, 0 findingsManual verification
[次]claude-opus-4-6-thinkingon an Anthropic connection via LinkAPI shows the reasoning effort control and hides temperature in the generation parameters editor.output_config.effortandthinking(debug mode final request log) withmodelexactly[次]claude-opus-4-6-thinking, and that LinkAPI answers without a 400.[SP]claude-opus-4-6(no suffix) shows reasoning effort and temperature, and sends temperature with effort Off.[次]gemini-2.5-pro) on a Google connection via LinkAPI shows reasoning effort.claude-sonnet-4-5-thinkon an Anthropic connection shows reasoning effort and answers.zai-org/GLM-5.1-TEEon a custom connection shows the GLM 5.1 context size.my-custom-model) still shows only max tokens and custom parameters.Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.