mirror of
https://github.com/router-for-me/CLIProxyAPIPlus.git
synced 2026-04-26 22:35:51 +00:00
feat(config): add default Kiro model aliases for standard Claude model names
Kiro models are exposed with kiro- prefix (e.g., kiro-claude-sonnet-4-5), which prevents clients like Claude Code from using standard model names (e.g., claude-sonnet-4-20250514). This change injects default oauth-model-alias entries for the kiro channel when no user-configured aliases exist, following the same pattern as the existing Antigravity defaults. The aliases map standard Claude model names (both with and without date suffixes) to their kiro-prefixed counterparts. Default aliases added: - claude-sonnet-4-5-20250929 / claude-sonnet-4-5 → kiro-claude-sonnet-4-5 - claude-sonnet-4-20250514 / claude-sonnet-4 → kiro-claude-sonnet-4 - claude-opus-4-6 → kiro-claude-opus-4-6 - claude-opus-4-5-20251101 / claude-opus-4-5 → kiro-claude-opus-4-5 - claude-haiku-4-5-20251001 / claude-haiku-4-5 → kiro-claude-haiku-4-5 All aliases use fork: true to preserve the original kiro-* names. User-configured kiro aliases are respected and not overridden. Closes router-for-me/CLIProxyAPIPlus#208
This commit is contained in:
@@ -736,8 +736,32 @@ func payloadRawString(value any) ([]byte, bool) {
|
||||
// SanitizeOAuthModelAlias normalizes and deduplicates global OAuth model name aliases.
|
||||
// It trims whitespace, normalizes channel keys to lower-case, drops empty entries,
|
||||
// allows multiple aliases per upstream name, and ensures aliases are unique within each channel.
|
||||
// It also injects default aliases for channels that have built-in defaults (e.g., kiro)
|
||||
// when no user-configured aliases exist for those channels.
|
||||
func (cfg *Config) SanitizeOAuthModelAlias() {
|
||||
if cfg == nil || len(cfg.OAuthModelAlias) == 0 {
|
||||
if cfg == nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Inject default Kiro aliases if no user-configured kiro aliases exist
|
||||
if cfg.OAuthModelAlias == nil {
|
||||
cfg.OAuthModelAlias = make(map[string][]OAuthModelAlias)
|
||||
}
|
||||
if _, hasKiro := cfg.OAuthModelAlias["kiro"]; !hasKiro {
|
||||
// Check case-insensitive too
|
||||
found := false
|
||||
for k := range cfg.OAuthModelAlias {
|
||||
if strings.EqualFold(strings.TrimSpace(k), "kiro") {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
cfg.OAuthModelAlias["kiro"] = defaultKiroAliases()
|
||||
}
|
||||
}
|
||||
|
||||
if len(cfg.OAuthModelAlias) == 0 {
|
||||
return
|
||||
}
|
||||
out := make(map[string][]OAuthModelAlias, len(cfg.OAuthModelAlias))
|
||||
|
||||
Reference in New Issue
Block a user