@@ -263,6 +263,89 @@ describe("discoverDeepInfraModels (chat-only shim)", () => {
263263 } ) ;
264264 } ) ;
265265
266+ it ( "preserves bundled reasoning and compat while keeping live model facts authoritative" , async ( ) => {
267+ const rows = [
268+ makeAgentModelEntry ( {
269+ id : "deepseek-ai/DeepSeek-V4-Pro" ,
270+ metadata : {
271+ context_length : 96000 ,
272+ max_tokens : 4096 ,
273+ pricing : { input_tokens : 4 , output_tokens : 8 , cache_read_tokens : 0.4 } ,
274+ tags : [ "chat" ] ,
275+ } ,
276+ } ) ,
277+ makeAgentModelEntry ( {
278+ id : "stepfun-ai/Step-3.7-Flash" ,
279+ metadata : {
280+ context_length : 192000 ,
281+ max_tokens : 16384 ,
282+ pricing : { input_tokens : 0.2 , output_tokens : 1.15 } ,
283+ tags : [ "chat" , "vlm" , "vision" ] ,
284+ } ,
285+ } ) ,
286+ makeAgentModelEntry ( {
287+ id : "deepseek-ai/DeepSeek-V3.2" ,
288+ metadata : {
289+ context_length : 64000 ,
290+ max_tokens : 8192 ,
291+ pricing : { input_tokens : 1 , output_tokens : 2 } ,
292+ tags : [ "chat" , "reasoning" ] ,
293+ } ,
294+ } ) ,
295+ makeAgentModelEntry ( {
296+ id : "unlisted/no-reasoning" ,
297+ metadata : { context_length : 32000 , max_tokens : 2048 , pricing : { } , tags : [ "chat" ] } ,
298+ } ) ,
299+ makeAgentModelEntry ( {
300+ id : "unlisted/with-reasoning" ,
301+ metadata : {
302+ context_length : 48000 ,
303+ max_tokens : 4096 ,
304+ pricing : { } ,
305+ tags : [ "chat" , "reasoning_effort" ] ,
306+ } ,
307+ } ) ,
308+ ] ;
309+ const mockFetch = vi . fn ( ) . mockResolvedValue ( jsonResponse ( { data : rows } ) ) ;
310+ DEEPINFRA_MODEL_CATALOG . push ( DEEPINFRA_MODEL_CATALOG [ 0 ] ! ) ;
311+
312+ try {
313+ await withFetchPathTest ( mockFetch , { DEEPINFRA_API_KEY : "sk-test" } , async ( ) => {
314+ const models = await discoverDeepInfraModels ( ) ;
315+
316+ expect ( models . slice ( 0 , rows . length ) ) . toMatchObject ( [
317+ {
318+ id : "deepseek-ai/DeepSeek-V4-Pro" ,
319+ reasoning : true ,
320+ input : [ "text" ] ,
321+ contextWindow : 96000 ,
322+ maxTokens : 4096 ,
323+ cost : { input : 4 , output : 8 , cacheRead : 0.4 , cacheWrite : 0 } ,
324+ compat : {
325+ codeMode : "capable" ,
326+ supportsUsageInStreaming : true ,
327+ thinkingFormat : "deepseek" ,
328+ } ,
329+ } ,
330+ {
331+ id : "stepfun-ai/Step-3.7-Flash" ,
332+ reasoning : true ,
333+ input : [ "text" , "image" ] ,
334+ contextWindow : 192000 ,
335+ maxTokens : 16384 ,
336+ cost : { input : 0.2 , output : 1.15 , cacheRead : 0 , cacheWrite : 0 } ,
337+ } ,
338+ { id : "deepseek-ai/DeepSeek-V3.2" , reasoning : false } ,
339+ { id : "unlisted/no-reasoning" , reasoning : false } ,
340+ { id : "unlisted/with-reasoning" , reasoning : true } ,
341+ ] ) ;
342+ expect ( new Set ( models . map ( ( model ) => model . id ) ) . size ) . toBe ( models . length ) ;
343+ } ) ;
344+ } finally {
345+ DEEPINFRA_MODEL_CATALOG . pop ( ) ;
346+ }
347+ } ) ;
348+
266349 it ( "skips entries with no metadata or no surface tag, and deduplicates ids" , async ( ) => {
267350 const mockFetch = vi . fn ( ) . mockResolvedValue (
268351 jsonResponse ( {
0 commit comments