BerriAI/litellm · error · Exception
model is not set
Error message
model is not set
What it means
Error "model is not set" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/azure/azure.py:1471
api_version=api_version,
api_key=api_key,
timeout=timeout,
http_client=client_session,
)
model = None
# cloudflare ai gateway, needs model=None
else:
client = AzureOpenAI(
api_version=api_version,
azure_endpoint=api_base,
api_key=api_key,
timeout=timeout,
http_client=client_session,
)
# only run this check if it's not cloudflare ai gateway
if model is None and mode != "image_generation":
raise Exception("model is not set")
completion = None
if messages is None:
messages = [{"role": "user", "content": "Hey"}]
try:
completion = client.chat.completions.with_raw_response.create(
model=model,
messages=messages,
)
except Exception as e:
raise e
response: Final = {}
if completion is None or not hasattr(completion, "headers"):
raise Exception("invalid completion response")
if (View on GitHub (pinned to 6c2dcb801b)
Solutions
- Set the model parameter for the call.
When it happens
Trigger: Thrown at litellm/llms/azure/azure.py:1471 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/edbbe2c25a1c5d9a.
Report an issue: GitHub.