Skip to content

fix(openai): bridge gpt-5.6+ tools to /v1/responses without reasoning… - #50

Merged
lkapadiya-DO merged 4 commits into
release/v1.83.10-stable.do.7from
lkapadiya/gpt-5.6-tools-responses-bridge
Jul 29, 2026
Merged

fix(openai): bridge gpt-5.6+ tools to /v1/responses without reasoning…#50
lkapadiya-DO merged 4 commits into
release/v1.83.10-stable.do.7from
lkapadiya/gpt-5.6-tools-responses-bridge

Conversation

@lkapadiya-DO

@lkapadiya-DO lkapadiya-DO commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

…_effort

OpenAI rejects gpt-5.6 family tool calls on chat/completions when a default reasoning_effort is applied server-side. Port BerriAI#34043 onto the DO release bridge so tools-only requests auto-route to Responses.

JIRA: https://do-internal.atlassian.net/browse/INF-991
Summary

  • Port BerriAI/litellm#34043 onto the DO release bridge so gpt-5.6+ + function tools on /v1/chat/completions auto-route to /v1/responses even when reasoning_effort is omitted.

  • OpenAI applies a default reasoning_effort server-side for this family and rejects tools on chat/completions (use /v1/responses or set reasoning_effort to 'none'), which was blocking IR from rolling out gpt-5.6.

  • Add is_model_gpt_5_6_plus_model / shared minor-version helper; keep gpt-5.4/5.5 tools-only on chat completions (unchanged).

  • Also includes DO release-branch CI fixes needed for this PR: OpenAPI status enum (queued), Black formatting, and Ruff PLR0915 noqa on Anthropic stream next.

Relevant issues

BerriAI#33221

Test

Case 1: 5.6 + tools, no reasoning_effort
Request:

curl -sS -X POST "$BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer $MODEL_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai-gpt-5.6-sol",
    "messages": [
      {
        "role": "user",
        "content": "What'\''s the weather like in Boston today? in celsius"
      }
    ],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_current_weather",
          "description": "Get the current weather in a given location",
          "parameters": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "description": "The city and state, e.g. San Francisco, CA"
              },
              "unit": {
                "type": "string",
                "enum": ["celsius", "fahrenheit"]
              }
            },
            "required": ["location"]
          }
        }
      }
    ]
  }' | jq .

Response(Before this change):

{
  "error": {
    "message": "Function tools with reasoning_effort are not supported for gpt-5.6-sol in /v1/chat/completions. To use function tools, use /v1/responses or set reasoning_effort to 'none'.",
    "type": "invalid_request_error"
  },
  "message": "Function tools with reasoning_effort are not supported for gpt-5.6-sol in /v1/chat/completions. To use function tools, use /v1/responses or set reasoning_effort to 'none'.",
  "status_code": 400
}

Response(After this change):

{
  "choices": [
    {
      "finish_reason": "tool_calls",
      "index": 0,
      "logprobs": null,
      "message": {
        "content": null,
        "reasoning_content": null,
        "refusal": null,
        "role": "assistant",
        "tool_calls": [
          {
            "function": {
              "arguments": "{\"location\":\"Boston, MA\",\"unit\":\"celsius\"}",
              "name": "get_current_weather"
            },
            "id": "call_sVZWp6N06UeVte1rBQ4gHmvm",
            "type": "function"
          }
        ]
      }
    }
  ],
  "created": 1785253709,
  "id": "chatcmpl-1820079d-330f-46a0-8a86-58f1ee1f28b6",
  "model": "openai-gpt-5.6-sol",
  "object": "chat.completion",
  "usage": {
    "cache_created_input_tokens": 0,
    "cache_creation": {
      "ephemeral_1h_input_tokens": 0,
      "ephemeral_5m_input_tokens": 0
    },
    "cache_read_input_tokens": 0,
    "completion_tokens": 26,
    "completion_tokens_details": {
      "reasoning_tokens": 0
    },
    "prompt_tokens": 82,
    "prompt_tokens_details": {
      "cached_tokens": 0
    },
    "speed": null,
    "total_tokens": 108
  }
}

Case 2: Streaming + tools, no reasoning_effort

Request:

curl -sS -N -X POST "$BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer $MODEL_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai-gpt-5.6-sol",
    "stream": true,
    "messages": [{"role": "user", "content": "Weather in Boston. Use the tool."}],
    "tools": [{
      "type": "function",
      "function": {
        "name": "get_current_weather",
        "description": "Get weather",
        "parameters": {
          "type": "object",
          "properties": {"location": {"type": "string"}},
          "required": ["location"]
        }
      }
    }]
  }'

Response(Before this change):

{"error":{"message":"Function tools with reasoning_effort are not supported for gpt-5.6-sol in /v1/chat/completions. To use function tools, use /v1/responses or set reasoning_effort to 'none'.","type":"invalid_request_error"},"message":"Function tools with reasoning_effort are not supported for gpt-5.6-sol in /v1/chat/completions. To use function tools, use /v1/responses or set reasoning_effort to 'none'.","status_code":400}

Response(After this change):

data: {"choices":[{"delta":{"content":"","role":"assistant"},"finish_reason":null,"index":0,"logprobs":null}],"created":1785256488,"id":"chatcmpl-d5bc9dd0-decf-4339-bc69-fdd043c3a97e","model":"openai-gpt-5.6-sol","object":"chat.completion.chunk"}

