Skip to content

Offer Claude Sonnet 5.5 and default NEMAR to it - #524

Merged
neuromechanist merged 9 commits into
developfrom
feature/issue-522-sonnet-5-5
Sep 29, 2026
Merged

neuromechanist merged 9 commits into
developfrom
feature/issue-522-sonnet-5-5

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Closes #522

What changed

  • claude-sonnet-5-5 replaces claude-sonnet-5 in OFFERED_MODELS (same price, $2 / $10 per 1M tokens). claude-sonnet-5 and the older Sonnet ids stay in MODEL_ALIASES and resolve to the new model, so saved widget settings and community configs keep working.
  • Thinking policy: Sonnet 5.5 answers thinking: {"type": "disabled"} with a 400. create_anthropic_llm(thinking=None) now sends {"type": "between_tools"} (the model's lowest setting; the API allows it at effort high or below, and OSA never sets an effort). _validate_thinking rejects disabled on Sonnet 5.5 with a message that says so. The FAQ summarizer is the only caller that turns thinking off.
  • Pricing (claude-sonnet-5-5, anthropic/claude-sonnet-5.5; the old entries stay so earlier request logs still price), the OpenRouter slug map, widget fallback list, FAQ quality model, docs.
  • NEMAR default_model is now claude-sonnet-5-5.
  • The widget's Settings dialog asks for the model first. The API key and the model name appear only when Custom is chosen (an already-saved key stays in view so it can be removed), and a custom model cannot be saved without a key. New frontend/test-widget-settings.js (26 checks in a happy-dom window, added to CI); the other widget suites still pass.
  • Review follow-ups: figures count as 4,800 tokens (the high-resolution tier Sonnet bills; was 1,600), FAQ replies are read through extract_text, a saved claude-sonnet-5 widget setting is moved to the new id (with a drift test against the backend aliases), and the thinking=None request payload is asserted directly.

Audited and unchanged: nothing in src sends a forced tool_choice (also a 400 on Sonnet 5.5) or a non-default sampling parameter.

Testing

  • uv run pytest tests on this branch: 3087 passed, 15 failed. The same 15 tests (tests/test_api/test_chat_resume_endpoint.py, 401 instead of the expected status) fail on develop in my local environment, so they are not caused by this change.

  • A code review pass (correctness, dead literal comparisons, drift tests, langchain-anthropic behavior with between_tools) found no blocking issue.

  • .github/workflows/test.yml runs the Settings dialog suite too (tests.yml gates branch protection and test.yml runs on main; tests/test_frontend_job_parity.py fails when their frontend jobs differ).

Not verified live (needs the platform key)

The Anthropic variables are not set in my local .env, so nothing here ran against the Claude Platform on AWS endpoint. Please run before merging:

  • uv run pytest tests/test_integration/test_anthropic_platform.py -m llm (includes the new test_thinking_off_is_accepted)
  • A two-run NEMAR plot turn on Sonnet 5.5. Sonnet 5.5 ties thinking blocks to the conversation and returns a 400 if an earlier message changes after a block was produced. ChatSession.replace_history scrubs an earlier tool-result image (scrub_stored_images), and trim_messages edits the front of the history. The documentation says the check is enforced for accounts created on or after 2026-08-31 on the Claude API and Amazon Bedrock and does not say whether it applies to the Claude Platform on AWS. If it reproduces, the fix is thinking.block_binding.prefix_mismatch_behavior: "drop_block" (beta header thinking-binding-controls-2026-08-01, adaptive thinking only) or stripping thinking blocks from the edited turns.

Cost

  • NEMAR requests cost about twice what Haiku 4.5 does per token, and adaptive thinking is on at the API default effort (high), billed as output. NEMAR's budget (daily_limit_usd: 5.00, monthly_limit_usd: 50.00) was sized for Haiku; it is not changed here.
  • .env.example still says claude-sonnet-5 in two comments; edits to that file are blocked in my session, so it needs a two-word change by hand.

Sonnet 5.5 (claude-sonnet-5-5) costs the same as Sonnet 5. Earlier Sonnet
ids keep resolving, now to the new model, so saved widget settings and
community configs continue to work.

Sonnet 5.5 rejects thinking type "disabled" with a 400, so thinking=None
sends "between_tools" (its lowest setting) instead. The FAQ summarizer is
the caller that turns thinking off.

Unit tests pass. The live endpoint check (test_thinking_off_is_accepted)
was not run: the platform key is not configured locally.
The NEMAR assistant answers noticeably better on Sonnet than on Haiku.
Sonnet 5.5 costs about twice Haiku 4.5 per token ($2 / $10 versus $1 / $5
per 1M input / output tokens), so NEMAR requests get more expensive.

Community config validation passes in the full suite.
Sonnet 5 onward bills a full-size image at up to about 4784 tokens, not the
1568 of the standard tier, so the flat 1600 under-counted every NEMAR figure
by up to 3x and delayed trimming. Haiku's images are now over-counted, which
only spends headroom.

Image-budget tests pass; they use the constant, not its value.
Thinking blocks can arrive in a list-shaped reply even with extended
thinking off, and .strip() on a list raises. The FAQ scorer and summarizer
now take the text from the reply the way the rest of the code does.
The backend still resolves the retired id, but the settings dropdown lists
only offered models, so a saved claude-sonnet-5 showed as a custom model.
A drift test keeps the widget's map equal to the backend's aliases.
The payload for thinking=None on Sonnet 5.5 is asserted directly: between_tools,
and none of the parameters the model rejects.
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Preview Deployment

Name Link
Preview URL https://feature-issue-522-sonnet-5-5-demo.osc.earth
Branch feature/issue-522-sonnet-5-5
Commit 3723da7

This preview will be updated automatically when you push new commits.

The API key was the first field, with no model to use it for; the model menu
was below it. The model menu now comes first, and the model name and the
API key appear only when Custom is chosen, since they exist for a model the
community does not offer, paid for by the reader's own key. A key that is
already saved stays in view so it can be seen and removed, a custom model
cannot be saved without one, and a key the dialog is not showing is not saved.

26 checks in a happy-dom window (frontend/test-widget-settings.js, added to CI);
the other widget suites still pass.
tests.yml gates branch protection and test.yml runs on main; the two copies of the
frontend job must list the same steps, and tests/test_frontend_job_parity.py fails
when they do not. The Settings suite was added to tests.yml alone.
@neuromechanist
neuromechanist merged commit cba3506 into develop Sep 29, 2026
11 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-522-sonnet-5-5 branch September 29, 2026 04:33
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