diff --git a/src/proxy/google-ai.ts b/src/proxy/google-ai.ts index 95365f3..eb2b26e 100644 --- a/src/proxy/google-ai.ts +++ b/src/proxy/google-ai.ts @@ -208,8 +208,8 @@ function setStreamFlag(req: Request) { } /** - * Replaces requests for non-Google AI models with gemini-1.5-pro-latest. - * Also strips models/ from the beginning of the model IDs. + * Strips 'models/' prefix from the beginning of model IDs if present. + * No longer forces redirection to gemini-1.5-pro-latest for non-Gemini models. **/ function maybeReassignModel(req: Request) { // Ensure model is on body as a lot of middleware will expect it. @@ -219,17 +219,15 @@ function maybeReassignModel(req: Request) { } req.body.model = model; - const requested = model; - if (requested.startsWith("models/")) { - req.body.model = requested.slice("models/".length); + // Only strip the 'models/' prefix if present + if (model.startsWith("models/")) { + req.body.model = model.slice("models/".length); + req.log.info({ originalModel: model, updatedModel: req.body.model }, "Stripped 'models/' prefix from model ID"); } - - if (requested.includes("gemini")) { - return; - } - - req.log.info({ requested }, "Reassigning model to gemini-1.5-pro-latest"); - req.body.model = "gemini-1.5-pro-latest"; + + // No longer redirecting non-Gemini models to gemini-1.5-pro-latest + // This allows the original model to be passed through to the API + // If it's an invalid model, the Google AI API will return the appropriate error } // Native Google AI chat completion endpoint