Skip to content

feat(router): add OpenAI Responses API and Home Assistant model support (#374) - #383

Merged
sheepdestroyer merged 4 commits into
masterfrom
feat/responses-api-ha-support
Jul 26, 2026
Merged

feat(router): add OpenAI Responses API and Home Assistant model support (#374)#383
sheepdestroyer merged 4 commits into
masterfrom
feat/responses-api-ha-support

Conversation

@sheepdestroyer

@sheepdestroyersheepdestroyer commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Summary

This PR addresses issue #374 by implementing OpenAI Responses API support, streaming SSE tool call argument event synthesis, and Home Assistant model aliases required by Home Assistant's openai_conversation integration.

Changes Included

  1. Responses API Endpoints:

    • Added POST /v1/responses and POST /responses handlers in router/main.py proxying requests to LiteLLM's /v1/responses endpoint.
    • Preserves model triage classification when auto-routing models (llm-routing-auto-free, llm-routing-ollama) are requested.
    • Parses input_text and text content part types, extracts the latest user turn in reverse order, and joins multi-part strings with space separators.
    • Validates upstream HTTP status codes before streaming, returning proper HTTP errors instead of masking 200 streams.
    • Synthesizes response.function_call_arguments.delta and response.function_call_arguments.done SSE events during streaming for Home Assistant compatibility.
  2. Model Aliases & Configuration:

    • Added local-qwen-3.6-hass, gpt-4o-mini, and gpt-4o model definitions to litellm/config.yaml with enable_thinking: false and supports_reasoning: false.
    • Added models to public_model_groups so GET /v1/models lists them.
    • Included new model aliases in DIRECT_TIERS in router/main.py to bypass classifier overhead when specified directly.
  3. Tool Support & E2E Validation:

    • Verified and enabled support for Home Assistant Assist actions (function tool type returning function_call output), code_interpreter, and web_search.
    • Added test_ha_tool_calling to scripts/verification/verify_canonical_endpoints.py testing E2E tool calling across local-qwen-3.6-hass, gpt-4o-mini, and gpt-4o for both /v1/responses and /v1/chat/completions.
  4. Testing & Documentation:

    • Expanded automated pytest suite in router/tests/test_responses_api.py covering model routing, Responses API requests, parameterized tool calls, streaming SSE deltas, input extraction, and error handling (372/372 tests passing).
    • Added section 9e to README.md detailing Home Assistant configuration and capability requirements.

Closes#374
Supersedes #382

Summary by Sourcery

Add OpenAI-compatible Responses and audio proxy endpoints and extend model support and testing for Home Assistant integration.

New Features:

  • Expose OpenAI Responses API endpoints that proxy to LiteLLM, including support for streaming and Home Assistant-compatible tool/function calls.
  • Add audio proxy routes that forward speech-to-text and text-to-speech requests to LiteLLM with basic path validation.

Enhancements:

  • Extend direct tier model list and LiteLLM configuration to include Home Assistant-focused and OpenAI-style model aliases as public model groups.
  • Adjust whisper-related transcription models to use the correct API base path for audio requests.

Documentation:

  • Update README links to point to canonical GitHub locations and add documentation describing Home Assistant integration and Responses API support.

Tests:

  • Add a pytest suite for the Responses API covering routing, input extraction, tool usage, streaming SSE behavior, and error handling.
  • Introduce an end-to-end verification test for Home Assistant tool calling across Responses and Chat Completions APIs and register it in the canonical verification runner.

boy added 4 commits July 25, 2026 03:41
- Set supports_reasoning to false in litellm/config.yaml for non-thinking hass aliases (local-qwen-3.6-hass, gpt-4o-mini, gpt-4o)
- Support input_text and text content parts, traverse input in reverse to extract the latest user turn for triage, and join multi-part text with space separators
- Validate upstream status_code in streaming branch before returning StreamingResponse and close stream on exit
- Expand pytest suite to cover input_text parsing and streaming error status propagation
- Parameterize test_responses_api_with_tools and test_responses_api_streaming_tool_calls across local-qwen-3.6-hass, gpt-4o-mini, and gpt-4o
- Add test_ha_tool_calling function to scripts/verification/verify_canonical_endpoints.py to replicate Home Assistant Assist tool call execution via /v1/responses and /v1/chat/completions
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@sourcery-ai

Copy link
Copy Markdown
Contributor

🧙 Sourcery is reviewing your pull request!


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@sheepdestroyer, you've reached your PR review limit, so we couldn't start this review.

Next review available in:50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 81ed9a6c-6dad-489c-b11d-24ca63279a0e

📥 Commits

Reviewing files that changed from the base of the PR and between dcdd018 and 76f3f43.

📒 Files selected for processing (5)
  • README.md
  • litellm/config.yaml
  • router/main.py
  • router/tests/test_responses_api.py
  • scripts/verification/verify_canonical_endpoints.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/responses-api-ha-support

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation router scripts litellm labels Jul 26, 2026
@sheepdestroyer
sheepdestroyer merged commit a701d3e into masterJul 26, 2026
11 of 13 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationlitellmrouterscripts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add OpenAI Responses API tools support for Home Assistant

1 participant

@sheepdestroyer