feat(grok): add admin oauth and quota support

This commit is contained in:
mayrain
2026-05-16 21:15:38 +08:00
parent cbfe1d378f
commit 936e1ae37b
61 changed files with 4748 additions and 287 deletions
@@ -4,9 +4,9 @@ pub(crate) fn normalize_provider_type_input(value: &str) -> Result<String, Strin
let normalized = value.trim().to_ascii_lowercase();
match normalized.as_str() {
"custom" | "claude_code" | "kiro" | "codex" | "chatgpt_web" | "gemini_cli"
| "antigravity" | "vertex_ai" => Ok(normalized),
| "antigravity" | "vertex_ai" | "grok" => Ok(normalized),
_ => Err(
"provider_type 仅支持 custom / claude_code / kiro / codex / chatgpt_web / gemini_cli / antigravity / vertex_ai"
"provider_type 仅支持 custom / claude_code / kiro / codex / chatgpt_web / gemini_cli / antigravity / vertex_ai / grok"
.to_string(),
),
}
@@ -260,6 +260,14 @@ mod tests {
);
}
#[test]
fn normalize_provider_type_supports_grok() {
assert_eq!(
normalize_provider_type_input(" Grok ").expect("type should normalize"),
"grok"
);
}
#[test]
fn normalize_api_format_list_dedupes_canonical_formats() {
assert_eq!(