feat(providers): add Kimi For Coding via static KIMI_API_KEY
Provider 16 (19th registry variant). Same endpoint + models + Kimi dialect as the existing OAuth kimi-code platform (api.kimi.com/coding/v1 via the KIGI_CODE_BASE_URL override), but authenticated with a static KIMI_API_KEY instead of the device flow — for users who have a Kimi For Coding key rather than an OAuth subscription. Bearer, OpenAI listing, ChatCompletions, ChatCompat::Kimi, wire_serves_metadata=true (Kimi /models self-serves context/thinking), restrict_to_enriched=false (clean 3-model catalog). /coding/v1/models is auth-gated (401) so it doubles as the validator. No collision: KIMI_API_KEY was previously unused (grep-verified), and the house BYOK reads only KIGI_API_KEY/XAI_API_KEY/legacy. kimi-code (OAuth) and kimi-coding (static key) are independently gated (OAuth-token vs key) and their models get distinct managed keys (kimi-code/k3 vs kimi-coding/k3) — a user with both simply sees each Kimi model twice; no dedup collision, no crash. Review (6 areas): no blocking defects; confirmed the spec correctly mirrors KIMI_CODE_SPEC (differing only in uses_oauth/api_key_envs/console_host/labels) and the coexistence is benign. Strengthened the e2e's dialect assertion (Kimi is the default ChatCompat, so it did not discriminate a parse failure) by also asserting parse_managed_model_key attributes the key to KimiCoding. Tests: e2e proves wire-served context (1_048_576 from the wire) with the models.dev fetch SKIPPED (all-wire-metadata provider, .expect(0)), bare-id round-trip under kimi-coding/, Kimi dialect; validation test rejects a 401 from /models. Registry at 19; picker 20 rows; snapshot already bundles kimi-for-coding.
This commit is contained in:
@@ -6894,7 +6894,7 @@ pub(crate) mod tests {
|
||||
#[test]
|
||||
fn pending_menu_items_lists_interactive_methods_plus_quit() {
|
||||
let items = pending_menu_items(&fresh_user_auth_methods(), None);
|
||||
assert_eq!(items.len(), 19, "18 login rows + Quit, got {items:?}");
|
||||
assert_eq!(items.len(), 20, "19 login rows + Quit, got {items:?}");
|
||||
assert!(
|
||||
matches!(&items[0], PendingMenuItem::Login { label } if label == "Kimi Code (OAuth)"),
|
||||
"row 0 must be the OAuth login, got {:?}",
|
||||
@@ -7020,7 +7020,14 @@ pub(crate) mod tests {
|
||||
label: "Qwen Token Plan China (API key)".into(),
|
||||
}
|
||||
);
|
||||
assert_eq!(items[18], PendingMenuItem::Quit);
|
||||
assert_eq!(
|
||||
items[18],
|
||||
PendingMenuItem::ApiKey {
|
||||
target: PlatformLogin(kigi_shell::models::PlatformId::KimiCoding),
|
||||
label: "Kimi For Coding (API key)".into(),
|
||||
}
|
||||
);
|
||||
assert_eq!(items[19], PendingMenuItem::Quit);
|
||||
// The non-interactive methods must never appear as rows.
|
||||
let byok = kigi_shell::agent::auth_method::build_auth_methods(
|
||||
kigi_shell::agent::auth_method::AuthMethodsBuildInputs {
|
||||
@@ -7031,7 +7038,7 @@ pub(crate) mod tests {
|
||||
);
|
||||
assert_eq!(
|
||||
pending_menu_items(&byok.methods, None).len(),
|
||||
19,
|
||||
20,
|
||||
"xai.api_key / cached_token must not add rows"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user