@@ -10,9 +10,9 @@ import { Anthropic } from "@anthropic-ai/sdk"
1010import OpenAI from "openai"
1111
1212import { RequestyHandler } from "../requesty"
13- import { ApiHandlerOptions } from "../../../shared/api"
1413import { Package } from "../../../shared/package"
1514import { ApiHandlerCreateMessageMetadata } from "../../index"
15+ import { makeApiHandlerOptions } from "../../../test-utils/api"
1616import { asyncStreamFrom , collectStream } from "../../../test-utils/stream"
1717
1818const mockCreate = vitest . fn ( )
@@ -98,10 +98,10 @@ vitest.mock("../fetchers/modelCache", () => ({
9898} ) )
9999
100100describe ( "RequestyHandler" , ( ) => {
101- const mockOptions : ApiHandlerOptions = {
101+ const mockOptions = makeApiHandlerOptions ( {
102102 requestyApiKey : "test-key" ,
103103 requestyModelId : "coding/claude-4-sonnet" ,
104- }
104+ } )
105105
106106 beforeEach ( ( ) => vitest . clearAllMocks ( ) )
107107
@@ -244,12 +244,14 @@ describe("RequestyHandler", () => {
244244 } )
245245
246246 it ( "uses adaptive thinking for Claude Fable 5 when reasoning is enabled" , async ( ) => {
247- const handler = new RequestyHandler ( {
248- requestyApiKey : "test-key" ,
249- requestyModelId : "anthropic/claude-fable-5" ,
250- enableReasoningEffort : true ,
251- modelMaxTokens : 32768 ,
252- } )
247+ const handler = new RequestyHandler (
248+ makeApiHandlerOptions ( {
249+ requestyApiKey : "test-key" ,
250+ requestyModelId : "anthropic/claude-fable-5" ,
251+ enableReasoningEffort : true ,
252+ modelMaxTokens : 32768 ,
253+ } ) ,
254+ )
253255
254256 const mockStream = asyncStreamFrom ( [
255257 {
@@ -275,12 +277,14 @@ describe("RequestyHandler", () => {
275277 } )
276278
277279 it ( "uses adaptive thinking for Claude Sonnet 5 when reasoning is enabled" , async ( ) => {
278- const handler = new RequestyHandler ( {
279- requestyApiKey : "test-key" ,
280- requestyModelId : "anthropic/claude-sonnet-5" ,
281- enableReasoningEffort : true ,
282- modelMaxTokens : 32768 ,
283- } )
280+ const handler = new RequestyHandler (
281+ makeApiHandlerOptions ( {
282+ requestyApiKey : "test-key" ,
283+ requestyModelId : "anthropic/claude-sonnet-5" ,
284+ enableReasoningEffort : true ,
285+ modelMaxTokens : 32768 ,
286+ } ) ,
287+ )
284288
285289 const mockStream = asyncStreamFrom ( [
286290 {
@@ -306,12 +310,14 @@ describe("RequestyHandler", () => {
306310 } )
307311
308312 it ( "uses adaptive thinking for Claude Opus 5 when reasoning is enabled" , async ( ) => {
309- const handler = new RequestyHandler ( {
310- requestyApiKey : "test-key" ,
311- requestyModelId : "anthropic/claude-opus-5" ,
312- enableReasoningEffort : true ,
313- modelMaxTokens : 32768 ,
314- } )
313+ const handler = new RequestyHandler (
314+ makeApiHandlerOptions ( {
315+ requestyApiKey : "test-key" ,
316+ requestyModelId : "anthropic/claude-opus-5" ,
317+ enableReasoningEffort : true ,
318+ modelMaxTokens : 32768 ,
319+ } ) ,
320+ )
315321
316322 const mockStream = asyncStreamFrom ( [
317323 {
@@ -574,10 +580,12 @@ describe("RequestyHandler", () => {
574580 } )
575581
576582 it ( "omits temperature for Claude Fable 5 in completePrompt" , async ( ) => {
577- const handler = new RequestyHandler ( {
578- requestyApiKey : "test-key" ,
579- requestyModelId : "anthropic/claude-fable-5" ,
580- } )
583+ const handler = new RequestyHandler (
584+ makeApiHandlerOptions ( {
585+ requestyApiKey : "test-key" ,
586+ requestyModelId : "anthropic/claude-fable-5" ,
587+ } ) ,
588+ )
581589 mockCreate . mockResolvedValue ( { choices : [ { message : { content : "test completion" } } ] } )
582590
583591 await handler . completePrompt ( "test prompt" )
@@ -591,10 +599,12 @@ describe("RequestyHandler", () => {
591599 } )
592600
593601 it ( "omits temperature for Claude Sonnet 5 in completePrompt" , async ( ) => {
594- const handler = new RequestyHandler ( {
595- requestyApiKey : "test-key" ,
596- requestyModelId : "anthropic/claude-sonnet-5" ,
597- } )
602+ const handler = new RequestyHandler (
603+ makeApiHandlerOptions ( {
604+ requestyApiKey : "test-key" ,
605+ requestyModelId : "anthropic/claude-sonnet-5" ,
606+ } ) ,
607+ )
598608 mockCreate . mockResolvedValue ( { choices : [ { message : { content : "test completion" } } ] } )
599609
600610 await handler . completePrompt ( "test prompt" )
@@ -608,10 +618,12 @@ describe("RequestyHandler", () => {
608618 } )
609619
610620 it ( "omits temperature for Claude Opus 5 in completePrompt" , async ( ) => {
611- const handler = new RequestyHandler ( {
612- requestyApiKey : "test-key" ,
613- requestyModelId : "anthropic/claude-opus-5" ,
614- } )
621+ const handler = new RequestyHandler (
622+ makeApiHandlerOptions ( {
623+ requestyApiKey : "test-key" ,
624+ requestyModelId : "anthropic/claude-opus-5" ,
625+ } ) ,
626+ )
615627 mockCreate . mockResolvedValue ( { choices : [ { message : { content : "test completion" } } ] } )
616628
617629 await handler . completePrompt ( "test prompt" )
0 commit comments