-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Add day 0 support for gpt-5.4 #22916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,96 @@ | ||||||||
| --- | ||||||||
| slug: gpt_5_4 | ||||||||
| title: "GPT-5.4 Model Support" | ||||||||
| date: 2026-03-05T10:00:00 | ||||||||
| authors: | ||||||||
| - name: Sameer Kankute | ||||||||
| title: SWE @ LiteLLM (LLM Translation) | ||||||||
| url: https://www.linkedin.com/in/sameer-kankute/ | ||||||||
| image_url: https://pbs.twimg.com/profile_images/2001352686994907136/ONgNuSk5_400x400.jpg | ||||||||
| - name: Krrish Dholakia | ||||||||
| title: "CEO, LiteLLM" | ||||||||
| url: https://www.linkedin.com/in/krish-d/ | ||||||||
| image_url: https://pbs.twimg.com/profile_images/1298587542745358340/DZv3Oj-h_400x400.jpg | ||||||||
| - name: Ishaan Jaff | ||||||||
| title: "CTO, LiteLLM" | ||||||||
| url: https://www.linkedin.com/in/reffajnaahsi/ | ||||||||
| image_url: https://pbs.twimg.com/profile_images/1613813310264340481/lz54oEiB_400x400.jpg | ||||||||
| description: "GPT-5.4 model support in LiteLLM" | ||||||||
| tags: [openai, gpt-5.4, completion] | ||||||||
| hide_table_of_contents: false | ||||||||
| --- | ||||||||
|
|
||||||||
| import Tabs from '@theme/Tabs'; | ||||||||
| import TabItem from '@theme/TabItem'; | ||||||||
|
|
||||||||
| LiteLLM now supports fully GPT-5.4! | ||||||||
|
|
||||||||
| ## Docker Image | ||||||||
|
|
||||||||
| ```bash | ||||||||
| docker pull ghcr.io/berriai/litellm:v1.81.14-stable.gpt-4o | ||||||||
| ``` | ||||||||
|
|
||||||||
|
Comment on lines
+31
to
+33
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docker image tag references wrong model The Docker image pulled and run in the usage example is tagged
Suggested change
|
||||||||
| ## Usage | ||||||||
|
|
||||||||
| <Tabs> | ||||||||
| <TabItem value="proxy" label="LiteLLM Proxy"> | ||||||||
|
|
||||||||
| **1. Setup config.yaml** | ||||||||
|
|
||||||||
| ```yaml | ||||||||
| model_list: | ||||||||
| - model_name: gpt-5.4 | ||||||||
| litellm_params: | ||||||||
| model: openai/gpt-5.4 | ||||||||
| api_key: os.environ/OPENAI_API_KEY | ||||||||
| ``` | ||||||||
|
|
||||||||
| **2. Start the proxy** | ||||||||
|
|
||||||||
| ```bash | ||||||||
| docker run -d \ | ||||||||
| -p 4000:4000 \ | ||||||||
| -e OPENAI_API_KEY=$OPENAI_API_KEY \ | ||||||||
| -v $(pwd)/config.yaml:/app/config.yaml \ | ||||||||
| ghcr.io/berriai/litellm:v1.81.14-stable.gpt-4o \ | ||||||||
| --config /app/config.yaml | ||||||||
| ``` | ||||||||
|
|
||||||||
| **3. Test it** | ||||||||
|
|
||||||||
| ```bash | ||||||||
| curl -X POST "http://0.0.0.0:4000/chat/completions" \ | ||||||||
| -H "Content-Type: application/json" \ | ||||||||
| -H "Authorization: Bearer $LITELLM_KEY" \ | ||||||||
| -d '{ | ||||||||
| "model": "gpt-5.4", | ||||||||
| "messages": [ | ||||||||
| {"role": "user", "content": "Write a Python function to check if a number is prime."} | ||||||||
| ] | ||||||||
| }' | ||||||||
| ``` | ||||||||
|
|
||||||||
| </TabItem> | ||||||||
| <TabItem value="sdk" label="LiteLLM SDK"> | ||||||||
|
|
||||||||
| ```python | ||||||||
| from litellm import completion | ||||||||
|
|
||||||||
| response = completion( | ||||||||
| model="openai/gpt-5.4", | ||||||||
| messages=[ | ||||||||
| {"role": "user", "content": "Write a Python function to check if a number is prime."} | ||||||||
| ], | ||||||||
| ) | ||||||||
|
|
||||||||
| print(response.choices[0].message.content) | ||||||||
| ``` | ||||||||
|
|
||||||||
| </TabItem> | ||||||||
| </Tabs> | ||||||||
|
|
||||||||
| ## Notes | ||||||||
|
|
||||||||
| - Use `/responses` for better model performance. | ||||||||
| - GPT-5.4 supports reasoning, function calling, vision, and tool-use — see the [OpenAI provider docs](../../docs/providers/openai) for advanced usage. | ||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,11 +48,11 @@ def is_model_gpt_5_1_codex_max_model(cls, model: str) -> bool: | |
|
|
||
| @classmethod | ||
| def is_model_gpt_5_1_model(cls, model: str) -> bool: | ||
| """Check if the model is a gpt-5.1 or gpt-5.2 chat variant. | ||
| """Check if the model is a gpt-5.1, gpt-5.2, or gpt-5.4 chat variant. | ||
|
|
||
| gpt-5.1/5.2 support temperature when reasoning_effort="none", | ||
| gpt-5.1/5.2/5.4 support temperature when reasoning_effort="none", | ||
| unlike base gpt-5 which only supports temperature=1. Excludes | ||
| pro variants which keep stricter knobs and gpt-5.2-chat variants | ||
| pro variants which keep stricter knobs and chat-only variants | ||
| which only support temperature=1. | ||
| """ | ||
| model_name = model.split("/")[-1] | ||
|
|
@@ -62,7 +62,12 @@ def is_model_gpt_5_1_model(cls, model: str) -> bool: | |
| and "pro" not in model_name | ||
| and not model_name.startswith("gpt-5.2-chat") | ||
| ) | ||
| return is_gpt_5_1 or is_gpt_5_2 | ||
| is_gpt_5_4 = ( | ||
| model_name.startswith("gpt-5.4") | ||
| and "pro" not in model_name | ||
| and not model_name.startswith("gpt-5.4-chat") | ||
| ) | ||
| return is_gpt_5_1 or is_gpt_5_2 or is_gpt_5_4 | ||
|
Comment on lines
+65
to
+70
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoded model name violates no-hardcoding rule The custom rule for this repository explicitly prohibits hardcoding model-specific flags directly in transformation code. Instead, capabilities should be read from
The same hardcoded pattern also exists in Context Used: Rule from
Comment on lines
+65
to
+70
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoded model-specific flag violates the no-hardcoding rule. Custom rule [2605a1b1] explicitly requires putting model capabilities in If Context Used: Rule from |
||
|
|
||
| @classmethod | ||
| def is_model_gpt_5_2_pro_model(cls, model: str) -> bool: | ||
|
|
@@ -74,7 +79,7 @@ def is_model_gpt_5_2_pro_model(cls, model: str) -> bool: | |
| def is_model_gpt_5_2_model(cls, model: str) -> bool: | ||
| """Check if the model is a gpt-5.2 variant (including pro).""" | ||
| model_name = model.split("/")[-1] | ||
| return model_name.startswith("gpt-5.2") | ||
| return model_name.startswith("gpt-5.2") or model_name.startswith("gpt-5.4") | ||
|
Comment on lines
79
to
+82
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The method is named return model_name.startswith("gpt-5.2") or model_name.startswith("gpt-5.4")This is semantically wrong and will be a source of confusion for future contributors who call If
Comment on lines
79
to
+82
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Method name return model_name.startswith("gpt-5.2") or model_name.startswith("gpt-5.4")This misleads future contributors who expect the method to only match gpt-5.2 variants. Downstream callers in Consider either introducing a separate |
||
|
|
||
| def get_supported_openai_params(self, model: str) -> list: | ||
| if self.is_model_gpt_5_search_model(model): | ||
|
|
@@ -113,7 +118,7 @@ def get_supported_openai_params(self, model: str) -> list: | |
| "web_search_options", | ||
| ] | ||
|
|
||
| # gpt-5.1/5.2 support logprobs, top_p, top_logprobs when reasoning_effort="none" | ||
| # gpt-5.1/5.2/5.4 support logprobs, top_p, top_logprobs when reasoning_effort="none" | ||
| if not self.is_model_gpt_5_1_model(model): | ||
| non_supported_params.extend(["logprobs", "top_p", "top_logprobs"]) | ||
|
|
||
|
|
@@ -156,7 +161,7 @@ def map_openai_params( | |
| else: | ||
| raise litellm.utils.UnsupportedParamsError( | ||
| message=( | ||
| "reasoning_effort='xhigh' is only supported for gpt-5.1-codex-max and gpt-5.2 models." | ||
| "reasoning_effort='xhigh' is only supported for gpt-5.1-codex-max, gpt-5.2, and gpt-5.4+ models." | ||
| ), | ||
| status_code=400, | ||
| ) | ||
|
|
@@ -170,7 +175,7 @@ def map_openai_params( | |
| "max_tokens" | ||
| ) | ||
|
|
||
| # gpt-5.1/5.2 support logprobs, top_p, top_logprobs only when reasoning_effort="none" | ||
| # gpt-5.1/5.2/5.4 support logprobs, top_p, top_logprobs only when reasoning_effort="none" | ||
| if self.is_model_gpt_5_1_model(model): | ||
| sampling_params = ["logprobs", "top_logprobs", "top_p"] | ||
| has_sampling = any(p in non_default_params for p in sampling_params) | ||
|
|
@@ -181,7 +186,7 @@ def map_openai_params( | |
| else: | ||
| raise litellm.utils.UnsupportedParamsError( | ||
| message=( | ||
| "gpt-5.1/5.2 only support logprobs, top_p, top_logprobs when " | ||
| "gpt-5.1/5.2/5.4 only support logprobs, top_p, top_logprobs when " | ||
| "reasoning_effort='none'. Current reasoning_effort='{}'. " | ||
| "To drop unsupported params set `litellm.drop_params = True`" | ||
| ).format(reasoning_effort), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker image tag references GPT-4o instead of GPT-5.4. The tag
v1.81.14-stable.gpt-4oexplicitly names gpt-4o, which conflicts with this blog post documenting gpt-5.4 support. Update to a release tag that actually contains gpt-5.4 support, or use a generic/latest tag if the appropriate release doesn't exist yet.