Skip to content

Use Claude Code with your ChatGPT, Kimi, Cursor or Grok subscription via a local Anthropic-compatible proxy

Rust

feat(grok): add Grok 4.7 support (#162)

Ilya Biin8ad2f7a0d9c2
diff --git a/src/providers/grok/translate/model_allowlist.rs b/src/providers/grok/translate/model_allowlist.rs
index 3398d33..070fd60 100644
--- a/src/providers/grok/translate/model_allowlist.rs
+++ b/src/providers/grok/translate/model_allowlist.rs
@@ -3,9 +3,22 @@ pub fn resolve_model(model: &str) -> String {
}
pub fn assert_allowed_model(model: &str) -> anyhow::Result<()> {
- if matches!(model, "grok-composer-2.5-fast" | "grok-4.5" | "grok-4.6") {
+ if matches!(
+ model,
+ "grok-composer-2.5-fast" | "grok-4.5" | "grok-4.6" | "grok-4.7"
+ ) {
Ok(())
} else {
anyhow::bail!("unsupported Grok model")
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn grok_4_7_is_allowed() {
+ assert!(assert_allowed_model("grok-4.7").is_ok());
+ }
+}
diff --git a/src/registry.rs b/src/registry.rs
index 3d9c727..506588a 100644
--- a/src/registry.rs
+++ b/src/registry.rs
@@ -51,7 +51,8 @@ pub(crate) const CODEX_MODELS: &[&str] = &[
];
pub(crate) const KIMI_MODELS: &[&str] = &["kimi-for-coding", "kimi-k2.6", "kimi-k3", "k2.6", "k3"];
-pub(crate) const GROK_MODELS: &[&str] = &["grok-composer-2.5-fast", "grok-4.5", "grok-4.6"];
+pub(crate) const GROK_MODELS: &[&str] =
+ &["grok-composer-2.5-fast", "grok-4.5", "grok-4.6", "grok-4.7"];
pub struct Registry {
alias_provider: AliasProvider,
@@ -404,6 +405,18 @@ mod tests {
);
}
+ #[test]
+ fn grok_4_7_routes_to_grok() {
+ let registry = Registry::new(AliasProvider::Codex);
+ assert_eq!(
+ registry
+ .provider_for_model("grok-4.7", None)
+ .unwrap()
+ .name(),
+ "grok"
+ );
+ }
+
#[test]
fn opencode_models_route_without_stealing_existing_provider_ids() {
let registry = Registry::new(AliasProvider::Codex);