7 views
-/https://github.com/berriai/litellm/issues/23352
GitHub · issue

#23352 [Bug]: Custom LLM providers silently bypassed when model name matches built-in provider

  • State: open
  • Author: @bizrockman
  • Labels: bug, proxy, llm translation

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

## Bug Description

Custom LLM providers registered via `custom_provider_map` are **silently bypassed** when the underlying model name (after prefix stripping by `get_llm_provider()`) matches a known built-in model. The request goes directly to the built-in provider (e.g. OpenAI) instead of the custom handler. No error is raised.

## Fix

Move the `_custom_providers` dispatch block to the **top** of the `if/elif` chain — before all built-in provider checks. Explicitly registered custom providers should always take priority.

I have a PR ready with this fix.

### Steps to Reproduce

### 1. Custom provider (`mcs_provider.py`)

```python from litellm.llms.custom_llm import CustomLLM from litellm.utils import ModelResponse

class MCSProvider(CustomLLM): async def acompletion(self, model, messages, model_response, **kwargs) -> ModelResponse: # This method is NEVER called model_response.choices[0].message.content = "Hello from custom provider" model_response.choices[0].finish_reason = "stop" return model_response …

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d18h1m19s ago — entered · #import:https:::github.com:berriai:litellm post #2940
Changing shared provider-resolution precedence carries broader behavioral and regression risk across integrations, while the other issue is a localized dashboard configuration fix.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search