Normalize canonical API formats

This commit is contained in:
fawney19
2026-04-29 10:20:41 +08:00
parent 02ad67fe33
commit 07a319259b
171 changed files with 2460 additions and 1962 deletions
@@ -501,7 +501,7 @@ async fn gateway_locally_denies_disallowed_claude_api_format_without_hitting_con
assert_eq!(payload["error"]["type"], "http_error");
assert_eq!(
payload["error"]["message"],
"当前密钥不允许访问 claude:chat 格式"
"当前密钥不允许访问 claude:messages 格式"
);
assert_eq!(*auth_context_hits.lock().expect("mutex should lock"), 0);
assert_eq!(*public_hits.lock().expect("mutex should lock"), 0);
@@ -625,7 +625,7 @@ async fn gateway_locally_denies_disallowed_gemini_model_without_hitting_control_
let mut snapshot = sample_currently_usable_auth_snapshot("key-gemini-123", "user-gemini-123");
snapshot.api_key_allowed_providers = Some(vec!["gemini".to_string()]);
snapshot.user_allowed_providers = Some(vec!["gemini".to_string()]);
snapshot.api_key_allowed_api_formats = Some(vec!["gemini:chat".to_string()]);
snapshot.api_key_allowed_api_formats = Some(vec!["gemini:generate_content".to_string()]);
snapshot.api_key_allowed_models = Some(vec!["gemini-1.5-pro".to_string()]);
let repository = Arc::new(InMemoryAuthApiKeySnapshotRepository::seed(vec![(
Some(hash_api_key("gemini-client-key-123")),