Skip to content

[Bug]: [OpenAI API] HTTP 400 for gpt-4.1 and gpt-4o-mini on Hermes 0.16.0 (Windows) while direct API calls work #46516

Closed as not planned

Description

@robinyjsky-robin

Bug Description

Title: OpenAI API provider fails with HTTP 400 on Hermes 0.16.0 (Windows)

Environment

  • Hermes version: 0.16.0 (2026.6.5)
  • OS: Windows 10 AMD64
  • Python: 3.11.15
  • OpenAI SDK: 2.24.0

Configuration

  • Provider: openai-api

  • Models tested:

    • gpt-4.1
    • gpt-4o-mini
  • OpenAI API key configured and detected by Hermes

Observed behavior

Running:

hermes chat

and sending a simple prompt:

hello

always returns:

HTTP 400: Error code: 400

Relevant log entries:

provider=openai-api
base_url=https://api.openai.com/v1
model=gpt-4.1

API call failed (attempt 1/3)
error_type=BadRequestError
summary=HTTP 400: Error code: 400

The same behavior occurs with gpt-4o-mini.

Verification performed

  1. OpenAI API key is valid.
  2. Direct API call succeeds:

Invoke-RestMethod https://api.openai.com/v1/models

returns model list successfully.

  1. Hermes status shows:

Provider: OpenAI API
Model: gpt-4.1

  1. Hermes works correctly when switched to Nous Portal.

Additional observation

Logs show:

OpenAI client created (codex_stream_request)

even though the selected provider is openai-api.

Question:
Could Hermes be sending an invalid request payload through the OpenAI provider path or incorrectly routing requests through codex_stream_request?

Steps to Reproduce

Title: OpenAI API provider fails with HTTP 400 on Hermes 0.16.0 (Windows)

Environment

  • Hermes version: 0.16.0 (2026.6.5)
  • OS: Windows 10 AMD64
  • Python: 3.11.15
  • OpenAI SDK: 2.24.0

Configuration

  • Provider: openai-api

  • Models tested:

    • gpt-4.1
    • gpt-4o-mini
  • OpenAI API key configured and detected by Hermes

Observed behavior

Running:

hermes chat

and sending a simple prompt:

hello

always returns:

HTTP 400: Error code: 400

Relevant log entries:

provider=openai-api
base_url=https://api.openai.com/v1
model=gpt-4.1

API call failed (attempt 1/3)
error_type=BadRequestError
summary=HTTP 400: Error code: 400

The same behavior occurs with gpt-4o-mini.

Verification performed

  1. OpenAI API key is valid.
  2. Direct API call succeeds:

Invoke-RestMethod https://api.openai.com/v1/models

returns model list successfully.

  1. Hermes status shows:

Provider: OpenAI API
Model: gpt-4.1

  1. Hermes works correctly when switched to Nous Portal.

Additional observation

Logs show:

OpenAI client created (codex_stream_request)

even though the selected provider is openai-api.

Question:
Could Hermes be sending an invalid request payload through the OpenAI provider path or incorrectly routing requests through codex_stream_request?

Expected Behavior

When configured with a valid OpenAI API key and the OpenAI API provider, Hermes should successfully send a chat request to the OpenAI API and return the model response.

Steps performed:

  1. Configured Hermes 0.16.0 with a valid OpenAI API key.
  2. Selected OpenAI API as the active provider.
  3. Tested with both gpt-4.1 and gpt-4o-mini.
  4. Started a new chat session and entered a simple prompt ("hello").

Expected result:

Hermes should return a normal response from the selected OpenAI model, such as a greeting or other generated text.

Actual result:

Hermes consistently returns HTTP 400 (BadRequestError) and no model response is produced.

Additional verification:

  • The same API key successfully accesses https://api.openai.com/v1/models via direct REST calls.
  • Hermes works normally when switched to the Nous Portal provider.
  • Therefore the OpenAI API credentials, network connectivity, and OpenAI account appear to be functioning correctly.

Actual Behavior

Hermes was configured to use the OpenAI API provider with a valid OpenAI API key.

Environment:

  • Hermes Agent 0.16.0 (2026.6.5)

  • Windows 10 AMD64

  • Python 3.11.15

  • OpenAI SDK 2.24.0

  • Provider: openai-api

  • Models tested:

    • gpt-4.1
    • gpt-4o-mini

Steps to reproduce:

  1. Configure a valid OpenAI API key.

  2. Select OpenAI API as the active provider.

  3. Start Hermes Chat.

  4. Enter a simple prompt such as:

    hello

Observed behavior:

Hermes initializes normally but fails when sending the first request to OpenAI.

CLI output:

● hello
Initializing agent...

⚠️ API call failed (attempt 1/3): BadRequestError [HTTP 400]
🔌 Provider: openai-api
Model: gpt-4.1
🌐 Endpoint: https://api.openai.com/v1

❌ Non-retryable error (HTTP 400): HTTP 400: Error code: 400
❌ Non-retryable client error (HTTP 400). Aborting.

Error: Error code: 400

The same error occurs with gpt-4o-mini.

Relevant log entries:

provider=openai-api
base_url=https://api.openai.com/v1
model=gpt-4.1

OpenAI client created (codex_stream_request, shared=False)

API call failed (attempt 1/3)
error_type=BadRequestError
summary=HTTP 400: Error code: 400

Non-retryable client error: Error code: 400

Additional observations:

Provider: OpenAI API
Model: gpt-4.1
OpenAI API key: set
  • Switching Hermes to Nous Portal works immediately and returns responses normally.

This suggests the issue is specific to Hermes' OpenAI provider integration rather than the OpenAI API key, account, billing, or network connectivity.

Affected Component

Setup / Installation

Messaging Platform (if gateway-related)

No response

Debug Report

Debug report uploaded:
  Report       https://paste.rs/vuoH8
  agent.log    https://paste.rs/ESY73
  desktop.log  https://paste.rs/luqhc

Operating System

Windows 11

Python Version

No response

Hermes Version

No response

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Activity

  1. added
    type/bugSomething isn't working
    P2Medium — degraded but workaround exists
    comp/agentCore agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint
    on Jun 15, 2026
  2. teknium1 commented on Sep 19, 2026

    @teknium1
    Collaborator

    Thanks for the careful verification. OpenAI client created (codex_stream_request) is expected: on current main every api.openai.com request is sent over the Responses API (b1d05df, agent/agent_init.py::_resolve_api_mode), which gpt-4.1 and gpt-4o-mini support — so the routing is not the bug, and 0.16.0 hid the actual 400 body. Since 093f567 Hermes prints the provider's error message for 400s. Could you update (hermes update) and paste the full BadRequestError text (it now names the rejected parameter) plus the agent.log lines around it? Closing until then; happy to reopen with the body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/agentCore agent runtime: loop, agent_init, prompt builder, context-compression, responses endpointprovider/openaiOpenAI / Codex Responses APItype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions