feat: add native OpenAI Responses API pass-through#267
Open
shulin16 wants to merge 1 commit into
Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c9c89bc0-58cc-4dc8-89a0-83e012ff8c4f
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /responsesandPOST /v1/responsesendpointsWhy this approach
This overlaps in endpoint scope with #219 and #230, but deliberately uses a raw pass-through instead of parsing and rebuilding Responses API output. That preserves typed SSE event lines and forward-compatible payload fields, and avoids the async-generator serialization issue reported on #230.
It also adds behavior not covered by those proposals: forwarding request text without JSON reserialization, propagating the inbound
AbortSignal, stripping stale compression/length headers after fetch decoding, preserving non-2xx JSON and SSE bodies, and exposing retry/request headers through CORS.#263 solves a different problem by adapting Responses-only models back into Chat Completions shape; this PR exposes the native OpenAI Responses API shape unchanged.
Validation
bun test— 61 passingbun run typecheckbun run lintbun run build