Skip to content

OpenAI: preserve Chat Completions response_format when forwarding to Responses#1452

Open
zhuhaow wants to merge 4 commits intoWei-Shaw:mainfrom
zhuhaow:fix/chat-structured-output-forwarding
Open

OpenAI: preserve Chat Completions response_format when forwarding to Responses#1452
zhuhaow wants to merge 4 commits intoWei-Shaw:mainfrom
zhuhaow:fix/chat-structured-output-forwarding

Conversation

@zhuhaow
Copy link
Copy Markdown

@zhuhaow zhuhaow commented Apr 4, 2026

What changed

  • preserve Chat Completions response_format when requests are forwarded through the Responses API
  • keep structured output schemas intact for both OpenAI API key and OpenAI OAuth accounts
  • add regression tests for request conversion and forwarding

Why

  • Chat Completions requests were dropping response_format during Chat -> Responses translation
  • that caused structured output schemas to be lost before the upstream request was sent

Testing

  • GOCACHE=/tmp/sub2api-go-build GOMODCACHE=/tmp/sub2api-go-mod go test ./internal/pkg/apicompat ./internal/service -run 'TestChatCompletionsToResponses_ResponseFormat|TestOpenAIGatewayService_ForwardAsChatCompletions_(APIKey|OAuth)PreservesStructuredOutput'

@zhuhaow zhuhaow changed the title Fix chat completions structured output forwarding OpenAI: preserve Chat Completions response_format when forwarding to Responses Apr 4, 2026
@zhuhaow zhuhaow force-pushed the fix/chat-structured-output-forwarding branch from bc9dfc8 to 5b86d08 Compare April 4, 2026 00:49
@zhuhaow zhuhaow marked this pull request as draft April 5, 2026 09:06
@zhuhaow zhuhaow marked this pull request as ready for review April 5, 2026 09:55
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.

1 participant