Skip to content

fix(anthropic): add Claude Opus 4.8 support (adaptive thinking + pricing) - #4

Merged
GrantablePD merged 1 commit into
mainfrom
models/opus-4-8
Jun 4, 2026
Merged

fix(anthropic): add Claude Opus 4.8 support (adaptive thinking + pricing)#4
GrantablePD merged 1 commit into
mainfrom
models/opus-4-8

Conversation

@GrantablePD

Copy link
Copy Markdown
Owner

Problem

Production Hermes (Slack) is failing on every turn with HTTP 400:

"thinking.type.enabled" is not supported for this model. Use "thinking.type.adaptive" and "output_config.effort" to control thinking behavior.

Root cause

agent/anthropic_adapter.py gates adaptive-thinking behavior on hardcoded version substrings that only knew about Claude 4.6 and 4.7. With Opus 4.8 now in use, _supports_adaptive_thinking() returned False, so the adapter fell to the manual-thinking else branch and sent the legacy thinking: {type: "enabled", budget_tokens: …} payload — which 4.8 rejects.

Fix

Teach the adapter about 4.8 (mirrors upstream NousResearch#34003):

  • _ADAPTIVE_THINKING_SUBSTRINGS, _XHIGH_EFFORT_SUBSTRINGS, _NO_SAMPLING_PARAMS_SUBSTRINGS now include "4-8"/"4.8"
  • output-limit (128k) + 1M context-window entries for claude-opus-4-8
  • usage pricing for claude-opus-4-8 and the -fast variant
  • claude-opus-4.8 + claude-opus-4.8-fast added to the model pickers

Fast mode is intentionally left unchanged — Opus 4.8's fast offering is a separate model id (claude-opus-4.8-fast), not the speed=fast parameter.

Conflicts

Cherry-picked from upstream 1a7479573. The adapter + model-metadata + test hunks applied cleanly; conflicts in the fork-curated models.py / usage_pricing.py / model-catalog.json were resolved to preserve our curation while adding the 4.8 entries.

Verification

  • tests/agent/test_anthropic_adapter.py + test_model_metadata.py: 230 passed. The only 11 failures are pre-existing/environmental (credential-resolution tests that read real ANTHROPIC_* env vars + ~/.claude creds present on the dev machine) — unrelated to this change.
  • Thinking/effort/4.8 test classes: 33 passed.
  • Direct behavioral check confirms claude-opus-4-8 (all id forms) → adaptive=True, xhigh=True, no_sampling=True, max_out=128000, and no regression (4.6 still adaptive, 4.5 still manual).

Deploy note

The fix takes effect once the Railway hermes-agent service redeploys from this branch's merge to main.

🤖 Generated with Claude Code

…ing, picker

Hermes was sending the legacy `thinking: {type: "enabled"}` payload to
Opus 4.8, which the model rejects with HTTP 400:

  "thinking.type.enabled" is not supported for this model. Use
  "thinking.type.adaptive" and "output_config.effort" to control
  thinking behavior.

Root cause: the version-substring guards in anthropic_adapter.py only
recognized Claude 4.6 and 4.7, so `_supports_adaptive_thinking()` returned
False for 4.8 and the adapter fell to the manual-thinking `else` branch.

Teach the adapter about 4.8 (matching upstream NousResearch#34003):
- _ADAPTIVE_THINKING_SUBSTRINGS / _XHIGH_EFFORT_SUBSTRINGS /
  _NO_SAMPLING_PARAMS_SUBSTRINGS now include "4-8"/"4.8"
- output-limit (128k) + 1M context-window entries for claude-opus-4-8
- usage pricing for claude-opus-4-8 and -fast variant
- add 4.8 + 4.8-fast to the model pickers

Fast mode is intentionally left alone: Opus 4.8's fast offering is a
separate model id (claude-opus-4.8-fast), not the speed=fast param.

Cherry-picked from NousResearch/hermes-agent 1a74795; conflicts in the
fork-curated picker/pricing/catalog files resolved to preserve our
curation while adding the 4.8 entries.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@GrantablePD
GrantablePD merged commit 617d3a3 into main Jun 4, 2026
@GrantablePD
GrantablePD deleted the models/opus-4-8 branch June 4, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant