feat: production-ready OpenAI Responses API support#1446
Open
tasoo-oos wants to merge 15 commits into
Open
Conversation
57bafae to
ec7ebc0
Compare
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.
PR Checklist
Summary
Rewrites and significantly expands the OpenAI Responses API support. The previous implementation was a minimal stub: no streaming, no tool calls, no structured output, no reasoning, no NanoGPT wiring, and several correctness issues.
Related Issues
None.
Changes
Refactor
requestOpenAIResponseAPIwas extracted fromrequests.tsinto a newresponses.tsmodule and re-exported.LocalNetworkRequestOptions/getLocalNetworkRequestOptionsextracted into a newshared.tsused by both modules.ResponseOutputItem.statustype corrected from'complete'to'completed'.Behavior added/changed
TransformStreamparser).store: false: server IDs andreasoningitems are stripped before re-submission.reasoning_textcontent extracted and wrapped in<Thoughts>...</Thoughts>.text.format.reasoning_effortandverbositymodel parameters.web_search_preview.input_image,input_file).developerrole conversion for models with theDeveloperRoleflag.aiModel?.startsWith('xcustom:::')in the Chat Completions path.Tests added
requests.responses.test.ts: covers request body construction, reasoning summaries, custom/reverse proxy params, NanoGPT, text extraction, incomplete/failed responses, tool continuation sanitization (non-streaming and streaming), SSE chunk parsing, streamed reasoning, and streaming error events.Impact
requestOpenAI) is unchanged.LLMFormat.OpenAIResponseAPImodels now correctly support streaming, tool calls, structured output, and reasoning.Additional Notes
Manual E2E tests completed:
web_search_previewvia Chat bot -> Others -> Tools -> Search)https://openrouter.ai/api/v1/responsesendpoint)hasImageInputcustom flags)https://nano-gpt.com/api/v1/responsesendpoint)hasImageInputcustom flags)Footnotes
Modifies the behavior of prompting, requesting, or handling responses from AI models. ↩
Over 80% of the code is AI generated. ↩