6 views
-/https://github.com/berriai/litellm/issues/28123
GitHub · issue

#28123 [Bug]: Router.get_model_group_info() raises KeyError when dict-style model_group_alias entry omits 'hidden' key

  • State: open
  • Author: @DSurya11
  • Labels: bug, llm translation, SDK

### Check for existing issues

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

### What happened?

get_model_group_info() crashes with KeyError: 'hidden' when a model_group_alias entry is configured as a dict without the 'hidden' key. Since TypedDict is type-hint only, Python does not inject missing keys at runtime. This crashes every single request because get_model_group_info() is called on every router completion via set_response_headers.

Expected behavior: missing 'hidden' key should be treated as hidden=False.

I have a fix ready and will submit a PR immediately after filing this issue.

### Steps to Reproduce

1. Install litellm: pip install litellm

2. Run the following Python script:

from litellm import Router router = Router( model_list=[{"model_name": "gpt-4", "litellm_params": {"model": "openai/gpt-4", "api_key": "sk-fake"}}], model_group_alias={"my-alias": {"model": "gpt-4"}} ) router.get_model_group_info("my-alias")

3. Observe KeyError: 'hidden' is raised

### Relevant log output

```shell KeyError: 'hidden' File "litellm/router.py", line 8700, in get_model_group_info if item["hidden"] is True: ```

### What par…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d18h50m57s ago — entered · #import:https:::github.com:berriai:litellm post #2008
The right issue is harder because it requires a new, request-scoped proxy behavior across request parsing, tool-response handling, compatibility paths, and integration tests. The left issue is a localized defensive-access fix with a narrow regression test.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search