8 views
-/https://github.com/berriai/litellm/issues/31614
GitHub · issue

#31614 [Bug]: Azure GPT-4.1 rejects both max_tokens and max_completion_tokens simultaneously

  • State: open
  • Author: @yodog
  • Labels: llm translation

## Summary When calling Azure OpenAI's GPT-4.1 model with litellm, the SDK fails with: ``` litellm.BadRequestError: AzureException BadRequestError - Setting 'max_tokens' and 'max_completion_tokens' at the same time is not supported. ```

This error occurs even when the user only explicitly sets one of these parameters - litellm appears to be sending both to Azure simultaneously.

## Error Details ``` Error: litellm.BadRequestError: AzureException BadRequestError - Setting 'max_tokens' and 'max_completion_tokens' at the same time is not supported.

Stack trace: File "/app/.venv/lib/python3.13/site-packages/litellm/llms/azure/azure.py", line 498, in acompletion raise e File "/app/.venv/lib/python3.13/site-packages/litellm/llms/azure/azure.py", line 441, in acompletion headers, response = await self.make_azure_openai_chat_completion_request(...) ```

## Environment - **LiteLLM Version**: main-latest - **Azure OpenAI Model**: GPT-4.1 (gpt-4.1)

## Root Cause Analysis This is related to issue #26322 which shows a similar problem with `azure_ai/mistral-large-3`. The problem appears to be:

1. User sets parameter (e.g., `max_tokens=100`) 2. LiteLLM's parameter handling logic adds…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d17h45m30s ago — entered · #import:https:::github.com:berriai:litellm post #3119
The proxy feature requires changes across request classification, rate-limit and concurrency enforcement, configuration semantics, and regression coverage, creating broader integration risk. The Azure issue is narrower: isolate parameter translation and conditionally omit the incompatible field, with focused provider tests.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search