Skip to content

[Bug]: xAI grok-4-1-fast returns HTTP 400 — "does not support parameter reasoningEffort" #23088

@zakame

Description

@zakame

Bug Description

Hello! First off, thank you all for this wonderful software! It has been a pleasure using this so far on both CLI and Slack, and I look forward to even more enhancements and integrations soon.

After updating hermes-agent today, every primary model call (I'm using xAI grok-4-1-fast, which I know should be retiring soon, but nevertheless,) fails immediately with HTTP 400 and falls back to the configured fallback model:

Non-retryable error (HTTP 400) — trying fallback...
Primary model failed — switching to fallback: anthropic/claude-sonnet-4.6 via openrouter

Error: HTTP 400: Error code: 400 - {'code': 'Client specified an invalid argument',
'error': 'Model grok-4-1-fast does not support parameter reasoningEffort.'}

Steps to Reproduce

  1. Configure Hermes with xAI provider + grok-4-1-fast:
   yaml
   model:
     default: grok-4-1-fast
     provider: xai
  1. Start the gateway (or CLI)
  2. Send any message

Expected Behavior

Request succeeds; model responds normally.

Actual Behavior

HTTP 400 on every call. The xAI API rejects the request because it contains a reasoningEffort parameter that grok-4-1-fast does not support.

Affected Component

Setup / Installation

Messaging Platform (if gateway-related)

N/A (CLI only)

Debug Report

Report       https://paste.rs/CL1md
  agent.log    https://dpaste.com/H4X5F7U6C
  gateway.log  https://dpaste.com/CMB243MTG

Operating System

Debian GNU/Linux 13 (trixie), kernel 6.12.85+deb13-amd64

Python Version

3.11.15

Hermes Version

v0.13.0 (2026.5.7)

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

The xAI provider plugin (plugins/model-providers/xai/__init__.py) unconditionally sets api_mode="codex_responses", routing all requests to /v1/responses. The codex transport (agent/transports/codex.py line 106–108) sends reasoning: {"effort": "medium"} for xAI. However, the xAI Responses API appears to serialize or forward this as the top-level reasoningEffort field, which grok-4-1-fast rejects - this field only works for grok-4-3 and later.

Relevant code pointers:

Reference:

Proposed Fix (optional)

Implement reasoning_effort only for Grok 4.3 and later iterations - Grok 4.1 now fails, and presumably Grok 4.20 as well.

Are you willing to submit a PR for this?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High — major feature broken, no workaroundcomp/agentCore agent loop, run_agent.py, prompt builderprovider/xaixAI (Grok)type/bugSomething isn't working

    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