hermes - ✅(Solved) Fix [Bug]: 📝 Error: Completions.create() got an unexpected keyword argument 'stream_options' [2 pull requests, 2 comments, 2 participants]

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…
GitHub stats
NousResearch/hermes-agent#14387Fetched 2026-04-24 06:17:33
View on GitHub
Comments
2
Participants
2
Timeline
9
Reactions
0
Author
Participants
Timeline (top)
labeled ×4commented ×2cross-referenced ×2renamed ×1

Error Message

(╥╥) error, retrying... 📝 Error: Completions.create() got an unexpected keyword argument 'stream_options' ⚠️ Non-retryable error (HTTP None) — trying fallback... ❌ Non-retryable error (HTTP None): Completions.create() got an unexpected keyword argument 'stream_options' ❌ Non-retryable client error (HTTP None). Aborting. 💡 This type of error won't be fixed by retrying. when I ran it with 'python test.py', it works. But when I connect the debugger then getting the error Getting Error: ╥╥) error, retrying... 📝 Error: Completions.create() got an unexpected keyword argument 'stream_options' ⚠️ Non-retryable error (HTTP None) — trying fallback... ❌ Non-retryable error (HTTP None): Completions.create() got an unexpected keyword argument 'stream_options' ❌ Non-retryable client error (HTTP None). Aborting. 💡 This type of error won't be fixed by retrying.

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fix / Workaround

(╥_╥) error, retrying...
⚠️ API call failed (attempt 1/3): TypeError 🔌 Provider: Model: gemini-3-flash-preview 🌐 Endpoint: https://generativelanguage.googleapis.com/v1beta 📝 Error: Completions.create() got an unexpected keyword argument 'stream_options' ⏱️ Elapsed: 0.13s Context: 2 msgs, ~8,092 tokens ⚠️ Non-retryable error (HTTP None) — trying fallback... 🧾 Request debug dump written to: C:\Users\gupta.hermes\sessions\request_dump_20260423_102440_dab671_20260423_102444_746602.json ❌ Non-retryable error (HTTP None): Completions.create() got an unexpected keyword argument 'stream_options' ❌ Non-retryable client error (HTTP None). Aborting. 🔌 Provider: Model: gemini-3-flash-preview 🌐 Endpoint: https://generativelanguage.googleapis.com/v1beta 💡 This type of error won't be fixed by retrying. None

Getting Error: ╥_╥) error, retrying...
⚠️ API call failed (attempt 1/3): TypeError 🔌 Provider: Model: gemini-3-flash-preview 🌐 Endpoint: https://generativelanguage.googleapis.com/v1beta 📝 Error: Completions.create() got an unexpected keyword argument 'stream_options' ⏱️ Elapsed: 0.13s Context: 2 msgs, ~8,092 tokens ⚠️ Non-retryable error (HTTP None) — trying fallback... 🧾 Request debug dump written to: C:\Users\gupta.hermes\sessions\request_dump_20260423_102707_f1587c_20260423_102711_201462.json ❌ Non-retryable error (HTTP None): Completions.create() got an unexpected keyword argument 'stream_options' ❌ Non-retryable client error (HTTP None). Aborting. 🔌 Provider: Model: gemini-3-flash-preview 🌐 Endpoint: https://generativelanguage.googleapis.com/v1beta 💡 This type of error won't be fixed by retrying. None

PR fix notes

PR #14392: fix(agent): omit stream_options for Gemini streaming

Description (problem / solution / changelog)

Fixes #14387

Root cause

Hermes always added OpenAI-specific stream_options={"include_usage": true} to chat-completions streaming calls. The direct Google/Gemini endpoint rejects that keyword, causing streaming requests to fail before a response can be read.

Fix

  • Add a small chat-completions capability guard for streaming usage chunks.
  • Omit stream_options for Gemini/Google direct endpoints.
  • Keep requesting stream_options for OpenAI-compatible aggregators such as OpenRouter so usage accounting behavior is preserved.

Tests

  • /Users/stephenyu/Documents/hermes-agent/.venv/bin/python -m pytest tests/run_agent/test_streaming.py::TestStreamingAccumulator::test_google_gemini_endpoint_omits_stream_options tests/run_agent/test_streaming.py::TestStreamingAccumulator::test_openai_compatible_streaming_keeps_stream_options -q --tb=short
  • /Users/stephenyu/Documents/hermes-agent/.venv/bin/python -m pytest tests/run_agent/test_streaming.py -q --tb=short
  • git diff --check

Changed files

  • run_agent.py (modified, +12/-1)
  • tests/run_agent/test_streaming.py (modified, +62/-1)

PR #14460: fix(agent): skip stream_options for Gemini — unsupported keyword

Description (problem / solution / changelog)

What does this PR do?

`stream_options: {"include_usage": True}` is an OpenAI-specific streaming parameter. Gemini's OpenAI-compatible endpoint rejects it with `TypeError: Completions.create() got an unexpected keyword argument 'stream_options'`, causing a non-retryable abort for all Gemini users.

The fix gates `stream_options` behind a provider + base_url check so it is only sent to endpoints that support it. Two failure paths are covered:

  • `provider="gemini"` or `"google-gemini-cli"` — explicit Gemini providers
  • `provider=""` + `googleapis.com` base URL — the reported bug scenario where the user sets a Gemini endpoint directly without naming the provider

Non-Gemini providers (OpenAI, OpenRouter, Groq, etc.) are unaffected — usage tracking continues to work normally for them.

Related Issue

