Skip to content

feat: production-ready OpenAI Responses API support#1446

Open
tasoo-oos wants to merge 15 commits into
kwaroran:mainfrom
tasoo-oos:feat-openai-response-api-overhaul
Open

feat: production-ready OpenAI Responses API support#1446
tasoo-oos wants to merge 15 commits into
kwaroran:mainfrom
tasoo-oos:feat-openai-response-api-overhaul

Conversation

@tasoo-oos
Copy link
Copy Markdown
Contributor

@tasoo-oos tasoo-oos commented May 14, 2026

PR Checklist

  • Required Checks
    • Have you added type definitions?
    • Have you tested your changes?
    • Have you checked that it won't break any existing features?
  • If your PR uses models1, check the following:
    • Have you checked if it works normally in all models?
    • Have you checked if it works normally in all web, local, and node-hosted versions? If it doesn't, have you blocked it in those versions?
  • If your PR is highly AI generated2, check the following:
    • Have you understood what the code does?
    • Have you cleaned up any unnecessary or redundant code?
    • Is it not a huge change?
      • We currently do not accept highly AI generated PRs that are large changes.

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

  • requestOpenAIResponseAPI was extracted from requests.ts into a new responses.ts module and re-exported.
  • LocalNetworkRequestOptions / getLocalNetworkRequestOptions extracted into a new shared.ts used by both modules.
  • ResponseOutputItem.status type corrected from 'complete' to 'completed'.

Behavior added/changed

  • Streaming support for Responses API (SSE TransformStream parser).
  • Function/tool call execution with multi-turn continuation.
  • Sanitized continuation payloads for store: false: server IDs and reasoning items are stripped before re-submission.
  • Reasoning summaries and reasoning_text content extracted and wrapped in <Thoughts>...</Thoughts>.
  • Refusal-only responses surfaced as text.
  • JSON schema structured output via text.format.
  • reasoning_effort and verbosity model parameters.
  • Web search tool via web_search_preview.
  • Multimodal inputs (input_image, input_file).
  • developer role conversion for models with the DeveloperRole flag.
  • NanoGPT Responses endpoint, model selection, auth, and provider header.
    • It is not exposed to the UI, so end user cannot select it.
  • Reverse proxy and custom provider endpoint autofill, additional parameters, and headers.
  • Local-network routing and streaming timeout support.
  • Null-safe 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

  • The Chat Completions path (requestOpenAI) is unchanged.
  • All LLMFormat.OpenAIResponseAPI models now correctly support streaming, tool calls, structured output, and reasoning.
  • NanoGPT Responses format is properly wired (was dead code before).
    • It is not exposed to the UI yet.
  • Reverse proxy and custom providers support the Responses format with the same additional-params/headers behavior as Chat Completions.
  • Streaming for Responses API is entirely new.

Additional Notes

Manual E2E tests completed:

  • With OpenAI's official Responses API
    • Plain Streaming / Non-streaming request
    • Multimodal Input (inlay image file)
    • Integrated tool use (web_search_preview via Chat bot -> Others -> Tools -> Search)
    • External tool use (Risuai Access MCP / RisuAI Dice MCP) with Streaming / Non-streaming request
    • Summarized Reasoning Inclusion with tool use
  • With OpenRouter Responses API (by Custom API + https://openrouter.ai/api/v1/responses endpoint)
    • Plain Streaming / Non-streaming request
    • Multimodal Input (inlay image file with hasImageInput custom flags)
    • Tool use (RisuAI Dice MCP) with Streaming / Non-streaming request
    • Reasoning Inclusion with tool use
  • With NanoGPT Responses API (by Custom API + https://nano-gpt.com/api/v1/responses endpoint)
    • Plain Streaming / Non-streaming request
    • Multimodal Input (inlay image file with hasImageInput custom flags)
    • Tool use (RisuAI Dice MCP) with Streaming / Non-streaming request

Footnotes

  1. Modifies the behavior of prompting, requesting, or handling responses from AI models.

  2. Over 80% of the code is AI generated.

@tasoo-oos tasoo-oos force-pushed the feat-openai-response-api-overhaul branch from 57bafae to ec7ebc0 Compare May 16, 2026 16:02
@tasoo-oos tasoo-oos marked this pull request as ready for review May 16, 2026 17:23
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