Skip to content

An agent-managed museum exhibit, built in Rust with Gajae-Code / LazyCodex — developed and maintained with no human intervention.

Rust

feat: add native Gemini support to openai_compat provider

Ajinkya Kardileb071fac2cf6b
diff --git a/rust/crates/api/src/providers/openai_compat.rs b/rust/crates/api/src/providers/openai_compat.rs
index 1d53f120..4f199a3e 100644
--- a/rust/crates/api/src/providers/openai_compat.rs
+++ b/rust/crates/api/src/providers/openai_compat.rs
@@ -928,13 +928,14 @@ fn wire_model_for_base_url<'a>(
if lowered_prefix == "openai" {
let trimmed_base_url = base_url.trim_end_matches('/');
let default_openai = DEFAULT_OPENAI_BASE_URL.trim_end_matches('/');
+ if matches!(lowered_prefix.as_str(), "xai" | "grok" | "kimi" | "gemini" | "gemma") {
+ return Cow::Borrowed(&model[pos + 1..]);
+ }
if config.provider_name == "OpenAI" && trimmed_base_url != default_openai {
- // OpenAI-compatible gateways such as OpenRouter commonly use
- // slash-containing model slugs (for example `openai/gpt-4.1-mini`).
- // Preserve the slug when the user configured a non-default OpenAI
- // base URL; the prefix still routed to the OpenAI-compatible client,
- // but the gateway owns the final model namespace.
- return Cow::Borrowed(model);
+ // Only preserve the full slug if it's NOT a model we want to strip
+ if !model.contains("gemini") && !model.contains("gemma") {
+ return Cow::Borrowed(model);
+ }
}
return Cow::Borrowed(&model[pos + 1..]);
}