mirror of
https://github.com/githubhjs/CLIProxyAPIPlus.git
synced 2026-07-13 18:15:24 +00:00
feat(auth): add support for kiro OAuth model alias
- Introduced `kiro` channel and alias resolution in `oauth_model_alias` logic. - Updated supported channels documentation and examples to include `kiro` and `github-copilot`. - Enhanced unit tests to validate `kiro` alias functionality.
This commit is contained in:
+1
-1
@@ -218,7 +218,7 @@ nonstream-keepalive-interval: 0
|
|||||||
|
|
||||||
# Global OAuth model name aliases (per channel)
|
# Global OAuth model name aliases (per channel)
|
||||||
# These aliases rename model IDs for both model listing and request routing.
|
# These aliases rename model IDs for both model listing and request routing.
|
||||||
# Supported channels: gemini-cli, vertex, aistudio, antigravity, claude, codex, qwen, iflow.
|
# Supported channels: gemini-cli, vertex, aistudio, antigravity, claude, codex, qwen, iflow, kiro, github-copilot.
|
||||||
# NOTE: Aliases do not apply to gemini-api-key, codex-api-key, claude-api-key, openai-compatibility, vertex-api-key, or ampcode.
|
# NOTE: Aliases do not apply to gemini-api-key, codex-api-key, claude-api-key, openai-compatibility, vertex-api-key, or ampcode.
|
||||||
# You can repeat the same name with different aliases to expose multiple client model names.
|
# You can repeat the same name with different aliases to expose multiple client model names.
|
||||||
#oauth-model-alias:
|
#oauth-model-alias:
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ type Config struct {
|
|||||||
|
|
||||||
// OAuthModelAlias defines global model name aliases for OAuth/file-backed auth channels.
|
// OAuthModelAlias defines global model name aliases for OAuth/file-backed auth channels.
|
||||||
// These aliases affect both model listing and model routing for supported channels:
|
// These aliases affect both model listing and model routing for supported channels:
|
||||||
// gemini-cli, vertex, aistudio, antigravity, claude, codex, qwen, iflow.
|
// gemini-cli, vertex, aistudio, antigravity, claude, codex, qwen, iflow, kiro, github-copilot.
|
||||||
//
|
//
|
||||||
// NOTE: This does not apply to existing per-credential model alias features under:
|
// NOTE: This does not apply to existing per-credential model alias features under:
|
||||||
// gemini-api-key, codex-api-key, claude-api-key, openai-compatibility, vertex-api-key, and ampcode.
|
// gemini-api-key, codex-api-key, claude-api-key, openai-compatibility, vertex-api-key, and ampcode.
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ func modelAliasChannel(auth *Auth) string {
|
|||||||
// and auth kind. Returns empty string if the provider/authKind combination doesn't support
|
// and auth kind. Returns empty string if the provider/authKind combination doesn't support
|
||||||
// OAuth model alias (e.g., API key authentication).
|
// OAuth model alias (e.g., API key authentication).
|
||||||
//
|
//
|
||||||
// Supported channels: gemini-cli, vertex, aistudio, antigravity, claude, codex, qwen, iflow.
|
// Supported channels: gemini-cli, vertex, aistudio, antigravity, claude, codex, qwen, iflow, kiro, github-copilot.
|
||||||
func OAuthModelAliasChannel(provider, authKind string) string {
|
func OAuthModelAliasChannel(provider, authKind string) string {
|
||||||
provider = strings.ToLower(strings.TrimSpace(provider))
|
provider = strings.ToLower(strings.TrimSpace(provider))
|
||||||
authKind = strings.ToLower(strings.TrimSpace(authKind))
|
authKind = strings.ToLower(strings.TrimSpace(authKind))
|
||||||
@@ -245,7 +245,7 @@ func OAuthModelAliasChannel(provider, authKind string) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return "codex"
|
return "codex"
|
||||||
case "gemini-cli", "aistudio", "antigravity", "qwen", "iflow":
|
case "gemini-cli", "aistudio", "antigravity", "qwen", "iflow", "kiro", "github-copilot":
|
||||||
return provider
|
return provider
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
@@ -43,6 +43,15 @@ func TestResolveOAuthUpstreamModel_SuffixPreservation(t *testing.T) {
|
|||||||
input: "gemini-2.5-pro",
|
input: "gemini-2.5-pro",
|
||||||
want: "gemini-2.5-pro-exp-03-25",
|
want: "gemini-2.5-pro-exp-03-25",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "kiro alias resolves",
|
||||||
|
aliases: map[string][]internalconfig.OAuthModelAlias{
|
||||||
|
"kiro": {{Name: "kiro-claude-sonnet-4-5", Alias: "sonnet"}},
|
||||||
|
},
|
||||||
|
channel: "kiro",
|
||||||
|
input: "sonnet",
|
||||||
|
want: "kiro-claude-sonnet-4-5",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "config suffix takes priority",
|
name: "config suffix takes priority",
|
||||||
aliases: map[string][]internalconfig.OAuthModelAlias{
|
aliases: map[string][]internalconfig.OAuthModelAlias{
|
||||||
@@ -152,6 +161,8 @@ func createAuthForChannel(channel string) *Auth {
|
|||||||
return &Auth{Provider: "qwen"}
|
return &Auth{Provider: "qwen"}
|
||||||
case "iflow":
|
case "iflow":
|
||||||
return &Auth{Provider: "iflow"}
|
return &Auth{Provider: "iflow"}
|
||||||
|
case "kiro":
|
||||||
|
return &Auth{Provider: "kiro"}
|
||||||
default:
|
default:
|
||||||
return &Auth{Provider: channel}
|
return &Auth{Provider: channel}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user