feat(providers): add Vercel AI Gateway (vercel-ai-gateway)
12th provider. API-key via AI_GATEWAY_API_KEY, Bearer, OpenAI listing + ChatCompletions, Passthrough dialect. Second wire-metadata provider but takes the enrichment path instead: Vercel serves context under context_window, which WireModel ignores (reads context_length), so wire_serves_metadata=false + restrict_to_enriched pulls context/limits from the models.dev "vercel" snapshot (302/306 live ids match snapshot keys byte-for-byte, so restrict keeps essentially the whole catalog). /models is public (200 for any key), so login validation targets /credits (key_validation_path) which 401s on a bad bearer — avoids false-accepting invalid keys against the public listing. Tests: e2e proves enrichment-wins (wire context_window=999 distinct from enrichment context=400000, asserts 400000) and non-vacuous tool_call restriction; validation test proves /credits (not /models) is hit. Registry at 15 (ordinal/VARIANT_COUNT/ALL), 4 auth arrays + 16-row picker.
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(), 15, "14 login rows + Quit, got {items:?}");
|
||||
assert_eq!(items.len(), 16, "15 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 {:?}",
|
||||
@@ -6992,7 +6992,14 @@ pub(crate) mod tests {
|
||||
label: "NVIDIA NIM (API key)".into(),
|
||||
}
|
||||
);
|
||||
assert_eq!(items[14], PendingMenuItem::Quit);
|
||||
assert_eq!(
|
||||
items[14],
|
||||
PendingMenuItem::ApiKey {
|
||||
target: PlatformLogin(kigi_shell::models::PlatformId::Vercel),
|
||||
label: "Vercel AI Gateway (API key)".into(),
|
||||
}
|
||||
);
|
||||
assert_eq!(items[15], 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 {
|
||||
@@ -7003,7 +7010,7 @@ pub(crate) mod tests {
|
||||
);
|
||||
assert_eq!(
|
||||
pending_menu_items(&byok.methods, None).len(),
|
||||
15,
|
||||
16,
|
||||
"xai.api_key / cached_token must not add rows"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user