feat(provider): add dedicated kimi-code provider support
This commit is contained in:
parent
ce104bed45
commit
88dcd17a30
3 changed files with 91 additions and 9 deletions
|
|
@ -314,6 +314,9 @@ fn resolve_provider_credential(name: &str, credential_override: Option<&str>) ->
|
|||
"perplexity" => vec!["PERPLEXITY_API_KEY"],
|
||||
"cohere" => vec!["COHERE_API_KEY"],
|
||||
name if is_moonshot_alias(name) => vec!["MOONSHOT_API_KEY"],
|
||||
"kimi-code" | "kimi_coding" | "kimi_for_coding" => {
|
||||
vec!["KIMI_CODE_API_KEY", "MOONSHOT_API_KEY"]
|
||||
}
|
||||
name if is_glm_alias(name) => vec!["GLM_API_KEY"],
|
||||
name if is_minimax_alias(name) => vec!["MINIMAX_API_KEY"],
|
||||
name if is_qianfan_alias(name) => vec!["QIANFAN_API_KEY"],
|
||||
|
|
@ -432,6 +435,15 @@ pub fn create_provider_with_url(
|
|||
key,
|
||||
AuthStyle::Bearer,
|
||||
))),
|
||||
"kimi-code" | "kimi_coding" | "kimi_for_coding" => Ok(Box::new(
|
||||
OpenAiCompatibleProvider::new_with_user_agent(
|
||||
"Kimi Code",
|
||||
"https://api.kimi.com/coding/v1",
|
||||
key,
|
||||
AuthStyle::Bearer,
|
||||
"KimiCLI/0.77",
|
||||
),
|
||||
)),
|
||||
"synthetic" => Ok(Box::new(OpenAiCompatibleProvider::new(
|
||||
"Synthetic", "https://api.synthetic.com", key, AuthStyle::Bearer,
|
||||
))),
|
||||
|
|
@ -787,6 +799,12 @@ pub fn list_providers() -> Vec<ProviderInfo> {
|
|||
aliases: &["kimi"],
|
||||
local: false,
|
||||
},
|
||||
ProviderInfo {
|
||||
name: "kimi-code",
|
||||
display_name: "Kimi Code",
|
||||
aliases: &["kimi_coding", "kimi_for_coding"],
|
||||
local: false,
|
||||
},
|
||||
ProviderInfo {
|
||||
name: "synthetic",
|
||||
display_name: "Synthetic",
|
||||
|
|
@ -1067,6 +1085,13 @@ mod tests {
|
|||
assert!(create_provider("kimi-cn", Some("key")).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn factory_kimi_code() {
|
||||
assert!(create_provider("kimi-code", Some("key")).is_ok());
|
||||
assert!(create_provider("kimi_coding", Some("key")).is_ok());
|
||||
assert!(create_provider("kimi_for_coding", Some("key")).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn factory_synthetic() {
|
||||
assert!(create_provider("synthetic", Some("key")).is_ok());
|
||||
|
|
@ -1399,6 +1424,7 @@ mod tests {
|
|||
"cloudflare",
|
||||
"moonshot",
|
||||
"moonshot-intl",
|
||||
"kimi-code",
|
||||
"moonshot-cn",
|
||||
"synthetic",
|
||||
"opencode",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue