#26979 [Bug]: Gemini custom api_base with full model route gets duplicate path appended
## Describe the bug
When `model="gemini/..."` is used with a custom `api_base` that already includes the full Gemini route (or the `/models/{model}` prefix), LiteLLM appends the model route again inside `_check_custom_proxy()`, producing an invalid URL.
This showed up downstream in OpenHands as: - OpenHands/OpenHands#14028 - OpenHands/OpenHands#14029
Example shape of the bad duplication: - input `api_base` already contains something like `.../v1beta/models/gemini-2.5-flash-lite:generateContent` - LiteLLM builds `.../v1beta/models/gemini-2.5-flash-lite:generateContent/models/gemini-2.5-flash-lite:generateContent`
## Why I'm opening this issue even though there are related threads
I found related items, but they are not the same thing:
- **BerriAI/litellm#24786** โ this appears to be the exact code fix, but it has been open/stale since 2026-03-30 and does not seem to have landed. - **BerriAI/litellm#4317** โ older general custom `api_base` / Vertex AI thread, not this exact duplicated full-route regression. - **BerriAI/litellm#23846** โ adjacent Gemini custom `api_base` issue, but specifically about context caching + `model=None`. - **BerriAI/litellm#26724** โ adjacent feature โฆ