Fixes #14387

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • `run_agent.py`: add `_skip_stream_options` guard in `_call_chat_completions()`; move `stream_options` to a conditional assignment
  • `tests/run_agent/test_14387_gemini_stream_options.py`: 10 tests covering both skip paths, the reported scenario (`provider="" + googleapis URL`), and regression checks for non-Gemini providers

How to Test

  1. Reproduce the bug (before fix):
    agent = AIAgent(model="gemini-2.5-flash",
                    base_url="https://generativelanguage.googleapis.com/v1beta",
                    api_key="YOUR_GEMINI_KEY")
    agent.chat("Hello")
    # → TypeError: unexpected keyword argument 'stream_options'
  2. Run the new tests:
    pytest tests/run_agent/test_14387_gemini_stream_options.py -v
  3. All 10 tests should pass.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Changed files

  • run_agent.py (modified, +9/-1)
  • tests/run_agent/test_14387_gemini_stream_options.py (added, +110/-0)

Code Example

Debug report uploaded:
  Report     https://paste.rs/GQ3JZ
  agent.log  https://paste.rs/Ju9xW

---
RAW_BUFFERClick to expand / collapse

Bug Description

(╥_╥) error, retrying...
⚠️ API call failed (attempt 1/3): TypeError 🔌 Provider: Model: gemini-3-flash-preview 🌐 Endpoint: https://generativelanguage.googleapis.com/v1beta 📝 Error: Completions.create() got an unexpected keyword argument 'stream_options' ⏱️ Elapsed: 0.13s Context: 2 msgs, ~8,092 tokens ⚠️ Non-retryable error (HTTP None) — trying fallback... 🧾 Request debug dump written to: C:\Users\gupta.hermes\sessions\request_dump_20260423_102440_dab671_20260423_102444_746602.json ❌ Non-retryable error (HTTP None): Completions.create() got an unexpected keyword argument 'stream_options' ❌ Non-retryable client error (HTTP None). Aborting. 🔌 Provider: Model: gemini-3-flash-preview 🌐 Endpoint: https://generativelanguage.googleapis.com/v1beta 💡 This type of error won't be fixed by retrying. None

Steps to Reproduce

I created a script `from run_agent import AIAgent

agent = AIAgent( model="gemini-3-flash-preview", quiet_mode=True, ) response = agent.chat("What is the capital of France?") print(response)`

when I ran it with 'python test.py', it works. But when I connect the debugger then getting the error

Expected Behavior

It should work and return answer.

Actual Behavior

Getting Error: ╥_╥) error, retrying...
⚠️ API call failed (attempt 1/3): TypeError 🔌 Provider: Model: gemini-3-flash-preview 🌐 Endpoint: https://generativelanguage.googleapis.com/v1beta 📝 Error: Completions.create() got an unexpected keyword argument 'stream_options' ⏱️ Elapsed: 0.13s Context: 2 msgs, ~8,092 tokens ⚠️ Non-retryable error (HTTP None) — trying fallback... 🧾 Request debug dump written to: C:\Users\gupta.hermes\sessions\request_dump_20260423_102707_f1587c_20260423_102711_201462.json ❌ Non-retryable error (HTTP None): Completions.create() got an unexpected keyword argument 'stream_options' ❌ Non-retryable client error (HTTP None). Aborting. 🔌 Provider: Model: gemini-3-flash-preview 🌐 Endpoint: https://generativelanguage.googleapis.com/v1beta 💡 This type of error won't be fixed by retrying. None

Affected Component

Agent Core (conversation loop, context compression, memory)

Messaging Platform (if gateway-related)

No response

Debug Report

Debug report uploaded:
  Report     https://paste.rs/GQ3JZ
  agent.log  https://paste.rs/Ju9xW

Operating System

Windows 11

Python Version

3.12.10

Hermes Version

Hermes Agent v0.10.0 (2026.4.16)

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

The bug is in 'run_agent.py' line 5603 stream_kwargs = { **api_kwargs, "stream": True, **"stream_options": {"include_usage": True},** ---? Here "timeout": _httpx.Timeout( connect=30.0, read=_stream_read_timeout, write=_base_timeout, pool=30.0, ), }

Proposed Fix (optional)

Replace run_agent.py' line 5603 stream_kwargs = { **api_kwargs, "stream": True, # **"stream_options": {"include_usage": True},** ---? Here Commenting "timeout": _httpx.Timeout( connect=30.0, read=_stream_read_timeout, write=_base_timeout, pool=30.0, ), }

After removing stream_options it is working

Are you willing to submit a PR for this?

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

extent analysis

TL;DR

The issue can be fixed by removing the stream_options keyword argument from the Completions.create() method call in run_agent.py.

Guidance

  • The error message indicates that the Completions.create() method does not expect a stream_options keyword argument, suggesting that this argument is no longer supported or has been removed.
  • To fix the issue, remove the stream_options keyword argument from the stream_kwargs dictionary in run_agent.py, as proposed in the issue.
  • Verify that the fix works by running the script again with the debugger connected.
  • If the issue persists, review the Completions.create() method documentation to ensure that the correct arguments are being passed.

Example

stream_kwargs = {
    **api_kwargs,
    "stream": True,
    "timeout": _httpx.Timeout(
        connect=30.0,
        read=_stream_read_timeout,
        write=_base_timeout,
        pool=30.0,
    ),
}

Notes

  • The proposed fix has already been tested and confirmed to work by the issue reporter.
  • The root cause of the issue is likely a change in the Completions.create() method signature that removed the stream_options argument.

Recommendation

Apply the proposed fix by removing the stream_options keyword argument from the stream_kwargs dictionary in run_agent.py, as this has been confirmed to resolve the issue.

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