@@ -12,6 +12,8 @@ import {
1212 deriveProviderPresets ,
1313 providerConfigSeed ,
1414} from "../src/providers/derive" ;
15+ import { FREE_PROVIDER_DIRECTORY } from "../src/providers/free-directory" ;
16+ import { resolveProviderModelDiscovery } from "../src/providers/model-discovery" ;
1517import { PROVIDER_REGISTRY , type ProviderRegistryEntry } from "../src/providers/registry" ;
1618import { routedSlug } from "../src/providers/slug-codec" ;
1719import { routeModel } from "../src/router" ;
@@ -51,6 +53,7 @@ afterEach(() => {
5153 globalThis . fetch = originalFetch ;
5254 clearModelCache ( "sambanova" ) ;
5355 clearModelCache ( "nebius" ) ;
56+ clearModelCache ( "nebius-team" ) ;
5457} ) ;
5558
5659function registryEntry ( id : ProviderId ) : ProviderRegistryEntry {
@@ -90,7 +93,9 @@ describe("SambaNova and Nebius providers", () => {
9093 dashboardUrl : PROVIDERS . sambanova . dashboardUrl ,
9194 liveModels : true ,
9295 preserveCustomDestination : true ,
96+ apiKeyValidation : "unknown" ,
9397 parallelToolCalls : false ,
98+ reasoningEfforts : [ ] ,
9499 modelDiscovery : {
95100 path : "models" ,
96101 maxResponseBytes : 131_072 ,
@@ -109,6 +114,7 @@ describe("SambaNova and Nebius providers", () => {
109114 liveModels : true ,
110115 preserveCustomDestination : true ,
111116 parallelToolCalls : false ,
117+ reasoningEfforts : [ ] ,
112118 modelDiscovery : {
113119 path : "models" ,
114120 query : { verbose : "true" } ,
@@ -120,6 +126,9 @@ describe("SambaNova and Nebius providers", () => {
120126 } ,
121127 } ) ;
122128 expect ( registryEntry ( "nebius" ) . note ) . toContain ( "embedding and image-generation rows" ) ;
129+ expect ( FREE_PROVIDER_DIRECTORY . find ( row => row . id === "nebius" ) ) . toMatchObject ( {
130+ modelsUrl : PROVIDERS . nebius . modelsUrl ,
131+ } ) ;
123132 } ) ;
124133
125134 test ( "derives CLI and dashboard presets without persisting registry trust policy" , ( ) => {
@@ -133,6 +142,7 @@ describe("SambaNova and Nebius providers", () => {
133142 baseUrl : provider . baseUrl ,
134143 dashboardUrl : provider . dashboardUrl ,
135144 liveModels : true ,
145+ ...( id === "sambanova" ? { apiKeyValidation : "unknown" } : { } ) ,
136146 } ) ;
137147 expect ( buildInitProviders ( ) . find ( row => row . id === id ) ) . toMatchObject ( {
138148 kind : "key" ,
@@ -151,34 +161,52 @@ describe("SambaNova and Nebius providers", () => {
151161 authMode : "key" ,
152162 liveModels : true ,
153163 parallelToolCalls : false ,
164+ reasoningEfforts : [ ] ,
154165 } ) ;
166+ expect ( seed ) . not . toHaveProperty ( "apiKeyValidation" ) ;
155167 expect ( seed ) . not . toHaveProperty ( "modelDiscovery" ) ;
156168 expect ( seed ) . not . toHaveProperty ( "preserveCustomDestination" ) ;
157169 expect ( KEY_LOGIN_PROVIDERS [ id ] ) . not . toHaveProperty ( "modelDiscovery" ) ;
158170 expect ( KEY_LOGIN_PROVIDERS [ id ] ) . not . toHaveProperty ( "preserveCustomDestination" ) ;
159171 }
160172 } ) ;
161173
162- test ( "lists and validates models through each registry-owned endpoint " , async ( ) => {
174+ test ( "builds each registry-owned models request and validates the authenticated Nebius catalog " , async ( ) => {
163175 for ( const id of [ "sambanova" , "nebius" ] as const ) {
164176 const provider = PROVIDERS [ id ] ;
165177 expect ( buildModelsRequest ( providerConfig ( id ) . providers [ id ] ! , provider . key , id ) ) . toEqual ( {
166178 url : provider . modelsUrl ,
167179 headers : { Authorization : `Bearer ${ provider . key } ` } ,
168180 } ) ;
181+ }
169182
170- globalThis . fetch = ( async ( input , init ) => {
171- expect ( String ( input ) ) . toBe ( provider . modelsUrl ) ;
172- expect ( new Headers ( init ?. headers ) . get ( "authorization" ) ) . toBe ( `Bearer ${ provider . key } ` ) ;
173- expect ( init ?. redirect ) . toBe ( "error" ) ;
174- return new Response ( provider . fixture , {
175- status : 200 ,
176- headers : { "content-type" : "application/json" } ,
177- } ) ;
178- } ) as typeof fetch ;
183+ const provider = PROVIDERS . nebius ;
184+ globalThis . fetch = ( async ( input , init ) => {
185+ expect ( String ( input ) ) . toBe ( provider . modelsUrl ) ;
186+ expect ( new Headers ( init ?. headers ) . get ( "authorization" ) ) . toBe ( `Bearer ${ provider . key } ` ) ;
187+ expect ( init ?. redirect ) . toBe ( "error" ) ;
188+ return new Response ( provider . fixture , {
189+ status : 200 ,
190+ headers : { "content-type" : "application/json" } ,
191+ } ) ;
192+ } ) as typeof fetch ;
179193
180- expect ( await validateApiKey ( id , KEY_LOGIN_PROVIDERS [ id ] ! , provider . key ) ) . toBe ( true ) ;
181- }
194+ expect ( await validateApiKey ( "nebius" , KEY_LOGIN_PROVIDERS . nebius ! , provider . key ) ) . toBe ( true ) ;
195+ } ) ;
196+
197+ test ( "does not treat SambaNova's public model catalog as proof that a key is valid" , async ( ) => {
198+ let fetchCalled = false ;
199+ globalThis . fetch = ( async ( ) => {
200+ fetchCalled = true ;
201+ return new Response ( SAMBANOVA_FIXTURE , { status : 200 } ) ;
202+ } ) as typeof fetch ;
203+
204+ expect ( await validateApiKey (
205+ "sambanova" ,
206+ KEY_LOGIN_PROVIDERS . sambanova ! ,
207+ PROVIDERS . sambanova . key ,
208+ ) ) . toBe ( "unknown" ) ;
209+ expect ( fetchCalled ) . toBe ( false ) ;
182210 } ) ;
183211
184212 test ( "filters Nebius mixed rows and preserves model metadata and native ids" , async ( ) => {
@@ -220,6 +248,7 @@ describe("SambaNova and Nebius providers", () => {
220248 expect ( sambanovaModels [ 1 ] ) . toMatchObject ( {
221249 owned_by : "sambanova" ,
222250 contextWindow : 131_072 ,
251+ reasoningEfforts : [ ] ,
223252 } ) ;
224253 expect ( nebiusModels . map ( row => row . id ) ) . toEqual ( [
225254 "meta-llama/Meta-Llama-3.1-8B-Instruct-fast" ,
@@ -230,6 +259,7 @@ describe("SambaNova and Nebius providers", () => {
230259 contextWindow : 131_072 ,
231260 inputModalities : [ "text" ] ,
232261 capabilities : [ "function-calling" , "json-mode" ] ,
262+ reasoningEfforts : [ ] ,
233263 } ) ;
234264 expect ( nebiusModels [ 1 ] ) . toMatchObject ( {
235265 contextWindow : 262_144 ,
@@ -246,6 +276,33 @@ describe("SambaNova and Nebius providers", () => {
246276 }
247277 } ) ;
248278
279+ test ( "keeps Nebius query and text-output filtering when the preset is renamed" , async ( ) => {
280+ const provider = PROVIDERS . nebius ;
281+ globalThis . fetch = ( async ( input , init ) => {
282+ expect ( String ( input ) ) . toBe ( provider . modelsUrl ) ;
283+ expect ( new Headers ( init ?. headers ) . get ( "authorization" ) ) . toBe ( `Bearer ${ provider . key } ` ) ;
284+ expect ( init ?. redirect ) . toBe ( "manual" ) ;
285+ return new Response ( provider . fixture , {
286+ status : 200 ,
287+ headers : { "content-type" : "application/json" } ,
288+ } ) ;
289+ } ) as typeof fetch ;
290+
291+ const renamed = "nebius-team" ;
292+ const config = withStubbedProviderFetch ( {
293+ port : 10100 ,
294+ defaultProvider : renamed ,
295+ providers : {
296+ [ renamed ] : providerConfig ( "nebius" ) . providers . nebius ! ,
297+ } ,
298+ } satisfies OcxConfig ) ;
299+ const models = await gatherRoutedModels ( config ) ;
300+ expect ( models . filter ( row => row . provider === renamed ) . map ( row => row . id ) ) . toEqual ( [
301+ "meta-llama/Meta-Llama-3.1-8B-Instruct-fast" ,
302+ "Qwen/Qwen3-VL-235B-A22B-Instruct" ,
303+ ] ) ;
304+ } ) ;
305+
249306 test ( "routes tool requests to the fixed hosts without claiming parallel tool calls" , ( ) => {
250307 const cases = [
251308 [ "sambanova" , "Meta-Llama-3.3-70B-Instruct" ] ,
@@ -265,14 +322,15 @@ describe("SambaNova and Nebius providers", () => {
265322 } ] ,
266323 } ,
267324 stream : true ,
268- options : { } ,
325+ options : { reasoning : "high" } ,
269326 } ) ;
270327 const body = JSON . parse ( String ( request . body ) ) as Record < string , unknown > ;
271328
272329 expect ( request . url ) . toBe ( `${ PROVIDERS [ providerId ] . baseUrl } /chat/completions` ) ;
273330 expect ( request . headers . Authorization ) . toBe ( `Bearer ${ PROVIDERS [ providerId ] . key } ` ) ;
274331 expect ( body . model ) . toBe ( modelId ) ;
275332 expect ( body . parallel_tool_calls ) . toBe ( false ) ;
333+ expect ( body ) . not . toHaveProperty ( "reasoning_effort" ) ;
276334 }
277335 } ) ;
278336
@@ -300,5 +358,14 @@ describe("SambaNova and Nebius providers", () => {
300358 authMode : "key" ,
301359 } ) ;
302360 }
361+
362+ const crossPreset = providerConfig ( "sambanova" , {
363+ baseUrl : PROVIDERS . nebius . baseUrl ,
364+ } ) . providers . sambanova ! ;
365+ expect ( resolveProviderModelDiscovery ( "sambanova" , crossPreset ) . spec ) . toBeUndefined ( ) ;
366+ expect ( buildModelsRequest ( crossPreset , "custom-key" , "sambanova" ) ) . toEqual ( {
367+ url : `${ PROVIDERS . nebius . baseUrl } /models` ,
368+ headers : { Authorization : "Bearer custom-key" } ,
369+ } ) ;
303370 } ) ;
304371} ) ;
0 commit comments