Skip to content

[Bug]: Model Alias Resolution Causes Permission Check Failure #13310

@subnet-dev

Description

@subnet-dev

What happened?

When using LiteLLM version 1.74.9 as a backend, there appears to be a problem with model alias resolution that causes permission checking to fail. The API correctly lists a model alias (e.g., "Qwen/Qwen3-Coder-480B-A35B-Instruct"), but when attempting to use that model for chat completion, LiteLLM resolves it to the actual model name (e.g., "Qwen/Qwen3-Coder-480B-A35B-Instruct-bfloat16") and then checks permissions against the resolved name instead of the alias that was provided.

Expected behavior

The model alias should be usable for chat completion without permission issues, with permission checking happening against the alias name that was provided.

Actual behavior

LiteLLM resolves the alias to the actual model name and then checks permissions against this resolved name, resulting in a 401 error even though the key should have access to the model.

Steps to Reproduce

  1. Set up LiteLLM with version 1.74.9
  2. Configure a model with an alias (e.g., "Qwen/Qwen3-Coder-480B-A35B-Instruct") that points to the actual model (e.g., "Qwen/Qwen3-Coder-480B-A35B-Instruct-bfloat16")
  3. Create an API key that only has access to the alias model name
  4. Use the following minimal Python script to reproduce the issue:
from openai import OpenAI

client = OpenAI(
    base_url="https://your-private-endpoint.com/v1",
    api_key="your-api-key",
)

# List models
models = client.models.list()
print("Available models:")
for model in models.data:
    print(f"- {model.id}")

# Use the first model for chat completion - will fail with 401 error if it's an alias
if models.data:
    model_id = models.data[0].id
    print(f"\nTrying to use model: {model_id}")
    completion = client.chat.completions.create(
        model=model_id,
        messages=[{"role": "user", "content": "Hello"}],
    )
  1. Run the script and observe the 401 error regarding the resolved model name

Relevant log output

python3 basic_api_test.py
Available models:
- Qwen/Qwen3-Coder-480B-A35B-Instruct

Trying to use model: Qwen/Qwen3-Coder-480B-A35B-Instruct
Traceback (most recent call last):
  File "/Users/bob/Documents/projects/ai-client-examples/basic_api_test.py", line 18, in <module>
    completion = client.chat.completions.create(
        model=model_id,
        messages=[{"role": "user", "content": "Hello"}],
    )
  File "/Users/bob/.venv/ai-project/lib/python3.13/site-packages/openai/_utils/_utils.py", line 287, in wrapper
    return func(*args, **kwargs)
  File "/Users/bob/.venv/ai-project/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 1087, in create
    return self._post(
           ~~~~~~~~~~^
        "/chat/completions",
        ^^^^^^^^^^^^^^^^^^^^
    ...<43 lines>...
        stream_cls=Stream[ChatCompletionChunk],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/bob/.venv/ai-project/lib/python3.13/site-packages/openai/_base_client.py", line 1249, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bob/.venv/ai-project/lib/python3.13/site-packages/openai/_base_client.py", line 1037, in request
    raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'error': {'message': "key not allowed to access model. This key can only access models=['Qwen/Qwen3-Coder-480B-A35B-Instruct']. Tried to access Qwen/Qwen3-Coder-480B-A35B-Instruct-bfloat16", 'type': 'key_model_access_denied', 'param': 'model', 'code': '401'}}

Are you a ML Ops Team?

No

What LiteLLM version are you on ?

v1.74.9

Twitter / LinkedIn details

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions