Skip to content

feat(anthropic): add Claude Haiku 5.5 - #4072

Merged
crazywoola merged 2 commits into
langgenius:mainfrom
tim-gregory-pt:feat/anthropic-haiku-5-5
Oct 19, 2026
Merged

crazywoola merged 2 commits into
langgenius:mainfrom
tim-gregory-pt:feat/anthropic-haiku-5-5

Conversation

@tim-gregory-pt

Copy link
Copy Markdown
Contributor

Summary

Closes #4071.

Adds claude-haiku-5-5 (released 2026-10-07) as a predefined model, following the official specifications.

Haiku 5.5 has the same request shape as Claude Opus 5, which the plugin already supports. Thinking is adaptive and on by default, thinking.type=disabled is accepted only at effort high or below, and effort, task budgets and structured output all go through output_config. Sampling parameters, budget_tokens and assistant prefill are rejected with a 400. The main difference from Opus 5 is that the default effort is medium.

So the change is:

  • a new model YAML, based on claude-opus-5.yaml, with effort defaulting to medium;
  • claude-haiku-5 added to the existing lists in llm.py: adaptive thinking, default-on thinking, the disabled-thinking effort cap, and task budgets. Prefill suppression and native 1M context come with the adaptive-thinking list;
  • the custom-model schema's effort default set to medium for Haiku 5.5, matching Opus 5.5;
  • a fix in the stream handler, in a separate commit, for an empty <think></think> at the start of every streamed answer when thinking display is omitted. That is the default for adaptive-thinking models, so it affects Opus 5 and Sonnet 5 today and would affect every Haiku 5.5 user.

The think-tag fix. With display omitted, the API streams each thinking block as one empty thinking_delta followed by a signature_delta. The handler opened the think tag on the first delta of any thinking block, so the answer began with <think>\n\n</think>\n\n, including structured-output JSON. The tag now opens on the first non-empty thinking text and closes only if it was opened. The block-type variable that drove the old close is no longer read, so it's removed. Summarized thinking streams exactly as before.

The model-list part of the llm.py change shouldn't conflict with the open Anthropic PRs (#3967, #3976, #4034). The think-tag fix edits the same two close conditions as #3976, so whichever of the two merges second needs a small rebase. I'm happy to do it.

Pricing uses the rates for prompts up to 100K tokens ($0.10 / $0.50 per MTok). Longer prompts are billed at $0.50 / $2.50, which the flat pricing block can't express; the YAML says so in a comment. Cache reads are 10% of input, which is the plugin's existing default multiplier.

Release Notes

  • Add Claude Haiku 5.5 with a 1M-token context window and 128K-token output limit.
  • Support adaptive thinking (on by default, can be turned off), effort with a medium default, task budgets, and native structured output.
  • Fix streamed answers starting with an empty think block when thinking display is omitted.

Change Type

  • Documentation / non-plugin change
  • Non-LLM plugin (tools, extensions, datasource, etc.)
  • LLM plugin

LLM Plugin Checklist

  • New models / model parameter fixes

Version

  • Bumped the top-level manifest.yaml version to 0.3.35.
  • No dependency changes.

Testing

  • New tests/test_haiku55_parameters.py (9 tests) covers:

    • the schema defaults against the docs;
    • omitted, explicit-on and explicit-off thinking;
    • the effort clamp at xhigh/max with thinking off;
    • task budget together with structured output;
    • no assistant prefill in JSON mode;
    • the custom-model effort default.

    All 9 failed before the change.

  • Three new stream tests in tests/test_stream_and_hardening.py use the event sequence the API sends with display omitted: thinking followed by text, thinking followed by stop, and an empty first delta followed by real thinking text. The first two failed before the fix. The third passed before and after; it checks that real thinking still opens the tag once.

  • uv run --frozen --python 3.12 pytest --ignore=tests/test_llm_live.py -q: 140 passed. Main has 128 and this PR adds 12.

  • uv lock --check and git diff --check pass.

  • Dify CLI 0.6.11 packages the plugin.

  • Live, in a self-hosted Dify 1.17.1 against the Anthropic API: a build of this branch ran Haiku 5.5 on two LLM nodes of a chatflow, 111 calls across three settings, and none failed. One node had a structured-output schema; the other answered over prompts of about 11K tokens.

    • Effort and the thinking toggle took effect. On the answering node, median completion tokens were 1,024 at the default effort medium, 873 at low and 337 with thinking off, and median time to first answer text was 7.0 s, 6.1 s and 4.1 s.

    • Structured output went through output_config.format, and the node parsed it on all 60 calls.

    • Dify's cost tracking matched the rates for prompts up to 100K tokens. No prompt reached 100K.

    • That run used the branch without the think-tag fix. 15 of its outputs began with an empty <think></think>, which is how the bug was found. The plugin's stream log showed the event sequence that the new tests reproduce.

One other existing behaviour showed up in that run, and this PR doesn't change it because it applies equally to the Opus 5 and Sonnet 5 models already in the plugin. The structured-output schema is passed through unchanged. Anthropic requires additionalProperties: false on every object, so a schema without it gets a 400 (output_config.format.schema: For 'object' type, 'additionalProperties' must be explicitly set to false). The same schema works on OpenAI models in Dify, so it shows up when a node is switched over. I can open a separate issue for it.

🤖 Generated with Claude Code

tim-gregory-pt and others added 2 commits October 17, 2026 16:32
Register claude-haiku-5-5 as a predefined model. It shares Claude Opus 5's
request shape: adaptive thinking on by default, thinking.type=disabled
accepted only at effort high or below, effort and task budgets via
output_config, native structured output, and no sampling parameters,
budget_tokens or assistant prefill. Unlike Opus 5, the default effort is
medium.

Add claude-haiku-5 to the adaptive-thinking, default-on, disabled-thinking
effort-cap and task-budget model lists, and default the custom-model
schema's effort to medium for it. Pricing uses the rates for prompts up to
100K tokens ($0.10 / $0.50 per MTok); the over-100K rate card can't be
expressed in the flat pricing schema.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With thinking.display "omitted" (the default on adaptive-thinking models),
the API streams each thinking block as one empty thinking_delta followed by
a signature_delta. The stream handler opened the think tag at the first
delta of any thinking block, so every streamed answer began with an empty
think block, including structured-output JSON.

Open the tag on the first non-empty thinking text instead, and close it only
if it was opened. Redacted thinking still opens the tag at block start. The
block-type state that drove the old close is no longer needed and is
removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@crazywoola
crazywoola deployed to models/anthropic October 19, 2026 05:42 — with GitHub Actions Active
@crazywoola
crazywoola merged commit 82c0b13 into langgenius:main Oct 19, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
models/anthropic — 1d0aac4a Deployed Oct 19, 2026 by crazywoola via test (models/anthropic) #2866
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.

feat(anthropic): support Claude Haiku 5.5

2 participants