mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-09-03 06:35:00 +08:00
feat(validation): enhance cross-family level clamping with model type mismatch handling
- Added `modelFamilyMismatch` check to improve validation for provider families reusing Claude-compatible formats (e.g., Kimi models). - Adjusted `allowClampUnsupported` logic to account for mismatched model families. - Updated `strictBudget` validation to exclude mismatched model types. - Added test cases to verify clamping behavior for Kimi models serving Claude-compatible requests.
This commit is contained in:
@@ -2887,6 +2887,33 @@ func TestThinkingE2EClaudeAdaptive_Body(t *testing.T) {
|
||||
inputJSON: `{"model":"claude-sonnet-4-6-model","messages":[{"role":"user","content":"hi"}],"thinking":{"type":"adaptive"},"output_config":{"effort":"xhigh"}}`,
|
||||
expectErr: true,
|
||||
},
|
||||
// Kimi models exposed via Claude-compatible /v1/messages keep wire format
|
||||
// claude→claude, but the model type is kimi. Claude Code often sends
|
||||
// effort=max; clamp to the highest Kimi-supported level (high).
|
||||
{
|
||||
name: "C28",
|
||||
from: "claude",
|
||||
to: "claude",
|
||||
model: "kimi-level-model",
|
||||
inputJSON: `{"model":"kimi-level-model","messages":[{"role":"user","content":"hi"}],"thinking":{"type":"adaptive"},"output_config":{"effort":"max"}}`,
|
||||
expectField: "thinking.type",
|
||||
expectValue: "adaptive",
|
||||
expectField2: "output_config.effort",
|
||||
expectValue2: "high",
|
||||
expectErr: false,
|
||||
},
|
||||
{
|
||||
name: "C29",
|
||||
from: "claude",
|
||||
to: "claude",
|
||||
model: "kimi-level-model",
|
||||
inputJSON: `{"model":"kimi-level-model","messages":[{"role":"user","content":"hi"}],"thinking":{"type":"adaptive"},"output_config":{"effort":"xhigh"}}`,
|
||||
expectField: "thinking.type",
|
||||
expectValue: "adaptive",
|
||||
expectField2: "output_config.effort",
|
||||
expectValue2: "high",
|
||||
expectErr: false,
|
||||
},
|
||||
}
|
||||
|
||||
runThinkingTests(t, cases)
|
||||
|
||||
Reference in New Issue
Block a user