fix(anthropic): add Claude Opus 4.8 support (adaptive thinking + pricing) - #4
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Production Hermes (Slack) is failing on every turn with HTTP 400:
Root cause
agent/anthropic_adapter.pygates 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()returnedFalse, so the adapter fell to the manual-thinkingelsebranch and sent the legacythinking: {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_SUBSTRINGSnow include"4-8"/"4.8"claude-opus-4-8claude-opus-4-8and the-fastvariantclaude-opus-4.8+claude-opus-4.8-fastadded to the model pickersFast mode is intentionally left unchanged — Opus 4.8's fast offering is a separate model id (
claude-opus-4.8-fast), not thespeed=fastparameter.Conflicts
Cherry-picked from upstream
1a7479573. The adapter + model-metadata + test hunks applied cleanly; conflicts in the fork-curatedmodels.py/usage_pricing.py/model-catalog.jsonwere 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 realANTHROPIC_*env vars +~/.claudecreds present on the dev machine) — unrelated to this change.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-agentservice redeploys from this branch's merge tomain.🤖 Generated with Claude Code