@@ -38,6 +38,20 @@ vitest.mock("../fetchers/modelCache", () => ({
3838 cacheReadsPrice : 0.3 ,
3939 description : "Claude 4 Sonnet" ,
4040 } ,
41+ "anthropic/claude-fable-5" : {
42+ maxTokens : 128000 ,
43+ contextWindow : 1000000 ,
44+ supportsImages : true ,
45+ supportsPromptCache : true ,
46+ supportsReasoningBudget : true ,
47+ supportsReasoningBinary : true ,
48+ supportsTemperature : false ,
49+ inputPrice : 10 ,
50+ outputPrice : 50 ,
51+ cacheWritesPrice : 12.5 ,
52+ cacheReadsPrice : 1 ,
53+ description : "Claude Fable 5" ,
54+ } ,
4155 } )
4256 } ) ,
4357} ) )
@@ -193,6 +207,39 @@ describe("RequestyHandler", () => {
193207 )
194208 } )
195209
210+ it ( "uses adaptive thinking for Claude Fable 5 when reasoning is enabled" , async ( ) => {
211+ const handler = new RequestyHandler ( {
212+ requestyApiKey : "test-key" ,
213+ requestyModelId : "anthropic/claude-fable-5" ,
214+ enableReasoningEffort : true ,
215+ modelMaxTokens : 32768 ,
216+ } )
217+
218+ const mockStream = {
219+ async * [ Symbol . asyncIterator ] ( ) {
220+ yield {
221+ id : "test-id" ,
222+ choices : [ { delta : { } } ] ,
223+ usage : { prompt_tokens : 10 , completion_tokens : 20 } ,
224+ }
225+ } ,
226+ }
227+
228+ mockCreate . mockResolvedValue ( mockStream )
229+
230+ const generator = handler . createMessage ( "test system prompt" , [ { role : "user" as const , content : "test" } ] )
231+ await generator . next ( )
232+
233+ expect ( mockCreate ) . toHaveBeenCalledWith (
234+ expect . objectContaining ( {
235+ model : "anthropic/claude-fable-5" ,
236+ max_tokens : 32768 ,
237+ thinking : { type : "adaptive" } ,
238+ temperature : undefined ,
239+ } ) ,
240+ )
241+ } )
242+
196243 it ( "handles API errors" , async ( ) => {
197244 const handler = new RequestyHandler ( mockOptions )
198245 const mockError = new Error ( "API Error" )
@@ -367,6 +414,23 @@ describe("RequestyHandler", () => {
367414 } )
368415 } )
369416
417+ it ( "omits temperature for Claude Fable 5 in completePrompt" , async ( ) => {
418+ const handler = new RequestyHandler ( {
419+ requestyApiKey : "test-key" ,
420+ requestyModelId : "anthropic/claude-fable-5" ,
421+ } )
422+ mockCreate . mockResolvedValue ( { choices : [ { message : { content : "test completion" } } ] } )
423+
424+ await handler . completePrompt ( "test prompt" )
425+
426+ expect ( mockCreate ) . toHaveBeenCalledWith ( {
427+ model : "anthropic/claude-fable-5" ,
428+ max_tokens : 8192 ,
429+ messages : [ { role : "system" , content : "test prompt" } ] ,
430+ temperature : undefined ,
431+ } )
432+ } )
433+
370434 it ( "handles API errors" , async ( ) => {
371435 const handler = new RequestyHandler ( mockOptions )
372436 const mockError = new Error ( "API Error" )
0 commit comments