@@ -117,6 +117,104 @@ test("preserves temperature support from existing provider models", async () =>
117117 expect ( models [ "brand-new" ] . capabilities . temperature ) . toBe ( true )
118118} )
119119
120+ test ( "clears existing variants so refreshed models calculate provider-specific variants" , async ( ) => {
121+ globalThis . fetch = mock ( ( ) =>
122+ Promise . resolve (
123+ new Response (
124+ JSON . stringify ( {
125+ data : [
126+ {
127+ model_picker_enabled : true ,
128+ id : "claude-opus-4.7" ,
129+ name : "Claude Opus 4.7" ,
130+ version : "claude-opus-4.7-2026-04-16" ,
131+ supported_endpoints : [ "/v1/messages" ] ,
132+ capabilities : {
133+ family : "claude-opus" ,
134+ limits : {
135+ max_context_window_tokens : 144000 ,
136+ max_output_tokens : 64000 ,
137+ max_prompt_tokens : 128000 ,
138+ } ,
139+ supports : {
140+ adaptive_thinking : true ,
141+ streaming : true ,
142+ tool_calls : true ,
143+ } ,
144+ } ,
145+ } ,
146+ ] ,
147+ } ) ,
148+ { status : 200 } ,
149+ ) ,
150+ ) ,
151+ ) as unknown as typeof fetch
152+
153+ const models = await CopilotModels . get (
154+ "https://api.githubcopilot.com" ,
155+ { } ,
156+ {
157+ "claude-opus-4.7" : {
158+ id : "claude-opus-4.7" ,
159+ providerID : "github-copilot" ,
160+ api : {
161+ id : "claude-opus-4.7" ,
162+ url : "https://api.githubcopilot.com" ,
163+ npm : "@ai-sdk/github-copilot" ,
164+ } ,
165+ name : "Claude Opus 4.7" ,
166+ family : "claude-opus" ,
167+ capabilities : {
168+ temperature : true ,
169+ reasoning : true ,
170+ attachment : true ,
171+ toolcall : true ,
172+ input : {
173+ text : true ,
174+ audio : false ,
175+ image : true ,
176+ video : false ,
177+ pdf : false ,
178+ } ,
179+ output : {
180+ text : true ,
181+ audio : false ,
182+ image : false ,
183+ video : false ,
184+ pdf : false ,
185+ } ,
186+ interleaved : false ,
187+ } ,
188+ cost : {
189+ input : 0 ,
190+ output : 0 ,
191+ cache : {
192+ read : 0 ,
193+ write : 0 ,
194+ } ,
195+ } ,
196+ limit : {
197+ context : 144000 ,
198+ input : 128000 ,
199+ output : 64000 ,
200+ } ,
201+ options : { } ,
202+ headers : { } ,
203+ release_date : "2026-04-16" ,
204+ variants : {
205+ low : {
206+ reasoningEffort : "low" ,
207+ } ,
208+ } ,
209+ status : "active" ,
210+ } ,
211+ } ,
212+ )
213+
214+ expect ( models [ "claude-opus-4.7" ] . api . npm ) . toBe ( "@ai-sdk/anthropic" )
215+ expect ( models [ "claude-opus-4.7" ] . variants ) . toBeUndefined ( )
216+ } )
217+
120218test ( "remaps fallback oauth model urls to the enterprise host" , async ( ) => {
121219 globalThis . fetch = mock ( ( ) => Promise . reject ( new Error ( "timeout" ) ) ) as unknown as typeof fetch
122220
0 commit comments