Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(chatgpt): drop unsupported responses params for Codex

Jay Prajapatiab2d6e4eac89
diff --git a/litellm/llms/chatgpt/responses/transformation.py b/litellm/llms/chatgpt/responses/transformation.py
index 0ce24f63a89..bcb6edd39f9 100644
--- a/litellm/llms/chatgpt/responses/transformation.py
+++ b/litellm/llms/chatgpt/responses/transformation.py
@@ -73,10 +73,6 @@ class ChatGPTResponsesAPIConfig(OpenAIResponsesAPIConfig):
litellm_params,
headers,
)
- request.pop("max_output_tokens", None)
- request.pop("max_tokens", None)
- request.pop("max_completion_tokens", None)
- request.pop("metadata", None)
base_instructions = get_chatgpt_default_instructions()
existing_instructions = request.get("instructions")
if existing_instructions:
@@ -92,7 +88,22 @@ class ChatGPTResponsesAPIConfig(OpenAIResponsesAPIConfig):
if "reasoning.encrypted_content" not in include:
include.append("reasoning.encrypted_content")
request["include"] = include
- return request
+
+ allowed_keys = {
+ "model",
+ "input",
+ "instructions",
+ "stream",
+ "store",
+ "include",
+ "tools",
+ "tool_choice",
+ "reasoning",
+ "previous_response_id",
+ "truncation",
+ }
+
+ return {k: v for k, v in request.items() if k in allowed_keys}
def transform_response_api_response(
self,