hermes - 💡(How to fix) Fix GPT-5.x models on custom providers never auto-upgrade to Responses API [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

In run_agent.py (AIAgent __init__), the auto-upgrade guard at line ~1268:

if (
    api_mode is None      # ← always False for custom providers
    and self.api_mode == "chat_completions"
    ...
    and self._provider_model_requires_responses_api(self.model, ...)
):
    self.api_mode = "codex_responses"

The api_mode is None condition is designed to skip upgrade when the user explicitly chose an api_mode. However, _resolve_runtime_from_pool_entry() in runtime_provider.py always passes api_mode="chat_completions" for custom providers — it's never None. This means the auto-upgrade is dead code for all custom provider configurations.

Official providers (openai-codex, copilot, etc.) aren't affected because they set codex_responses directly. Direct api.openai.com URLs work because _is_direct_openai_url() is checked independently. But any custom proxy serving GPT-5.x models hits this bug.

Fix Action

Fixed

Code Example

if (
    api_mode is None      # ← always False for custom providers
    and self.api_mode == "chat_completions"
    ...
    and self._provider_model_requires_responses_api(self.model, ...)
):
    self.api_mode = "codex_responses"

---

model:
     default: gpt-5.4-mini
     provider: my-proxy
   providers:
     my-proxy:
       base_url: http://127.0.0.1:48760/v1
       key_env: MY_API_KEY
       models:
         gpt-5.4-mini:
           context_length: 272000

---

-            api_mode is None
+            (api_mode is None or api_mode == "chat_completions")
             and self.api_mode == "chat_completions"
RAW_BUFFERClick to expand / collapse

Bug Description

When using a custom provider (e.g. Codex Manager, one-api, new-api) that proxies a ChatGPT account and serves GPT-5.x models, the auto-upgrade from chat_completions to codex_responses mode never fires. This causes all tool calls to return empty responses, because GPT-5.x models require the Responses API for function calling.

Root Cause

In run_agent.py (AIAgent __init__), the auto-upgrade guard at line ~1268:

if (
    api_mode is None      # ← always False for custom providers
    and self.api_mode == "chat_completions"
    ...
    and self._provider_model_requires_responses_api(self.model, ...)
):
    self.api_mode = "codex_responses"

The api_mode is None condition is designed to skip upgrade when the user explicitly chose an api_mode. However, _resolve_runtime_from_pool_entry() in runtime_provider.py always passes api_mode="chat_completions" for custom providers — it's never None. This means the auto-upgrade is dead code for all custom provider configurations.

Official providers (openai-codex, copilot, etc.) aren't affected because they set codex_responses directly. Direct api.openai.com URLs work because _is_direct_openai_url() is checked independently. But any custom proxy serving GPT-5.x models hits this bug.

Steps to Reproduce

  1. Set up a custom provider in ~/.hermes/config.yaml:
    model:
      default: gpt-5.4-mini
      provider: my-proxy
    providers:
      my-proxy:
        base_url: http://127.0.0.1:48760/v1
        key_env: MY_API_KEY
        models:
          gpt-5.4-mini:
            context_length: 272000
  2. The provider serves GPT-5.x via an OpenAI-compatible /v1/responses endpoint (e.g. Codex Manager proxying a ChatGPT Plus account)
  3. Send a message that triggers tool calls
  4. Expected: Hermes detects gpt-5.4-mini → auto-upgrades to codex_responses → tool calls work
  5. Actual: Hermes stays on chat_completions → sends to /v1/chat/completions → provider converts internally but loses tool_calls → model returns empty content → "Empty response from model" after 3 retries

Proposed Fix

Change the guard from api_mode is None to (api_mode is None or api_mode == "chat_completions"):

-            api_mode is None
+            (api_mode is None or api_mode == "chat_completions")
             and self.api_mode == "chat_completions"

This allows the default chat_completions mode to be upgraded when the model requires the Responses API, while still respecting explicit non-default modes (anthropic_messages, bedrock_converse).

Environment

  • Hermes Agent v0.13.0 (commit cede61298)
  • Custom provider: Codex Manager (proxying ChatGPT Plus account)
  • Model: gpt-5.4-mini / gpt-5.4
  • OS: Ubuntu 20.04

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix GPT-5.x models on custom providers never auto-upgrade to Responses API [1 pull requests]