Skip to content

Commit 8fb8046

Browse files
zoomote[bot]roomoteedelauna
authored
[Feat] Add Claude Haiku 5.5 model to the Anthropic provider (#2212)
* feat: add Claude Haiku 5.5 support across providers * fix: enable Haiku 5.5 prompt caching and strengthen token override test --------- Co-authored-by: Roomote <roomote@roomote.dev> Co-authored-by: Elliott de Launay <edelauna@gmail.com>
1 parent 3b825bf commit 8fb8046

14 files changed

Lines changed: 263 additions & 0 deletions

File tree

‎packages/types/src/providers/anthropic.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,30 @@ export const anthropicModels = {
179179
description:
180180
"Claude Opus 5.5 is Anthropic's most capable model for complex agentic coding and enterprise work.",
181181
},
182+
"claude-haiku-5-5": {
183+
maxTokens: 128_000,
184+
contextWindow: 1_000_000, // 1M context window native (no beta header required)
185+
supportsImages: true,
186+
supportsPromptCache: true,
187+
// Standard pricing (prompts of 100,000 tokens or fewer) from Anthropic's
188+
// pricing page. Prompts over 100,000 tokens bill at tiered rates
189+
// ($0.50 in / $2.50 out / $0.625 5m cache write / $0.05 cache read per
190+
// million tokens) that this entry does not model.
191+
// https://platform.claude.com/docs/en/about-claude/pricing
192+
inputPrice: 0.1, // $0.10 per million input tokens
193+
outputPrice: 0.5, // $0.50 per million output tokens
194+
cacheWritesPrice: 0.125, // $0.125 per million tokens (5m cache writes)
195+
cacheReadsPrice: 0.01, // $0.01 per million tokens (cache hits / refreshes)
196+
// Haiku 5.5 uses the same adaptive-thinking / binary-toggle convention as
197+
// Sonnet 5 and Opus 5 on the direct Anthropic provider path. Manual
198+
// extended thinking (budget_tokens) is not accepted, and sampling
199+
// parameters (temperature/top_p/top_k) must be omitted.
200+
supportsReasoningBudget: true,
201+
supportsReasoningBinary: true,
202+
supportsTemperature: false,
203+
description:
204+
"Claude Haiku 5.5 is the fastest, most efficient Claude 5.5 model, built for high-volume, latency-sensitive coding and agent work.",
205+
},
182206
"claude-fable-5-1": {
183207
maxTokens: 128_000, // Overridden to 8k if `enableReasoningEffort` is false.
184208
contextWindow: 1_000_000,

‎packages/types/src/providers/openrouter.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const OPEN_ROUTER_PROMPT_CACHING_MODELS = new Set([
4949
"anthropic/claude-fable-5.1",
5050
"anthropic/claude-fable-5",
5151
"anthropic/claude-haiku-4.5",
52+
"anthropic/claude-haiku-5.5",
5253
"google/gemini-2.5-flash-preview",
5354
"google/gemini-2.5-flash-preview:thinking",
5455
"google/gemini-2.5-flash-preview-05-20",
@@ -88,6 +89,7 @@ export const OPEN_ROUTER_REASONING_BUDGET_MODELS = new Set([
8889
"anthropic/claude-sonnet-4.6",
8990
"anthropic/claude-sonnet-5",
9091
"anthropic/claude-haiku-4.5",
92+
"anthropic/claude-haiku-5.5",
9193
"google/gemini-2.5-pro-preview",
9294
"google/gemini-2.5-pro",
9395
"google/gemini-2.5-flash-preview-05-20",

‎packages/types/src/providers/vercel-ai-gateway.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const VERCEL_AI_GATEWAY_PROMPT_CACHING_MODELS = new Set([
99
"anthropic/claude-3.5-haiku",
1010
"anthropic/claude-3.5-sonnet",
1111
"anthropic/claude-3.7-sonnet",
12+
"anthropic/claude-haiku-5.5",
1213
"anthropic/claude-opus-4",
1314
"anthropic/claude-opus-4.1",
1415
"anthropic/claude-opus-4.5",
@@ -57,6 +58,7 @@ export const VERCEL_AI_GATEWAY_VISION_AND_TOOLS_MODELS = new Set([
5758
"anthropic/claude-3.5-sonnet",
5859
"anthropic/claude-3.7-sonnet",
5960
"anthropic/claude-haiku-4.5",
61+
"anthropic/claude-haiku-5.5",
6062
"anthropic/claude-opus-4",
6163
"anthropic/claude-opus-4.1",
6264
"anthropic/claude-opus-4.5",

‎packages/types/src/providers/vertex.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,23 @@ export const vertexModels = {
526526
description:
527527
"Claude Opus 5.5 is Anthropic's most capable model for complex agentic coding and enterprise work.",
528528
},
529+
"claude-haiku-5-5": {
530+
maxTokens: 128_000,
531+
contextWindow: 1_000_000, // 1M context window native (no beta header required)
532+
supportsImages: true,
533+
supportsPromptCache: true,
534+
// Standard pricing (prompts of 100,000 tokens or fewer). Prompts over
535+
// 100,000 tokens bill at higher tiered rates per Anthropic's pricing page.
536+
inputPrice: 0.1, // $0.10 per million input tokens
537+
outputPrice: 0.5, // $0.50 per million output tokens
538+
cacheWritesPrice: 0.125, // $0.125 per million tokens (5m cache writes)
539+
cacheReadsPrice: 0.01, // $0.01 per million tokens (cache hits / refreshes)
540+
supportsReasoningBudget: true,
541+
supportsReasoningBinary: true,
542+
supportsTemperature: false,
543+
description:
544+
"Claude Haiku 5.5 is the fastest, most efficient Claude 5.5 model, built for high-volume, latency-sensitive coding and agent work.",
545+
},
529546
"claude-fable-5-1": {
530547
maxTokens: 128_000,
531548
contextWindow: 1_000_000,

‎src/api/providers/__tests__/anthropic-vertex.spec.ts‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,6 +1359,25 @@ describe("VertexHandler", () => {
13591359
expect(model.info.supportsTemperature).toBe(false)
13601360
})
13611361

1362+
it("should return Claude Haiku 5.5 model info", () => {
1363+
const handler = new AnthropicVertexHandler({
1364+
apiModelId: "claude-haiku-5-5",
1365+
vertexProjectId: "test-project",
1366+
vertexRegion: "us-central1",
1367+
})
1368+
1369+
const model = handler.getModel()
1370+
expect(model.id).toBe("claude-haiku-5-5")
1371+
expect(model.info.maxTokens).toBe(128_000)
1372+
expect(model.info.contextWindow).toBe(1_000_000)
1373+
expect(model.info.inputPrice).toBe(0.1)
1374+
expect(model.info.outputPrice).toBe(0.5)
1375+
expect(model.info.supportsReasoningBinary).toBe(true)
1376+
expect(model.info.supportsReasoningBudget).toBe(true)
1377+
expect(model.info.supportsPromptCache).toBe(true)
1378+
expect(model.info.supportsTemperature).toBe(false)
1379+
})
1380+
13621381
it("should not enable 1M context when flag is disabled", () => {
13631382
const handler = new AnthropicVertexHandler({
13641383
apiModelId: VERTEX_1M_CONTEXT_MODEL_IDS[0],
@@ -1717,6 +1736,38 @@ describe("VertexHandler", () => {
17171736
expect(request.temperature).toBeUndefined()
17181737
})
17191738

1739+
it("should use adaptive thinking for Claude Haiku 5.5", async () => {
1740+
const haikuHandler = new AnthropicVertexHandler({
1741+
apiModelId: "claude-haiku-5-5",
1742+
vertexProjectId: "test-project",
1743+
vertexRegion: "us-central1",
1744+
enableReasoningEffort: true,
1745+
})
1746+
1747+
const mockCreate = vitest.fn().mockImplementation(async () =>
1748+
asyncStreamFrom([
1749+
{ type: "message_start", message: { usage: { input_tokens: 100, output_tokens: 50 } } },
1750+
{ type: "text_delta", delta: { type: "text_delta", text: "Hello" } },
1751+
]),
1752+
)
1753+
// The SDK client's overloaded `create` signature can't be assigned a
1754+
// vitest mock directly, so a structural double assertion is required.
1755+
;(haikuHandler["client"].messages as unknown as { create: typeof mockCreate }).create = mockCreate
1756+
1757+
await haikuHandler.createMessage("You are a helpful assistant", [{ role: "user", content: "Hello" }]).next()
1758+
1759+
expect(mockCreate).toHaveBeenCalledWith(
1760+
expect.objectContaining({
1761+
thinking: { type: "adaptive", display: "summarized" },
1762+
}),
1763+
undefined,
1764+
)
1765+
1766+
const request = mockCreate.mock.calls[0][0]
1767+
expect(request.thinking).not.toHaveProperty("budget_tokens")
1768+
expect(request.temperature).toBeUndefined()
1769+
})
1770+
17201771
it("should use adaptive thinking for Claude Opus 5.5", async () => {
17211772
const opusHandler = new AnthropicVertexHandler({
17221773
apiModelId: "claude-opus-5-5",

‎src/api/providers/__tests__/anthropic.spec.ts‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,32 @@ describe("AnthropicHandler", () => {
508508
expect(requestOptions?.headers?.["anthropic-beta"]).toContain("prompt-caching-2024-07-31")
509509
})
510510

511+
it("should use adaptive thinking for Claude Haiku 5.5 when reasoning is enabled", async () => {
512+
const haikuHandler = new AnthropicHandler({
513+
apiKey: "test-api-key",
514+
apiModelId: "claude-haiku-5-5",
515+
enableReasoningEffort: true,
516+
modelMaxTokens: 32768,
517+
})
518+
519+
const stream = haikuHandler.createMessage(systemPrompt, [
520+
{
521+
role: "user",
522+
content: [{ type: "text" as const, text: "Hello" }],
523+
},
524+
])
525+
526+
await collectStream(stream)
527+
528+
const requestBody = mockCreate.mock.calls[mockCreate.mock.calls.length - 1]?.[0]
529+
const requestOptions = mockCreate.mock.calls[mockCreate.mock.calls.length - 1]?.[1]
530+
expect(requestBody?.thinking).toEqual({ type: "adaptive", display: "summarized" })
531+
expect(requestBody?.thinking).not.toHaveProperty("budget_tokens")
532+
expect(requestBody?.temperature).toBeUndefined()
533+
expect(requestBody?.max_tokens).toBe(32768)
534+
expect(requestOptions?.headers?.["anthropic-beta"]).toContain("prompt-caching-2024-07-31")
535+
})
536+
511537
it("should send the custom model ID as-is and use adaptive thinking for a custom Sonnet-5-family model", async () => {
512538
const customHandler = new AnthropicHandler({
513539
apiKey: "test-api-key",
@@ -1368,6 +1394,29 @@ describe("AnthropicHandler", () => {
13681394
expect(model.reasoningBudget).toBeUndefined()
13691395
})
13701396

1397+
it("should handle Claude Haiku 5.5 model correctly", () => {
1398+
const handler = new AnthropicHandler({
1399+
apiKey: "test-api-key",
1400+
apiModelId: "claude-haiku-5-5",
1401+
})
1402+
const model = handler.getModel()
1403+
expect(model.id).toBe("claude-haiku-5-5")
1404+
expect(model.info.maxTokens).toBe(128000)
1405+
expect(model.info.contextWindow).toBe(1000000)
1406+
expect(model.info.inputPrice).toBe(0.1)
1407+
expect(model.info.outputPrice).toBe(0.5)
1408+
expect(model.info.cacheWritesPrice).toBe(0.125)
1409+
expect(model.info.cacheReadsPrice).toBe(0.01)
1410+
// Hybrid reasoning model with the reasoning toggle off: the request
1411+
// budget clamps to the Anthropic default, matching Sonnet 5 / Opus 5.
1412+
expect(model.maxTokens).toBe(8192)
1413+
expect(model.info.supportsReasoningBinary).toBe(true)
1414+
expect(model.info.supportsReasoningBudget).toBe(true)
1415+
expect(model.info.supportsPromptCache).toBe(true)
1416+
expect(model.info.supportsTemperature).toBe(false)
1417+
expect(model.reasoningBudget).toBeUndefined()
1418+
})
1419+
13711420
it("should enable 1M context for Claude 4.5 Sonnet when beta flag is set", () => {
13721421
const handler = new AnthropicHandler({
13731422
apiKey: "test-api-key",

‎src/api/providers/anthropic.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
132132
case "claude-opus-4-8":
133133
case "claude-opus-5":
134134
case "claude-opus-5-5":
135+
case "claude-haiku-5-5":
135136
case "claude-fable-5-1":
136137
case "claude-fable-5":
137138
case "claude-opus-4-5-20251101":

‎src/api/providers/fetchers/__tests__/openrouter.spec.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,34 @@ describe("OpenRouter API", () => {
509509
expect(result.supportsReasoningBinary).toBe(true)
510510
})
511511

512+
it("sets claude-haiku-5-5 model to Anthropic max tokens and omits temperature", () => {
513+
const mockModel = {
514+
name: "Claude Haiku 5.5",
515+
description: "Test model",
516+
context_length: 1000000,
517+
max_completion_tokens: 64000,
518+
pricing: {
519+
prompt: "0.0000001",
520+
completion: "0.0000005",
521+
},
522+
}
523+
524+
const result = parseOpenRouterModel({
525+
id: "anthropic/claude-haiku-5.5",
526+
model: mockModel,
527+
inputModality: ["text", "image"],
528+
outputModality: ["text"],
529+
maxTokens: 64000,
530+
supportedParameters: ["reasoning", "include_reasoning"],
531+
})
532+
533+
expect(result.maxTokens).toBe(128000)
534+
expect(result.contextWindow).toBe(1000000)
535+
expect(result.supportsTemperature).toBe(false)
536+
expect(result.supportsReasoningBudget).toBe(true)
537+
expect(result.supportsReasoningBinary).toBe(true)
538+
})
539+
512540
it("sets horizon-alpha model to 32k max tokens", () => {
513541
const mockModel = {
514542
name: "Horizon Alpha",

‎src/api/providers/fetchers/__tests__/requesty.spec.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,31 @@ describe("getRequestyModels", () => {
151151
expect(opus55.supportsTemperature).toBe(false)
152152
})
153153

154+
it("applies Haiku 5.5 overrides when parsing anthropic/claude-haiku-5-5", async () => {
155+
const rawHaiku55 = makeRawModel({
156+
id: "anthropic/claude-haiku-5-5",
157+
max_output_tokens: 128000,
158+
context_window: 1000000,
159+
supports_caching: true,
160+
supports_vision: true,
161+
supports_reasoning: true,
162+
input_price: "0.0000001",
163+
output_price: "0.0000005",
164+
caching_price: "0.000000125",
165+
cached_price: "0.00000001",
166+
})
167+
168+
mockAxiosGet.mockResolvedValueOnce({ data: { data: [rawHaiku55] } })
169+
170+
const models = await getRequestyModels()
171+
const haiku55 = models["anthropic/claude-haiku-5-5"]
172+
173+
expect(haiku55).toBeDefined()
174+
expect(haiku55.supportsReasoningBudget).toBe(true)
175+
expect(haiku55.supportsReasoningBinary).toBe(true)
176+
expect(haiku55.supportsTemperature).toBe(false)
177+
})
178+
154179
it("does not apply Fable 5 overrides to other models", async () => {
155180
const rawSonnet = makeRawModel({
156181
id: "anthropic/claude-sonnet-4.6",

‎src/api/providers/fetchers/__tests__/vercel-ai-gateway.spec.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,22 @@ describe("Vercel AI Gateway Fetchers", () => {
377377
expect(result.supportsTemperature).toBe(false)
378378
})
379379

380+
it("marks Claude Haiku 5.5 as not supporting temperature", () => {
381+
const result = parseVercelAiGatewayModel({
382+
id: "anthropic/claude-haiku-5.5",
383+
model: {
384+
...baseModel,
385+
id: "anthropic/claude-haiku-5.5",
386+
context_window: 1000000,
387+
max_tokens: 128000,
388+
},
389+
})
390+
391+
expect(result.maxTokens).toBe(128000)
392+
expect(result.contextWindow).toBe(1000000)
393+
expect(result.supportsTemperature).toBe(false)
394+
})
395+
380396
it("detects vision-only models", () => {
381397
// claude 3.5 haiku in VERCEL_AI_GATEWAY_VISION_ONLY_MODELS
382398
const visionModel = {

0 commit comments

Comments
 (0)