Skip to content

openai-codex provider should allow configurable api_mode (chat_completions vs codex_responses) #5718

@bgaither4

Description

@bgaither4

Problem

When using the openai-codex provider with a ChatGPT subscription OAuth token, Hermes hardcodes codex_responses as the API mode in run_agent.py (lines 551-553). There is no way to override this from config.yaml or environment variables.

The Codex Responses API (/v1/responses) is currently returning empty output arrays for gpt-5.4, causing:

WARNING root: Invalid API response (retry 1/3): response.output is empty | Provider: model=gpt-5.4

The standard Chat Completions API (/v1/chat/completions) works fine with the same model and subscription.

Expected behavior

model.api_mode in config.yaml or HERMES_API_MODE env var should be respected even when using the openai-codex provider, allowing users to fall back to chat_completions when the Responses endpoint is degraded.

Current behavior

The provider detection in run_agent.py overrides any user-configured api_mode:

# Line 551-553
self.api_mode = "codex_responses"

Setting model.api_mode: chat_completions in config.yaml has no effect.

Environment

  • Hermes Agent v0.7.0 (latest as of 2026-04-06)
  • Provider: openai-codex with ChatGPT Pro OAuth
  • Model: gpt-5.4
  • Platform: macOS (Apple Silicon)

Workaround

None currently. Other tools (e.g., OpenClaw) using Chat Completions with the same model and subscription work fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existsarea/configConfig system, migrations, profilescomp/agentCore agent loop, run_agent.py, prompt builderprovider/openaiOpenAI / Codex Responses APItype/featureNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions