Skip to content

Commit d037f9f

Browse files
Yeachan-Heoclaude
andcommitted
Fix strip_routing_prefix to handle kimi provider prefix (US-023)
Add "kimi" to the strip_routing_prefix matches so that models like "kimi/kimi-k2.5" have their prefix stripped before sending to the DashScope API (consistent with qwen/openai/xai/grok handling). Also add unit test strip_routing_prefix_strips_kimi_provider_prefix. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 330dc28 commit d037f9f

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

rust/crates/api/src/providers/openai_compat.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ fn strip_routing_prefix(model: &str) -> &str {
801801
let prefix = &model[..pos];
802802
// Only strip if the prefix before "/" is a known routing prefix,
803803
// not if "/" appears in the middle of the model name for other reasons.
804-
if matches!(prefix, "openai" | "xai" | "grok" | "qwen") {
804+
if matches!(prefix, "openai" | "xai" | "grok" | "qwen" | "kimi") {
805805
&model[pos + 1..]
806806
} else {
807807
model
@@ -2199,4 +2199,12 @@ mod tests {
21992199
assert_eq!(OpenAiCompatConfig::openai().max_request_body_bytes, 104_857_600); // 100MB
22002200
assert_eq!(OpenAiCompatConfig::xai().max_request_body_bytes, 52_428_800); // 50MB
22012201
}
2202+
2203+
#[test]
2204+
fn strip_routing_prefix_strips_kimi_provider_prefix() {
2205+
// US-023: kimi prefix should be stripped for wire format
2206+
assert_eq!(super::strip_routing_prefix("kimi/kimi-k2.5"), "kimi-k2.5");
2207+
assert_eq!(super::strip_routing_prefix("kimi-k2.5"), "kimi-k2.5"); // no prefix, unchanged
2208+
assert_eq!(super::strip_routing_prefix("kimi/kimi-k1.5"), "kimi-k1.5");
2209+
}
22022210
}

0 commit comments

Comments
 (0)