Skip to content

Commit ea0ddd6

Browse files
committed
fix(providers): address PR #555 review feedback for Fable 5
1 parent 23eef46 commit ea0ddd6

7 files changed

Lines changed: 86 additions & 2 deletions

File tree

packages/types/src/providers/bedrock.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@ export const BEDROCK_1M_CONTEXT_MODEL_IDS = [
606606
// - Claude Opus 4.5
607607
// - Claude Opus 4.6
608608
// - Claude Opus 4.7
609+
// - Claude Fable 5 (cross-region inference only — can only be used through an inference profile)
609610
export const BEDROCK_GLOBAL_INFERENCE_MODEL_IDS = [
610611
"anthropic.claude-sonnet-4-20250514-v1:0",
611612
"anthropic.claude-sonnet-4-5-20250929-v1:0",
@@ -615,6 +616,7 @@ export const BEDROCK_GLOBAL_INFERENCE_MODEL_IDS = [
615616
"anthropic.claude-opus-4-6-v1",
616617
"anthropic.claude-opus-4-7",
617618
"anthropic.claude-opus-4-8",
619+
"anthropic.claude-fable-5",
618620
] as const
619621

620622
// Amazon Bedrock Service Tier types

packages/types/src/providers/openrouter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export const OPEN_ROUTER_REASONING_BUDGET_MODELS = new Set([
7575
"anthropic/claude-opus-4.1",
7676
"anthropic/claude-opus-4.5",
7777
"anthropic/claude-opus-4.6",
78+
"anthropic/claude-fable-5",
7879
"anthropic/claude-sonnet-4",
7980
"anthropic/claude-sonnet-4.5",
8081
"anthropic/claude-sonnet-4.6",

src/api/providers/__tests__/bedrock.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,19 @@ describe("AwsBedrockHandler", () => {
709709
expect(model.info.supportsTemperature).toBe(false)
710710
expect(model.maxTokens).toBe(8192)
711711
})
712+
713+
it("should apply global inference prefix for Claude Fable 5 when awsUseGlobalInference is true", () => {
714+
const handler = new AwsBedrockHandler({
715+
apiModelId: "anthropic.claude-fable-5",
716+
awsAccessKey: "test",
717+
awsSecretKey: "test",
718+
awsRegion: "us-east-1",
719+
awsUseGlobalInference: true,
720+
})
721+
722+
const model = handler.getModel()
723+
expect(model.id).toBe("global.anthropic.claude-fable-5")
724+
})
712725
})
713726

714727
describe("1M context beta feature", () => {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ describe("OpenRouter API", () => {
314314
expect(result.maxTokens).toBe(128000)
315315
expect(result.contextWindow).toBe(1000000)
316316
expect(result.supportsTemperature).toBe(false)
317+
expect(result.supportsReasoningBudget).toBe(true)
318+
expect(result.supportsReasoningBinary).toBe(true)
317319
})
318320

319321
it("sets horizon-alpha model to 32k max tokens", () => {
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// npx vitest run api/providers/fetchers/__tests__/requesty.spec.ts
2+
3+
import axios from "axios"
4+
5+
import { getRequestyModels } from "../requesty"
6+
7+
vi.mock("axios")
8+
const mockAxiosGet = vi.mocked(axios.get)
9+
10+
function makeRawModel(overrides: Record<string, unknown>) {
11+
return {
12+
id: "some/model",
13+
max_output_tokens: 8192,
14+
context_window: 200000,
15+
supports_caching: false,
16+
supports_vision: false,
17+
supports_reasoning: false,
18+
input_price: "0.000003",
19+
output_price: "0.000015",
20+
description: "Test model",
21+
caching_price: null,
22+
cached_price: null,
23+
...overrides,
24+
}
25+
}
26+
27+
describe("getRequestyModels", () => {
28+
it("applies Fable 5 overrides when parsing anthropic/claude-fable-5", async () => {
29+
const rawFable5 = makeRawModel({
30+
id: "anthropic/claude-fable-5",
31+
max_output_tokens: 128000,
32+
context_window: 1000000,
33+
supports_caching: true,
34+
supports_vision: true,
35+
supports_reasoning: true,
36+
input_price: "0.00001",
37+
output_price: "0.00005",
38+
caching_price: "0.0000125",
39+
cached_price: "0.000001",
40+
})
41+
42+
mockAxiosGet.mockResolvedValueOnce({ data: { data: [rawFable5] } })
43+
44+
const models = await getRequestyModels()
45+
const fable5 = models["anthropic/claude-fable-5"]
46+
47+
expect(fable5).toBeDefined()
48+
expect(fable5.supportsReasoningBudget).toBe(true)
49+
expect(fable5.supportsReasoningBinary).toBe(true)
50+
expect(fable5.supportsTemperature).toBe(false)
51+
})
52+
53+
it("does not apply Fable 5 overrides to other models", async () => {
54+
const rawSonnet = makeRawModel({
55+
id: "anthropic/claude-sonnet-4.6",
56+
supports_reasoning: true,
57+
})
58+
59+
mockAxiosGet.mockResolvedValueOnce({ data: { data: [rawSonnet] } })
60+
61+
const models = await getRequestyModels()
62+
const sonnet = models["anthropic/claude-sonnet-4.6"]
63+
64+
expect(sonnet.supportsReasoningBinary).toBeUndefined()
65+
expect(sonnet.supportsTemperature).toBeUndefined()
66+
})
67+
})

src/api/providers/fetchers/openrouter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ export const parseOpenRouterModel = ({
266266
// Set claude-fable-5 model to use the correct Anthropic configuration
267267
if (id === "anthropic/claude-fable-5") {
268268
modelInfo.maxTokens = anthropicModels["claude-fable-5"].maxTokens
269+
modelInfo.supportsReasoningBinary = true
269270
modelInfo.supportsTemperature = false
270271
}
271272

src/api/transform/model-params.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,6 @@ export function getModelParams({
183183
// Special case for o1-pro, which doesn't support temperature.
184184
// Note that OpenRouter's `supported_parameters` field includes
185185
// `temperature`, which is probably a bug.
186-
// TODO: Add a `supportsTemperature` field to the model info and populate
187-
// it appropriately in the OpenRouter fetcher.
188186
if (modelId === "openai/o1-pro") {
189187
params.temperature = undefined
190188
}

0 commit comments

Comments
 (0)