mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-10-13 02:59:53 +08:00
- Add `claude.model-level-cooling` configuration to scope rate limit cooldowns to the requested model. - Treat overage-only and spend cap rejections as model-scoped when shared subscription windows remain healthy. - Propagate model-level cooling settings into streaming, token counting, and direct execution error classifiers. Closes: #5915
66 lines
1.4 KiB
Go
66 lines
1.4 KiB
Go
package config
|
|
|
|
import "testing"
|
|
|
|
func TestParseConfigBytesClaudeCodeModelListCloaking(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
yaml string
|
|
want bool
|
|
}{
|
|
{
|
|
name: "defaults to enabled cloaking",
|
|
yaml: "port: 8317\n",
|
|
want: false,
|
|
},
|
|
{
|
|
name: "disables model list cloaking",
|
|
yaml: "claude-code:\n disable-cloaking-model-list: true\n",
|
|
want: true,
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
cfg, errParse := ParseConfigBytes([]byte(tt.yaml))
|
|
if errParse != nil {
|
|
t.Fatalf("ParseConfigBytes() error = %v", errParse)
|
|
}
|
|
if got := cfg.ClaudeCode.DisableCloakingModelList; got != tt.want {
|
|
t.Fatalf("DisableCloakingModelList = %t, want %t", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestParseConfigBytesClaudeModelLevelCooling(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
yaml string
|
|
want bool
|
|
}{
|
|
{
|
|
name: "defaults to false",
|
|
yaml: "port: 8317\n",
|
|
want: false,
|
|
},
|
|
{
|
|
name: "enables model-level cooling",
|
|
yaml: "claude:\n model-level-cooling: true\n",
|
|
want: true,
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
cfg, errParse := ParseConfigBytes([]byte(tt.yaml))
|
|
if errParse != nil {
|
|
t.Fatalf("ParseConfigBytes() error = %v", errParse)
|
|
}
|
|
if got := cfg.Claude.ModelLevelCooling; got != tt.want {
|
|
t.Fatalf("cfg.Claude.ModelLevelCooling = %t, want %t", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|