Skip to content

Commit 0d937c0

Browse files
Add Claude Fable 5.1 support (Zoo-Code-Org#1508)
* Add Claude Fable 5.1 support * fix: address Fable 5.1 review feedback * test: strengthen Fable tool choice coverage * test: cover omitted Fable tool choice * test: address remaining Fable tool choice feedback * test: distinguish omitted and none tool choices * fix: preserve Anthropic none tool choice * fix: simplify Fable tool choice normalization * fix(anthropic): preserve disabled parallel tool calls
1 parent 7bb14e4 commit 0d937c0

20 files changed

Lines changed: 516 additions & 15 deletions

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,23 @@ export const anthropicModels = {
164164
supportsTemperature: false,
165165
description: "Claude Opus 5 is Anthropic's most capable model for complex agentic coding and enterprise work.",
166166
},
167+
"claude-fable-5-1": {
168+
maxTokens: 128_000, // Overridden to 8k if `enableReasoningEffort` is false.
169+
contextWindow: 1_000_000,
170+
supportsImages: true,
171+
supportsPromptCache: true,
172+
inputPrice: 10.0, // $10 per million input tokens
173+
outputPrice: 50.0, // $50 per million output tokens
174+
cacheWritesPrice: 12.5, // $12.50 per million tokens (5-minute cache)
175+
cacheReadsPrice: 0.25, // $0.25 per million tokens (2.5% of base input price)
176+
// Fable 5.1 only accepts adaptive thinking (or an omitted thinking field).
177+
// Manual budget_tokens and non-default sampling parameters return a 400.
178+
supportsReasoningBudget: true,
179+
supportsReasoningBinary: true,
180+
supportsTemperature: false,
181+
description:
182+
"Claude Fable 5.1 extends Fable 5 with stronger long-running agentic coding, multistep research, and document work.",
183+
},
167184
"claude-fable-5": {
168185
maxTokens: 128_000, // Overridden to 8k if `enableReasoningEffort` is false.
169186
contextWindow: 1_000_000,

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,24 @@ export const bedrockModels = {
252252
cachableFields: ["system", "messages", "tools"],
253253
description: "Claude Opus 5 is Anthropic's most capable model for complex agentic coding and enterprise work.",
254254
},
255+
"anthropic.claude-fable-5-1": {
256+
maxTokens: 128_000,
257+
contextWindow: 1_000_000,
258+
supportsImages: true,
259+
supportsPromptCache: true,
260+
supportsReasoningBudget: true,
261+
supportsReasoningBinary: true,
262+
supportsTemperature: false,
263+
inputPrice: 10.0,
264+
outputPrice: 50.0,
265+
cacheWritesPrice: 12.5,
266+
cacheReadsPrice: 0.25,
267+
minTokensPerCachePoint: 512,
268+
maxCachePoints: 4,
269+
cachableFields: ["system", "messages", "tools"],
270+
description:
271+
"Claude Fable 5.1 extends Fable 5 with stronger long-running agentic coding, multistep research, and document work.",
272+
},
255273
"anthropic.claude-fable-5": {
256274
maxTokens: 8192,
257275
contextWindow: 1_000_000,
@@ -643,7 +661,7 @@ export const BEDROCK_1M_CONTEXT_MODEL_IDS = [
643661
// - Claude Opus 4.6
644662
// - Claude Opus 4.7
645663
// - Claude Opus 5
646-
// - Claude Fable 5 (cross-region inference only — can only be used through an inference profile)
664+
// - Claude Fable 5 and 5.1 (cross-region inference only — can only be used through an inference profile)
647665
export const BEDROCK_GLOBAL_INFERENCE_MODEL_IDS = [
648666
"anthropic.claude-sonnet-4-20250514-v1:0",
649667
"anthropic.claude-sonnet-4-5-20250929-v1:0",
@@ -655,6 +673,7 @@ export const BEDROCK_GLOBAL_INFERENCE_MODEL_IDS = [
655673
"anthropic.claude-opus-4-7",
656674
"anthropic.claude-opus-4-8",
657675
"anthropic.claude-opus-5",
676+
"anthropic.claude-fable-5-1",
658677
"anthropic.claude-fable-5",
659678
] as const
660679

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const OPEN_ROUTER_PROMPT_CACHING_MODELS = new Set([
4545
"anthropic/claude-opus-4.5",
4646
"anthropic/claude-opus-4.6",
4747
"anthropic/claude-opus-5",
48+
"anthropic/claude-fable-5.1",
4849
"anthropic/claude-fable-5",
4950
"anthropic/claude-haiku-4.5",
5051
"google/gemini-2.5-flash-preview",
@@ -78,6 +79,7 @@ export const OPEN_ROUTER_REASONING_BUDGET_MODELS = new Set([
7879
"anthropic/claude-opus-4.5",
7980
"anthropic/claude-opus-4.6",
8081
"anthropic/claude-opus-5",
82+
"anthropic/claude-fable-5.1",
8183
"anthropic/claude-fable-5",
8284
"anthropic/claude-sonnet-4",
8385
"anthropic/claude-sonnet-4.5",

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const VERCEL_AI_GATEWAY_PROMPT_CACHING_MODELS = new Set([
1414
"anthropic/claude-opus-4.5",
1515
"anthropic/claude-opus-4.6",
1616
"anthropic/claude-opus-5",
17+
"anthropic/claude-fable-5.1",
1718
"anthropic/claude-fable-5",
1819
"anthropic/claude-sonnet-4",
1920
"anthropic/claude-sonnet-4.6",
@@ -60,6 +61,7 @@ export const VERCEL_AI_GATEWAY_VISION_AND_TOOLS_MODELS = new Set([
6061
"anthropic/claude-opus-4.5",
6162
"anthropic/claude-opus-4.6",
6263
"anthropic/claude-opus-5",
64+
"anthropic/claude-fable-5.1",
6365
"anthropic/claude-fable-5",
6466
"anthropic/claude-sonnet-4",
6567
"anthropic/claude-sonnet-4.5",

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,21 @@ export const vertexModels = {
489489
supportsTemperature: false,
490490
description: "Claude Opus 5 is Anthropic's most capable model for complex agentic coding and enterprise work.",
491491
},
492+
"claude-fable-5-1": {
493+
maxTokens: 128_000,
494+
contextWindow: 1_000_000,
495+
supportsImages: true,
496+
supportsPromptCache: true,
497+
inputPrice: 10.0,
498+
outputPrice: 50.0,
499+
cacheWritesPrice: 12.5,
500+
cacheReadsPrice: 0.25,
501+
supportsReasoningBudget: true,
502+
supportsReasoningBinary: true,
503+
supportsTemperature: false,
504+
description:
505+
"Claude Fable 5.1 extends Fable 5 with stronger long-running agentic coding, multistep research, and document work.",
506+
},
492507
"claude-fable-5": {
493508
maxTokens: 8192,
494509
contextWindow: 1_000_000,

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,24 @@ describe("VertexHandler", () => {
992992
expect(model.info.supportsTemperature).toBe(false)
993993
})
994994

995+
it("should return Claude Fable 5.1 model info", () => {
996+
const handler = new AnthropicVertexHandler({
997+
apiModelId: "claude-fable-5-1",
998+
vertexProjectId: "test-project",
999+
vertexRegion: "us-central1",
1000+
})
1001+
1002+
const model = handler.getModel()
1003+
expect(model.id).toBe("claude-fable-5-1")
1004+
expect(model.info.maxTokens).toBe(128_000)
1005+
expect(model.info.contextWindow).toBe(1_000_000)
1006+
expect(model.info.cacheReadsPrice).toBe(0.25)
1007+
expect(model.info.supportsReasoningBinary).toBe(true)
1008+
expect(model.info.supportsReasoningBudget).toBe(true)
1009+
expect(model.info.supportsPromptCache).toBe(true)
1010+
expect(model.info.supportsTemperature).toBe(false)
1011+
})
1012+
9951013
it("should return Claude Sonnet 5 model info", () => {
9961014
const handler = new AnthropicVertexHandler({
9971015
apiModelId: "claude-sonnet-5",
@@ -1266,6 +1284,37 @@ describe("VertexHandler", () => {
12661284
enableReasoningEffort: true,
12671285
})
12681286

1287+
const mockCreate = vitest
1288+
.fn()
1289+
.mockImplementation(async () =>
1290+
asyncStreamFrom([
1291+
{ type: "message_start", message: { usage: { input_tokens: 10, output_tokens: 5 } } },
1292+
]),
1293+
)
1294+
fableHandler["client"].messages.create = mockCreate
1295+
1296+
await fableHandler.createMessage("You are a helpful assistant", [{ role: "user", content: "Hello" }]).next()
1297+
1298+
expect(mockCreate).toHaveBeenCalledWith(
1299+
expect.objectContaining({
1300+
thinking: { type: "adaptive" },
1301+
}),
1302+
undefined,
1303+
)
1304+
1305+
const request = mockCreate.mock.calls[0][0]
1306+
expect(request.thinking).not.toHaveProperty("budget_tokens")
1307+
expect(request.temperature).toBeUndefined()
1308+
})
1309+
1310+
it("should use adaptive thinking for Claude Fable 5.1", async () => {
1311+
const fableHandler = new AnthropicVertexHandler({
1312+
apiModelId: "claude-fable-5-1",
1313+
vertexProjectId: "test-project",
1314+
vertexRegion: "us-central1",
1315+
enableReasoningEffort: true,
1316+
})
1317+
12691318
const mockCreate = vitest
12701319
.fn()
12711320
.mockImplementation(async () =>

0 commit comments

Comments
 (0)