data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":"","name":"get_current_weather"},"id":"call_Ek9RoMV8xcH9STAV4YYU58X3","index":0,"type":"function"}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1785256488,"id":"chatcmpl-d5bc9dd0-decf-4339-bc69-fdd043c3a97e","model":"openai-gpt-5.6-sol","object":"chat.completion.chunk"}

data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":"{\""},"index":0,"type":"function"}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1785256488,"id":"chatcmpl-64f417da-6343-4b46-88cd-fd08d5dc0c97","model":"openai-gpt-5.6-sol","object":"chat.completion.chunk"}

data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":"location"},"index":0,"type":"function"}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1785256488,"id":"chatcmpl-f7f1f16c-2394-4599-899b-340e5a8b50a4","model":"openai-gpt-5.6-sol","object":"chat.completion.chunk"}

data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":"\":\""},"index":0,"type":"function"}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1785256488,"id":"chatcmpl-b9b48f4a-ec3e-407c-8a2c-5804e5be06db","model":"openai-gpt-5.6-sol","object":"chat.completion.chunk"}

data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":"Boston"},"index":0,"type":"function"}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1785256488,"id":"chatcmpl-fe730778-bc4f-4f5b-89af-90caff9d4e65","model":"openai-gpt-5.6-sol","object":"chat.completion.chunk"}

data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":","},"index":0,"type":"function"}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1785256488,"id":"chatcmpl-4e05f9da-ffc3-4a21-92a3-594490d675eb","model":"openai-gpt-5.6-sol","object":"chat.completion.chunk"}

data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":" MA"},"index":0,"type":"function"}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1785256488,"id":"chatcmpl-7f319d6a-53c1-48d0-873e-b6b02ffdeafd","model":"openai-gpt-5.6-sol","object":"chat.completion.chunk"}

data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":"\"}"},"index":0,"type":"function"}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1785256488,"id":"chatcmpl-5a95f24e-82b9-4f62-a911-20d22b07180f","model":"openai-gpt-5.6-sol","object":"chat.completion.chunk"}

data: {"choices":[{"delta":{},"finish_reason":"tool_calls","index":0,"logprobs":null}],"created":1785256488,"id":"chatcmpl-79e8ca2a-b0b1-475d-bfdb-f927bc22088d","model":"openai-gpt-5.6-sol","object":"chat.completion.chunk"}

data: {"choices":[],"created":1785256488,"id":"chatcmpl-79e8ca2a-b0b1-475d-bfdb-f927bc22088d","model":"openai-gpt-5.6-sol","object":"chat.completion.chunk","usage":{"cache_created_input_tokens":0,"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_read_input_tokens":0,"completion_tokens":21,"completion_tokens_details":{"reasoning_tokens":0},"prompt_tokens":48,"prompt_tokens_details":{"cached_tokens":0},"speed":null,"total_tokens":69}}

data: [DONE]

Case 3: Multi-tool call

Request:

curl -sS -X POST "$BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer $MODEL_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai-gpt-5.6-sol",
    "messages": [{"role": "user", "content": "What is the weather in Boston and the time in UTC? Use tools."}],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_current_weather",
          "description": "Get weather",
          "parameters": {
            "type": "object",
            "properties": {"location": {"type": "string"}},
            "required": ["location"]
          }
        }
      },
      {
        "type": "function",
        "function": {
          "name": "get_time",
          "description": "Get current time for a timezone",
          "parameters": {
            "type": "object",
            "properties": {"timezone": {"type": "string"}},
            "required": ["timezone"]
          }
        }
      }
    ]
  }' | jq '{finish: .choices[0].finish_reason, tools: [.choices[0].message.tool_calls[]?.function.name], error}'

Response(Before this change):

{
  "finish": null,
  "tools": [],
  "error": {
    "message": "Function tools with reasoning_effort are not supported for gpt-5.6-sol in /v1/chat/completions. To use function tools, use /v1/responses or set reasoning_effort to 'none'.",
    "type": "invalid_request_error"
  }
}

Response(After this change):

{
  "finish": "tool_calls",
  "tools": [
    "get_current_weather",
    "get_time"
  ],
  "error": null
}

Test plan
[x] Unit: responses_api_bridge + is_model_gpt_5_6_plus tests
[x] Preview via inference-proxy

lkapadiya-DO and others added 4 commits July 27, 2026 14:26
…_effort

OpenAI rejects gpt-5.6 family tool calls on chat/completions when a default
reasoning_effort is applied server-side. Port BerriAI#34043 onto the
DO release bridge so tools-only requests auto-route to Responses.

Co-authored-by: Cursor <cursoragent@cursor.com>
Google's live Interactions OpenAPI spec now includes queued alongside
budget_exceeded; update the DO compliance assertion to match.

Co-authored-by: Cursor <cursoragent@cursor.com>
Reformat 15 files that fail black --check on the DO release line; unrelated
to the gpt-5.6 responses bridge but required for PR CI to pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
Match __anext__; Black reformatting pushed sync __next__ over the
statement limit and fails release-branch ruff CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
@lkapadiya-DO
lkapadiya-DO marked this pull request as ready for review July 28, 2026 17:31
@lkapadiya-DO
lkapadiya-DO merged commit e3f6495 into release/v1.83.10-stable.do.7 Jul 29, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants