Repository navigation
fix(providers): custom_openai Responses API fallback fails with 404/405 when chat completions unavailable #2205
Description
Bug: custom_openai Responses API fallback broken
Sentry issues
| Issue | Error | Events | First seen | Status |
|---|---|---|---|---|
| OPENHUMAN-TAURI-HJ | custom_openai API error (404 Not Found): (chat completions unavailable; responses fallback failed: custom_openai Responses API error: ) |
27 | 2026-05-15 | unresolved/new |
| OPENHUMAN-TAURI-HM | custom_openai Responses API error: |
27 | 2026-05-15 | unresolved |
| OPENHUMAN-TAURI-TV | custom_openai API error (405 Method Not Allowed): { "error": "Coding Plan is currently only available for Coding Agents" } |
22 | 2026-05-17 | unresolved/escalating |
Combined: 76 events across 3 issues. All on macOS (aarch64 + x86_64), release openhuman@0.53.43.
Affected models (from Sentry tags)
reasoning-v1,deepseek-v4-flash(TAURI-HJ/HM — 404 errors)qwen3.6-plus(TAURI-TV — 405 errors)
What happens
- User configures a
custom_openaiprovider pointing at a third-party endpoint (e.g. a local or self-hosted API). - The app sends a chat completions request to
{base_url}/chat/completions. - The endpoint returns 404 Not Found (endpoint doesn't exist) or 405 Method Not Allowed (endpoint rejects the method/model).
- Because
custom_openaiis created withOpenAiCompatibleProvider::new()which setssupports_responses_fallback = true, the code attempts a fallback to the Responses API at a derived/responsesURL. - The Responses API fallback also fails — most third-party/self-hosted endpoints don't implement OpenAI's
/v1/responsesendpoint either. - The user gets a cryptic double-error:
"chat completions unavailable; responses fallback failed: custom_openai Responses API error: "(note the empty error body — the fallback endpoint returns nothing useful).
Root cause
File: src/openhuman/inference/provider/compatible.rs
The custom_openai provider is constructed at src/openhuman/inference/provider/ops.rs:416 using OpenAiCompatibleProvider::new(), which defaults supports_responses_fallback = true (line 104). This is wrong for arbitrary user-configured endpoints.
The Responses API (/v1/responses) is an OpenAI-specific endpoint. Most third-party OpenAI-compatible providers (Ollama, LM Studio, vLLM, text-generation-webui, etc.) do not implement it. When chat completions fails with 404, the fallback to /responses is virtually guaranteed to also fail, producing a confusing double error.
The fallback logic lives in three methods in compatible.rs:
chat_with_system(line 1261): on 404, trieschat_via_responseschat_with_history(line 1382): on 404, trieschat_via_responsesnative_chat(line 1682): on 404, trieschat_via_responses
The chat_via_responses method (line 423) constructs the responses URL via responses_url() (line 347), which derives it from the base URL. When this also 404s, the error message is empty because the error body from the third-party server is empty or HTML.
For TAURI-TV specifically, the 405 is not triggering the responses fallback (only 404 does), but it shows a related problem: the custom_openai provider blindly forwards requests to endpoints that reject specific models/features, with no graceful degradation.
Proposed fix
-
Create
custom_openaiwithsupports_responses_fallback = false— changeops.rs:416to useOpenAiCompatibleProvider::new_no_responses_fallback()instead of::new(). Arbitrary user-configured endpoints should not attempt the Responses API fallback. Users who specifically want the Responses API can configure theirbase_urlto end in/responses. -
Improve the error message when chat completions returns 404 on a
custom_openaiprovider — surface a user-actionable hint like "check that your endpoint URL is correct and the model is available" instead of attempting a doomed fallback. -
Consider adding a config option (e.g.
responses_api: true/false) in the custom provider config so advanced users who connect to actual OpenAI-compatible endpoints with Responses API support can opt in.
Environment
- OS: macOS 26.3.1 (aarch64), macOS 26.4.1 (aarch64), macOS 26.5.0 (aarch64), macOS (x86_64)
- Release:
openhuman@0.53.43+2b64ea8ac567 - Rust: rustc 1.93.0 stable
Fixes OPENHUMAN-TAURI-HJ, OPENHUMAN-TAURI-HM, OPENHUMAN-TAURI-TV
Activity