🎐 feat: Add Claude Haiku 5.5 Support (#17201)

* feat: Add Claude Haiku 5.5 Support

Haiku 5.5 (`claude-haiku-5-5`) matched none of the Claude family gates, so
every endpoint treated it as a legacy Claude 4 model: thinking went out as
`enabled` with a budget (400), sampling parameters were sent, thinking blocks
were not bound to the conversation prefix, and it resolved to a 200K context,
64K output and the default token rate.

Add a Haiku version parser and `hasAdaptiveHaikuThinking` (5.5 or later),
and include it in the adaptive thinking, block binding, omitted display,
sampling omission, explicit disabled, effort cap, 1M context and 128K output
gates. Unlike Sonnet 5.5, Haiku 5.5 still accepts `disabled` at effort high or
below, so "thinking off" sends `disabled` and clamps xhigh/max to high. The
settings panel keeps the thinking toggle and hides budget and sampling.

Register it in the Anthropic, Bedrock (`global.anthropic.claude-haiku-5-5`)
and Vertex default model lists, the 1M context map and the 128K output cap,
and price it at $0.10 / $0.50 up to a 100K prompt and $0.50 / $2.50 above,
with matching cache tiers.

Related to #17078, #16911 and #17025.

* test: Cover Claude Haiku 5.5 Parameter Panel

* test: Pin Haiku Scenarios to Model Specs

* fix: Keep Claude Haiku 5.5 Off Regional Vertex Endpoints
This commit is contained in:
Marco Beretta 2026-10-17 14:03:20 +02:00 • committed by GitHub
parent 9f1fae7afb
commit 214362aff9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 446 additions and 29 deletions

View file

@ -0,0 +1,82 @@
import { expect, test } from '@playwright/test';
import type { Page } from '@playwright/test';
import { NEW_CHAT_PATH, selectModelSpec } from '../helpers';
import { openPanel } from './panels';
const PROVIDER = 'Mock Provider A';
const HAIKU_55 = 'claude-haiku-5-5';
const HAIKU_45 = 'claude-haiku-4-5';
const SPEC_LABELS: Record<string, string> = {
[HAIKU_55]: 'E2E Claude Haiku 5.5',
[HAIKU_45]: 'E2E Claude Haiku 4.5',
};
/** Mock Provider A takes Anthropic's parameter set and is reached through model specs, so
* each Haiku model gets a spec pinned to it; the model name alone then decides which of
* those settings the panel keeps. */
async function openParametersFor(page: Page, model: string): Promise<void> {
await page.route(
(url) => url.pathname === '/api/models',
async (route) => {
const response = await route.fetch();
const models = await response.json();
models[PROVIDER] = [...(models[PROVIDER] ?? []), HAIKU_55, HAIKU_45];
await route.fulfill({ response, json: models });
},
);
await page.route(
(url) => url.pathname === '/api/config',
async (route) => {
const response = await route.fetch();
const config = await response.json();
const list = Array.isArray(config.modelSpecs?.list) ? config.modelSpecs.list : [];
const specs = [HAIKU_55, HAIKU_45].map((name) => ({
name: `e2e-${name}`,
label: SPEC_LABELS[name],
preset: { endpoint: PROVIDER, model: name },
}));
await route.fulfill({
response,
json: {
...config,
modelSpecs: { ...(config.modelSpecs ?? {}), list: [...list, ...specs] },
},
});
},
);
await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
await selectModelSpec(page, SPEC_LABELS[model]);
await openPanel(page, 'parameters', 'Parameters');
await expect(page.getByRole('region', { name: 'Reasoning' })).toBeVisible();
}
test.describe('Claude Haiku model parameters', () => {
test('Haiku 5.5 offers thinking and effort without a budget or sampling controls @scenario:haiku-55-hides-budget-and-sampling', async ({
page,
}) => {
await openParametersFor(page, HAIKU_55);
const reasoning = page.getByRole('region', { name: 'Reasoning' });
await expect(reasoning.getByRole('switch', { name: /^Thinking/ }).first()).toBeVisible();
await expect(reasoning.getByText('Effort', { exact: true }).first()).toBeVisible();
await expect(page.getByText('Thinking Budget')).toHaveCount(0);
await expect(page.getByText('Temperature', { exact: true })).toHaveCount(0);
await expect(page.getByText('Top P', { exact: true })).toHaveCount(0);
await expect(page.getByText('Top K', { exact: true })).toHaveCount(0);
});
test('Haiku 4.5 keeps the thinking budget and sampling controls @scenario:haiku-45-keeps-budget-and-sampling', async ({
page,
}) => {
await openParametersFor(page, HAIKU_45);
const reasoning = page.getByRole('region', { name: 'Reasoning' });
await expect(reasoning.getByRole('switch', { name: /^Thinking/ }).first()).toBeVisible();
await expect(reasoning.getByText('Thinking Budget')).toBeVisible();
await expect(page.getByText('Temperature', { exact: true }).first()).toBeVisible();
await expect(page.getByText('Top P', { exact: true }).first()).toBeVisible();
await expect(page.getByText('Top K', { exact: true }).first()).toBeVisible();
});
});

View file

@ -1521,6 +1521,66 @@ describe('getLLMConfig', () => {
});
});
describe('Haiku 5.5', () => {
const HAIKU_55_IDS = ['claude-haiku-5-5', 'claude-haiku-5.5'];
it.each(HAIKU_55_IDS)(
'binds adaptive thinking blocks, omits sampling and caches prompts for %s',
(model) => {
const result = getLLMConfig('test-key', {
modelOptions: {
model,
thinking: true,
thinkingBudget: 5000,
effort: AnthropicEffort.max,
temperature: 0.7,
topP: 0.9,
topK: 40,
},
});
expect(result.llmConfig.thinking).toEqual({
type: 'adaptive',
display: 'summarized',
block_binding: { prefix_mismatch_behavior: 'drop_block' },
});
expect(result.llmConfig.outputConfig).toEqual({ effort: AnthropicEffort.max });
expect(result.llmConfig).not.toHaveProperty('temperature');
expect(result.llmConfig).not.toHaveProperty('topP');
expect(result.llmConfig).not.toHaveProperty('topK');
expect(result.llmConfig.maxTokens).toBe(128000);
expect(result.llmConfig).toHaveProperty('promptCache', true);
const beta = (result.llmConfig.clientOptions?.defaultHeaders as Record<string, string>)[
'anthropic-beta'
];
expect(beta).toContain('thinking-binding-controls-2026-08-01');
},
);
it.each([AnthropicEffort.xhigh, AnthropicEffort.max])(
'sends disabled thinking and clamps effort %s to high when thinking is off',
(effort) => {
const { llmConfig } = getLLMConfig('test-key', {
modelOptions: { model: 'claude-haiku-5-5', thinking: false, effort },
});
const Anthropic = getChatModelClass(Providers.ANTHROPIC);
const payload = new Anthropic(llmConfig).invocationParams();
expect(payload.thinking).toEqual({ type: 'disabled' });
expect(payload.output_config).toEqual({ effort: AnthropicEffort.high });
expect(payload).not.toHaveProperty('temperature');
},
);
it('keeps Haiku 4.5 on budgeted thinking', () => {
const result = getLLMConfig('test-key', {
modelOptions: { model: 'claude-haiku-4-5', thinking: true, thinkingBudget: 2000 },
});
expect(result.llmConfig.thinking).toEqual({ type: 'enabled', budget_tokens: 2000 });
});
});
it('should omit sampling parameters for Opus 5', () => {
const result = getLLMConfig('test-key', {
modelOptions: {
@ -1852,13 +1912,8 @@ describe('getLLMConfig', () => {
});
});
it('should future-proof Claude 5.x Haiku models with 64K default', () => {
const testCases = [
'claude-haiku-5',
'claude-haiku-5-0',
'claude-haiku-5-2-20260101',
'claude-haiku-5.5',
];
it('should future-proof Claude 5.x Haiku models before 5.5 with 64K default', () => {
const testCases = ['claude-haiku-5', 'claude-haiku-5-0', 'claude-haiku-5-2-20260101'];
testCases.forEach((model) => {
const result = getLLMConfig('test-key', {
@ -1868,6 +1923,17 @@ describe('getLLMConfig', () => {
});
});
it('should give Claude Haiku 5.5+ models the 128K default', () => {
const testCases = ['claude-haiku-5-5', 'claude-haiku-5.5', 'claude-haiku-5-6'];
testCases.forEach((model) => {
const result = getLLMConfig('test-key', {
modelOptions: { model },
});
expect(result.llmConfig.maxTokens).toBe(128000);
});
});
it('should future-proof Claude 5.x Opus models with 128K default', () => {
const testCases = [
'claude-opus-5',
@ -1886,21 +1952,21 @@ describe('getLLMConfig', () => {
it('should future-proof Claude 6-9.x models with correct defaults', () => {
const testCases = [
// Claude 6.x - Sonnet/Opus get 128K, Haiku gets 64K
// Claude 6.x - Sonnet, Opus and Haiku (5.5+) get 128K
{ model: 'claude-sonnet-6', expected: 128000 },
{ model: 'claude-haiku-6-0', expected: 64000 },
{ model: 'claude-haiku-6-0', expected: 128000 },
{ model: 'claude-opus-6-1', expected: 128000 },
// Claude 7.x
{ model: 'claude-sonnet-7-20270101', expected: 128000 },
{ model: 'claude-haiku-7.5', expected: 64000 },
{ model: 'claude-haiku-7.5', expected: 128000 },
{ model: 'claude-opus-7', expected: 128000 },
// Claude 8.x
{ model: 'claude-sonnet-8', expected: 128000 },
{ model: 'claude-haiku-8-2', expected: 64000 },
{ model: 'claude-haiku-8-2', expected: 128000 },
{ model: 'claude-opus-8-latest', expected: 128000 },
// Claude 9.x
{ model: 'claude-sonnet-9', expected: 128000 },
{ model: 'claude-haiku-9', expected: 64000 },
{ model: 'claude-haiku-9', expected: 128000 },
{ model: 'claude-opus-9', expected: 128000 },
];

View file

@ -305,6 +305,22 @@ describe('Opus 5.5 token limits', () => {
});
});
describe('Haiku 5.5 token limits', () => {
it.each([
'claude-haiku-5-5',
'claude-haiku-5.5',
'anthropic/claude-haiku-5-5',
'global.anthropic.claude-haiku-5-5',
])('resolves %s to the modern Claude profile', (model) => {
expect(getModelMaxTokens(model)).toBe(1000000);
expect(getModelMaxTokens(model, EModelEndpoint.anthropic)).toBe(1000000);
});
it('keeps Haiku 4.5 at a 200K context', () => {
expect(getModelMaxTokens('claude-haiku-4-5', EModelEndpoint.anthropic)).toBe(200000);
});
});
describe('Sonnet 5.5 token limits', () => {
it.each([
'claude-sonnet-5-5',

View file

@ -168,6 +168,8 @@ const anthropicModels = {
'claude-3.7-sonnet': 200000,
'claude-4': 200000,
'claude-haiku-4-5': 200000,
'claude-haiku-5-5': 1000000,
'claude-haiku-5.5': 1000000,
'claude-opus-4': 200000,
'claude-opus-4-5': 200000,
'claude-sonnet-4': 200000,

View file

@ -23,6 +23,7 @@ import {
supportsPromptCache,
supportsContext1m,
hasAlwaysOnThinking,
hasAdaptiveHaikuThinking,
hasBetweenToolsThinkingFloor,
supportsOutput128k,
BEDROCK_FINE_GRAINED_TOOL_STREAMING_BETA,
@ -569,6 +570,62 @@ describe('Sonnet 5.5 model gates', () => {
});
});
describe('Haiku 5.5 model gates', () => {
const ids = [
'claude-haiku-5-5',
'claude-haiku-5.5',
'anthropic/claude-haiku-5-5',
'global.anthropic.claude-haiku-5-5',
];
test.each(ids)('%s is detected across every family gate', (model) => {
expect(hasAdaptiveHaikuThinking(model)).toBe(true);
expect(hasAlwaysOnThinking(model)).toBe(false);
expect(hasBetweenToolsThinkingFloor(model)).toBe(false);
expect(bindsThinkingBlocks(model)).toBe(true);
expect(supportsAdaptiveThinking(model)).toBe(true);
expect(omitsThinkingByDefault(model)).toBe(true);
expect(omitsSamplingParameters(model)).toBe(true);
expect(supportsPromptCache(model)).toBe(true);
expect(supportsContext1m(model)).toBe(true);
expect(supportsOutput128k(model)).toBe(true);
expect(requiresExplicitThinkingDisabled(model)).toBe(true);
expect(capsEffortWhenThinkingDisabled(model)).toBe(true);
expect(resolveThinkingOffConfig(model)).toEqual({ type: 'disabled' });
expect(resolveThinkingDisplay(model)).toBe('summarized');
});
test.each(['claude-haiku-5-6', 'claude-haiku-6', 'claude-6-haiku'])(
'later Haiku release %s inherits the 5.5 contract',
(model) => {
expect(hasAdaptiveHaikuThinking(model)).toBe(true);
expect(supportsAdaptiveThinking(model)).toBe(true);
expect(bindsThinkingBlocks(model)).toBe(true);
},
);
test.each([
'claude-haiku-4-5',
'claude-haiku-4-5-20251001',
'global.anthropic.claude-haiku-4-5-20251001-v1:0',
'claude-3-5-haiku-20241022',
'claude-haiku-5-20260101',
])('leaves %s on the legacy budget path', (model) => {
expect(hasAdaptiveHaikuThinking(model)).toBe(false);
expect(supportsAdaptiveThinking(model)).toBe(false);
expect(bindsThinkingBlocks(model)).toBe(false);
expect(omitsSamplingParameters(model)).toBe(false);
expect(supportsContext1m(model)).toBe(false);
expect(resolveThinkingOffConfig(model)).toBeUndefined();
});
test('clamps xhigh and max to high while thinking is disabled', () => {
expect(clampEffortForDisabledThinking('claude-haiku-5-5', 'xhigh')).toBe('high');
expect(clampEffortForDisabledThinking('claude-haiku-5-5', 'max')).toBe('high');
expect(clampEffortForDisabledThinking('claude-haiku-5-5', 'medium')).toBe('medium');
});
});
describe('always-on thinking gates', () => {
test.each([
'claude-opus-5-5',
@ -610,6 +667,39 @@ describe('always-on thinking gates', () => {
});
describe('bedrockInputParser', () => {
test('sends bound adaptive thinking for Haiku 5.5 and drops the legacy budget', () => {
const result = bedrockInputParser.parse({
model: 'global.anthropic.claude-haiku-5-5',
thinking: true,
thinkingBudget: 4000,
effort: 'low',
}) as Record<string, unknown>;
const additionalFields = result.additionalModelRequestFields as Record<string, unknown>;
expect(additionalFields.thinking).toEqual({
type: 'adaptive',
display: 'summarized',
block_binding: { prefix_mismatch_behavior: 'drop_block' },
});
expect(additionalFields.output_config).toEqual({ effort: 'low' });
expect(additionalFields).not.toHaveProperty('thinkingBudget');
expect(additionalFields.anthropic_beta).toEqual(['thinking-binding-controls-2026-08-01']);
});
test('maps Haiku 5.5 thinking off to an explicit disabled config and caps effort', () => {
const result = bedrockInputParser.parse({
model: 'global.anthropic.claude-haiku-5-5',
thinking: false,
thinkingDisplay: 'summarized',
effort: 'max',
}) as Record<string, unknown>;
const additionalFields = result.additionalModelRequestFields as Record<string, unknown>;
expect(additionalFields.thinking).toEqual({ type: 'disabled' });
expect(additionalFields.output_config).toEqual({ effort: 'high' });
expect(additionalFields).not.toHaveProperty('thinkingDisplay');
});
test('maps Sonnet 5.5 thinking off to between_tools and caps effort', () => {
const result = bedrockInputParser.parse({
model: 'global.anthropic.claude-sonnet-5-5',
@ -972,9 +1062,9 @@ describe('bedrockInputParser', () => {
expect(amrf?.anthropic_beta).toEqual(['context-1m-2025-08-07']);
});
test('should match anthropic.claude-haiku-6 model without context beta header', () => {
test('should match anthropic.claude-haiku-4-5 model without context beta header', () => {
const input = {
model: 'anthropic.claude-haiku-6',
model: 'anthropic.claude-haiku-4-5',
};
const result = bedrockInputParser.parse(input) as Record<string, unknown>;
const additionalFields = result.additionalModelRequestFields as Record<string, unknown>;

View file

@ -138,9 +138,13 @@ export const THINKING_BLOCK_BINDING = {
prefix_mismatch_behavior: 'drop_block',
} as const;
/** Models whose thinking blocks are bound to the conversation prefix (Opus 5.5+, Sonnet 5.5+, Fable/Mythos). */
/** Models whose thinking blocks are bound to the conversation prefix (Opus 5.5+, Sonnet 5.5+, Haiku 5.5+, Fable/Mythos). */
export function bindsThinkingBlocks(model: string): boolean {
return hasAlwaysOnThinking(model) || hasBetweenToolsThinkingFloor(model);
return (
hasAlwaysOnThinking(model) ||
hasBetweenToolsThinkingFloor(model) ||
hasAdaptiveHaikuThinking(model)
);
}
export const BETWEEN_TOOLS_THINKING = { type: 'between_tools' } as const;
@ -181,17 +185,46 @@ function parseSonnetVersion(model: string): ClaudeVersion | null {
return null;
}
/** Extracts haiku major/minor version from both naming formats. */
function parseHaikuVersion(model: string): ClaudeVersion | null {
const nameFirst = model.match(/claude-haiku[-.]?(\d+)(?:[-.](\d{1,2})(?!\d))?/);
if (nameFirst) {
return {
major: parseInt(nameFirst[1], 10),
minor: nameFirst[2] != null ? parseInt(nameFirst[2], 10) : 0,
};
}
const numFirst = model.match(/claude-(\d+)(?:[-.](\d{1,2})(?!\d))?-haiku/);
if (numFirst) {
return {
major: parseInt(numFirst[1], 10),
minor: numFirst[2] != null ? parseInt(numFirst[2], 10) : 0,
};
}
return null;
}
/**
* Haiku 5.5 and later run adaptive thinking on by default, bound to the
* conversation prefix, and reject budgets and sampling parameters. Unlike
* Sonnet 5.5 they still accept an explicit `disabled`, at effort `high` or below.
*/
export function hasAdaptiveHaikuThinking(model: string): boolean {
return isAtLeast(parseHaikuVersion(model), 5, 5);
}
/**
* Mythos-class detection (Claude Fable / Mythos) lives in `schemas.ts` as
* `isMythosClassModel` — the single source of truth for the family names.
* The helpers below OR it in alongside the `opus`/`sonnet` version parsers.
*/
/** Checks if a model supports adaptive thinking (Opus 4.6+, Sonnet 4.6+, Fable/Mythos) */
/** Checks if a model supports adaptive thinking (Opus 4.6+, Sonnet 4.6+, Haiku 5.5+, Fable/Mythos) */
export function supportsAdaptiveThinking(model: string): boolean {
return (
isAtLeast(parseOpusVersion(model), 4, 6) ||
isAtLeast(parseSonnetVersion(model), 4, 6) ||
hasAdaptiveHaikuThinking(model) ||
s.isMythosClassModel(model)
);
}
@ -210,6 +243,7 @@ export function omitsThinkingByDefault(model: string): boolean {
return (
isAtLeast(parseOpusVersion(model), 4, 7) ||
isAtLeast(parseSonnetVersion(model), 5, 0) ||
hasAdaptiveHaikuThinking(model) ||
s.isMythosClassModel(model)
);
}
@ -218,6 +252,7 @@ export function omitsSamplingParameters(model: string): boolean {
return (
isAtLeast(parseOpusVersion(model), 4, 7) ||
isAtLeast(parseSonnetVersion(model), 5, 0) ||
hasAdaptiveHaikuThinking(model) ||
s.isMythosClassModel(model)
);
}
@ -226,7 +261,7 @@ export function omitsSamplingParameters(model: string): boolean {
* Whether disabling thinking requires sending an explicit `{ type: 'disabled' }`
* config rather than simply omitting the `thinking` field.
*
* Sonnet 5 and Opus 5 treat an omitted `thinking` field as adaptive thinking ON
* Sonnet 5, Opus 5 and Haiku 5.5+ treat an omitted `thinking` field as adaptive thinking ON
* by default, so honoring a user who turns thinking off means sending the
* disabled config explicitly. Opus 4.7/4.8 run without thinking when the field
* is omitted, and Fable/Mythos, Opus 5.5+ and Sonnet 5.5+ reject an explicit
@ -239,7 +274,11 @@ export function requiresExplicitThinkingDisabled(model: string): boolean {
if (hasAlwaysOnThinking(model) || hasBetweenToolsThinkingFloor(model)) {
return false;
}
return isAtLeast(parseSonnetVersion(model), 5, 0) || isAtLeast(parseOpusVersion(model), 5, 0);
return (
isAtLeast(parseSonnetVersion(model), 5, 0) ||
isAtLeast(parseOpusVersion(model), 5, 0) ||
hasAdaptiveHaikuThinking(model)
);
}
/** Effort levels Opus 5 rejects while thinking is explicitly disabled. */
@ -254,8 +293,9 @@ const EFFORTS_REJECTED_WHEN_THINKING_DISABLED = new Set<string>([
* Opus 5 rejects `xhigh`/`max` in that combination with a 400: "output_config
* .effort 'xhigh' is not supported when thinking is disabled on this model. Use
* effort 'high' or below, or enable thinking." Sonnet 5.5+ returns the same
* error for `between_tools`. Opus 4.7/4.8, Sonnet 5, and Sonnet 4.6 accept
* every effort level they otherwise support with thinking off. Always-on
* error for `between_tools`, and Haiku 5.5+ for `disabled`. Opus 4.7/4.8,
* Sonnet 5, and Sonnet 4.6 accept every effort level they otherwise support
* with thinking off. Always-on
* models cannot turn thinking off, so the cap never applies to them.
*/
export function capsEffortWhenThinkingDisabled(model: string): boolean {
@ -265,7 +305,7 @@ export function capsEffortWhenThinkingDisabled(model: string): boolean {
if (hasBetweenToolsThinkingFloor(model)) {
return true;
}
return isAtLeast(parseOpusVersion(model), 5, 0);
return isAtLeast(parseOpusVersion(model), 5, 0) || hasAdaptiveHaikuThinking(model);
}
/**
@ -323,20 +363,22 @@ export function isThinkingOffConfig(thinking: unknown): boolean {
return thinking.type === 'disabled' || thinking.type === 'between_tools';
}
/** Checks if a model has a 1M context window (Sonnet 4.6+, Opus 4.6+, Opus 5+, Fable/Mythos) */
/** Checks if a model has a 1M context window (Sonnet 4.6+, Opus 4.6+, Opus 5+, Haiku 5.5+, Fable/Mythos) */
export function supportsContext1m(model: string): boolean {
return (
isAtLeast(parseSonnetVersion(model), 4, 6) ||
isAtLeast(parseOpusVersion(model), 4, 6) ||
hasAdaptiveHaikuThinking(model) ||
s.isMythosClassModel(model)
);
}
/** Opus 5.5+, Sonnet 5.5+ and Fable/Mythos emit up to 128k output tokens. */
/** Opus 5.5+, Sonnet 5.5+, Haiku 5.5+ and Fable/Mythos emit up to 128k output tokens. */
export function supportsOutput128k(model: string): boolean {
return (
isAtLeast(parseOpusVersion(model), 5, 5) ||
isAtLeast(parseSonnetVersion(model), 5, 5) ||
hasAdaptiveHaikuThinking(model) ||
s.isMythosClassModel(model)
);
}

View file

@ -4508,6 +4508,7 @@ const sharedAnthropicModels = [
'claude-opus-4-6',
'claude-sonnet-4-5',
'claude-sonnet-4-5-20250929',
'claude-haiku-5-5',
'claude-haiku-4-5',
'claude-haiku-4-5-20251001',
'claude-opus-4-1',
@ -4545,6 +4546,7 @@ export const bedrockModels = [
'global.anthropic.claude-sonnet-4-6',
'global.anthropic.claude-opus-4-6-v1',
'global.anthropic.claude-sonnet-4-5-20250929-v1:0',
'global.anthropic.claude-haiku-5-5',
'global.anthropic.claude-haiku-4-5-20251001-v1:0',
'us.anthropic.claude-opus-4-1-20250805-v1:0',
// 'cohere.command-text-v14', // no conversation history

View file

@ -108,6 +108,35 @@ describe('applyModelAwareDefaults', () => {
},
);
it.each(['claude-haiku-5-5', 'global.anthropic.claude-haiku-5-5'])(
'keeps the thinking toggle but hides budget and sampling controls for %s',
(model) => {
const result = applyModelAwareDefaults(anthropicParams, EModelEndpoint.anthropic, model);
expect(hasSetting(result, 'thinking')).toBe(true);
expect(result.find((setting) => setting.key === 'thinking')?.description).not.toBe(
'com_endpoint_anthropic_thinking_between_tools',
);
expect(hasSetting(result, 'thinkingBudget')).toBe(false);
expect(hasSetting(result, 'temperature')).toBe(false);
expect(hasSetting(result, 'topP')).toBe(false);
expect(hasSetting(result, 'topK')).toBe(false);
expect(hasSetting(result, 'effort')).toBe(true);
expect(hasSetting(result, 'promptCache')).toBe(true);
},
);
it('keeps budget and sampling controls for Haiku 4.5', () => {
const result = applyModelAwareDefaults(
anthropicParams,
EModelEndpoint.anthropic,
'claude-haiku-4-5',
);
expect(hasSetting(result, 'thinkingBudget')).toBe(true);
expect(hasSetting(result, 'temperature')).toBe(true);
});
it('returns settings unchanged when no model is provided', () => {
expect(applyModelAwareDefaults(googleParams, EModelEndpoint.google, '')).toBe(googleParams);
});

View file

@ -21,6 +21,7 @@ import {
} from './types';
import {
hasAlwaysOnThinking,
hasAdaptiveHaikuThinking,
hasBetweenToolsThinkingFloor,
supportsPromptCache,
supportsAdaptiveThinking,
@ -1773,6 +1774,12 @@ function applyModelFamilyDefaults(
(setting) => !['thinkingBudget', 'temperature', 'topP', 'topK'].includes(setting.key),
);
}
/** Haiku 5.5+ keeps the toggle ("off" sends `disabled`) but rejects budgets and sampling. */
if (hasAdaptiveHaikuThinking(model)) {
return settings.filter(
(setting) => !['thinkingBudget', 'temperature', 'topP', 'topK'].includes(setting.key),
);
}
const modelAwareSettings =
endpoint === EModelEndpoint.google
? settings.map((setting) => {

View file

@ -110,8 +110,11 @@ describe('anthropicSettings', () => {
expect(reset('claude-haiku-5')).toBe(64000);
});
it('should return 64K for future versions like claude-haiku-9', () => {
expect(reset('claude-haiku-9')).toBe(64000);
it('should return 128K for claude-haiku-5-5 and later', () => {
expect(reset('claude-haiku-5-5')).toBe(128000);
expect(reset('claude-haiku-5.5')).toBe(128000);
expect(reset('global.anthropic.claude-haiku-5-5')).toBe(128000);
expect(reset('claude-haiku-9')).toBe(128000);
});
});
@ -336,6 +339,11 @@ describe('anthropicSettings', () => {
it('should cap at 64K for claude-haiku-4-5 when value exceeds', () => {
expect(set(80000, 'claude-haiku-4-5')).toBe(64000);
});
it('should cap at 128K for claude-haiku-5-5 when value exceeds', () => {
expect(set(100000, 'claude-haiku-5-5')).toBe(100000);
expect(set(200000, 'claude-haiku-5-5')).toBe(128000);
});
});
describe('Claude Sonnet 4.6+ models (128K cap)', () => {

View file

@ -647,6 +647,8 @@ const DEFAULT_MAX_OUTPUT = 8192 as const;
const LEGACY_ANTHROPIC_MAX_OUTPUT = 4096 as const;
const CLAUDE_SONNET_128K_OUTPUT_PATTERN =
/claude-sonnet[-.]?(?:4[-.]?(?:[6-9]|\d{2})|[5-9]|\d{2,})(?=$|[^0-9])/;
const CLAUDE_HAIKU_128K_OUTPUT_PATTERN =
/claude-haiku[-.]?(?:5[-.]?(?:[5-9]|\d{2})|[6-9]|\d{2,})(?=$|[^0-9])/;
/**
* Claude "Mythos-class" model families — new top-level classes (peers of
@ -707,7 +709,10 @@ export const anthropicSettings = {
return ANTHROPIC_MAX_OUTPUT;
}
if (CLAUDE_SONNET_128K_OUTPUT_PATTERN.test(modelName)) {
if (
CLAUDE_SONNET_128K_OUTPUT_PATTERN.test(modelName) ||
CLAUDE_HAIKU_128K_OUTPUT_PATTERN.test(modelName)
) {
return ANTHROPIC_MAX_OUTPUT;
}
@ -740,7 +745,10 @@ export const anthropicSettings = {
return value;
}
if (CLAUDE_SONNET_128K_OUTPUT_PATTERN.test(modelName)) {
if (
CLAUDE_SONNET_128K_OUTPUT_PATTERN.test(modelName) ||
CLAUDE_HAIKU_128K_OUTPUT_PATTERN.test(modelName)
) {
if (value > ANTHROPIC_MAX_OUTPUT) {
return ANTHROPIC_MAX_OUTPUT;
}

View file

@ -52,6 +52,7 @@ describe('validateVertexConfig region gating', () => {
'claude-opus-4-8',
'claude-opus-4-7',
'claude-sonnet-5',
'claude-haiku-5-5',
];
const legacy = ['claude-sonnet-4-6', 'claude-3-7-sonnet-20250219', 'claude-3-opus@20240229'];

View file

@ -26,6 +26,7 @@ export const defaultVertexModels: string[] = [
'claude-opus-4-6',
'claude-sonnet-5',
'claude-sonnet-4-6',
'claude-haiku-5-5',
'claude-3-7-sonnet-20250219',
'claude-3-5-sonnet-v2@20241022',
'claude-3-5-sonnet@20240620',
@ -43,7 +44,7 @@ const MULTI_REGION_LOCATIONS = new Set(['global', 'us', 'eu']);
* and return 404 for anything newer.
*/
const REQUIRES_MULTI_REGION =
/^claude-(?:opus-(?:4-[7-9]|[5-9])|sonnet-[5-9]|fable-[5-9]|mythos-[5-9])/;
/^claude-(?:opus-(?:4-[7-9]|[5-9])|sonnet-[5-9]|haiku-(?:5-[5-9]|[6-9])|fable-[5-9]|mythos-[5-9])/;
/**
* Whether the configured location can serve models that require `global` or a

View file

@ -3257,6 +3257,60 @@ describe('Opus 5.5 pricing', () => {
});
});
describe('Haiku 5.5 pricing', () => {
const models = [
'claude-haiku-5-5',
'claude-haiku-5.5',
'anthropic/claude-haiku-5-5',
'global.anthropic.claude-haiku-5-5',
];
it.each(models)('prices %s at its standard rates up to the prompt-size threshold', (model) => {
const { threshold } = premiumTokenValues['claude-haiku-5-5'];
for (const inputTokenCount of [1000, threshold]) {
expect(getMultiplier({ model, tokenType: 'prompt', inputTokenCount })).toBe(
tokenValues['claude-haiku-5-5'].prompt,
);
expect(getMultiplier({ model, tokenType: 'completion', inputTokenCount })).toBe(
tokenValues['claude-haiku-5-5'].completion,
);
expect(getCacheMultiplier({ model, cacheType: 'write', inputTokenCount })).toBe(
cacheTokenValues['claude-haiku-5-5'].write,
);
expect(getCacheMultiplier({ model, cacheType: 'read', inputTokenCount })).toBe(
cacheTokenValues['claude-haiku-5-5'].read,
);
}
});
it.each(models)('prices %s at its long-prompt rates above the threshold', (model) => {
const inputTokenCount = premiumTokenValues['claude-haiku-5-5'].threshold + 1;
expect(getMultiplier({ model, tokenType: 'prompt', inputTokenCount })).toBe(
premiumTokenValues['claude-haiku-5-5'].prompt,
);
expect(getMultiplier({ model, tokenType: 'completion', inputTokenCount })).toBe(
premiumTokenValues['claude-haiku-5-5'].completion,
);
expect(getCacheMultiplier({ model, cacheType: 'write', inputTokenCount })).toBe(
premiumCacheTokenValues['claude-haiku-5-5'].write,
);
expect(getCacheMultiplier({ model, cacheType: 'read', inputTokenCount })).toBe(
premiumCacheTokenValues['claude-haiku-5-5'].read,
);
});
it('does not fall back to the default rate', () => {
expect(getMultiplier({ model: 'claude-haiku-5-5', tokenType: 'prompt' })).not.toBe(defaultRate);
});
it('keeps Haiku 4.5 on its own flat rates', () => {
expect(premiumTokenValues['claude-haiku-4-5']).toBeUndefined();
expect(getMultiplier({ model: 'claude-haiku-4-5', tokenType: 'prompt' })).toBe(
tokenValues['claude-haiku-4-5'].prompt,
);
});
});
describe('Sonnet 5.5 pricing', () => {
it.each([
'claude-sonnet-5-5',

View file

@ -181,6 +181,9 @@ export const tokenValues: Record<string, { prompt: number; completion: number }>
'claude-3-7-sonnet': { prompt: 3, completion: 15 },
'claude-3.7-sonnet': { prompt: 3, completion: 15 },
'claude-haiku-4-5': { prompt: 1, completion: 5 },
/* Rates up to a 100K prompt; the higher tier lives in `premiumTokenValues`. */
'claude-haiku-5-5': { prompt: 0.1, completion: 0.5 },
'claude-haiku-5.5': { prompt: 0.1, completion: 0.5 },
'claude-opus-4': { prompt: 15, completion: 75 },
'claude-opus-4-5': { prompt: 5, completion: 25 },
'claude-opus-4-6': { prompt: 5, completion: 25 },
@ -368,6 +371,8 @@ export const cacheTokenValues: Record<string, { write: number; read: number }> =
'claude-3-5-haiku': { write: 1, read: 0.08 },
'claude-3-haiku': { write: 0.3, read: 0.03 },
'claude-haiku-4-5': { write: 1.25, read: 0.1 },
'claude-haiku-5-5': { write: 0.125, read: 0.01 },
'claude-haiku-5.5': { write: 0.125, read: 0.01 },
'claude-sonnet-4': { write: 3.75, read: 0.3 },
'claude-sonnet-4-5': { write: 3.75, read: 0.3 },
'claude-sonnet-4-6': { write: 3.75, read: 0.3 },
@ -456,6 +461,8 @@ export const premiumTokenValues: Record<
string,
{ threshold: number; prompt: number; completion: number }
> = {
'claude-haiku-5-5': { threshold: 100000, prompt: 0.5, completion: 2.5 },
'claude-haiku-5.5': { threshold: 100000, prompt: 0.5, completion: 2.5 },
'gemini-3.1': { threshold: 200000, prompt: 4, completion: 18 },
'gpt-5.4': { threshold: 272000, prompt: 5, completion: 22.5 },
'gpt-5.4-pro': { threshold: 272000, prompt: 60, completion: 270 },
@ -486,6 +493,8 @@ export const premiumCacheTokenValues: Record<
string,
{ threshold: number; write: number; read: number }
> = {
'claude-haiku-5-5': { threshold: 100000, write: 0.625, read: 0.05 },
'claude-haiku-5.5': { threshold: 100000, write: 0.625, read: 0.05 },
'gpt-5.4': { threshold: 272000, write: 5, read: 0.5 },
'gpt-5.5': { threshold: 272000, write: 10, read: 1 },
'gpt-5.6': { threshold: 272000, write: 10, read: 0.8 },