@mupt-ai/dari-gateway 1.0.365 → 1.0.366

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -145,5 +145,481 @@
145
145
  "native_model_id": "deepseek-v4.1-flash",
146
146
  "api": "openai-completions",
147
147
  "base_url": "https://opencode.ai/inference/go/openai/v1"
148
+ },
149
+ {
150
+ "model_id": "openai/gpt-6.2-astra",
151
+ "provider": "openrouter",
152
+ "native_model_id": "openai/gpt-6.2-astra",
153
+ "api": "openai-completions",
154
+ "base_url": "https://openrouter.ai/api/v1"
155
+ },
156
+ {
157
+ "model_id": "openai/gpt-6-astra",
158
+ "provider": "openrouter",
159
+ "native_model_id": "openai/gpt-6-astra",
160
+ "api": "openai-completions",
161
+ "base_url": "https://openrouter.ai/api/v1"
162
+ },
163
+ {
164
+ "model_id": "openai/gpt-5.6-sol",
165
+ "provider": "openrouter",
166
+ "native_model_id": "openai/gpt-5.6-sol",
167
+ "api": "openai-completions",
168
+ "base_url": "https://openrouter.ai/api/v1"
169
+ },
170
+ {
171
+ "model_id": "openai/gpt-5.6-terra",
172
+ "provider": "openrouter",
173
+ "native_model_id": "openai/gpt-5.6-terra",
174
+ "api": "openai-completions",
175
+ "base_url": "https://openrouter.ai/api/v1"
176
+ },
177
+ {
178
+ "model_id": "openai/gpt-5.6-luna",
179
+ "provider": "openrouter",
180
+ "native_model_id": "openai/gpt-5.6-luna",
181
+ "api": "openai-completions",
182
+ "base_url": "https://openrouter.ai/api/v1"
183
+ },
184
+ {
185
+ "model_id": "anthropic/claude-opus-5-5",
186
+ "provider": "openrouter",
187
+ "native_model_id": "anthropic/claude-opus-5.5",
188
+ "api": "openai-completions",
189
+ "base_url": "https://openrouter.ai/api/v1"
190
+ },
191
+ {
192
+ "model_id": "anthropic/claude-opus-5",
193
+ "provider": "openrouter",
194
+ "native_model_id": "anthropic/claude-opus-5",
195
+ "api": "openai-completions",
196
+ "base_url": "https://openrouter.ai/api/v1"
197
+ },
198
+ {
199
+ "model_id": "anthropic/claude-sonnet-5-5",
200
+ "provider": "openrouter",
201
+ "native_model_id": "anthropic/claude-sonnet-5.5",
202
+ "api": "openai-completions",
203
+ "base_url": "https://openrouter.ai/api/v1"
204
+ },
205
+ {
206
+ "model_id": "anthropic/claude-sonnet-5",
207
+ "provider": "openrouter",
208
+ "native_model_id": "anthropic/claude-sonnet-5",
209
+ "api": "openai-completions",
210
+ "base_url": "https://openrouter.ai/api/v1"
211
+ },
212
+ {
213
+ "model_id": "anthropic/claude-fable-5",
214
+ "provider": "openrouter",
215
+ "native_model_id": "anthropic/claude-fable-5",
216
+ "api": "openai-completions",
217
+ "base_url": "https://openrouter.ai/api/v1"
218
+ },
219
+ {
220
+ "model_id": "anthropic/claude-haiku-5-5",
221
+ "provider": "openrouter",
222
+ "native_model_id": "anthropic/claude-haiku-5.5",
223
+ "api": "openai-completions",
224
+ "base_url": "https://openrouter.ai/api/v1"
225
+ },
226
+ {
227
+ "model_id": "anthropic/claude-haiku-5-5",
228
+ "provider": "vercel-ai-gateway",
229
+ "native_model_id": "anthropic/claude-haiku-5.5",
230
+ "api": "openai-completions",
231
+ "base_url": "https://ai-gateway.vercel.sh/v1"
232
+ },
233
+ {
234
+ "model_id": "anthropic/claude-haiku-4-5",
235
+ "provider": "openrouter",
236
+ "native_model_id": "anthropic/claude-haiku-4.5",
237
+ "api": "openai-completions",
238
+ "base_url": "https://openrouter.ai/api/v1"
239
+ },
240
+ {
241
+ "model_id": "moonshotai/Kimi-K3",
242
+ "provider": "openrouter",
243
+ "native_model_id": "moonshotai/kimi-k3",
244
+ "api": "openai-completions",
245
+ "base_url": "https://openrouter.ai/api/v1"
246
+ },
247
+ {
248
+ "model_id": "moonshotai/Kimi-K3.1-Pro",
249
+ "provider": "openrouter",
250
+ "native_model_id": "moonshotai/kimi-k3.1-pro",
251
+ "api": "openai-completions",
252
+ "base_url": "https://openrouter.ai/api/v1"
253
+ },
254
+ {
255
+ "model_id": "zai-org/GLM-5.3",
256
+ "provider": "openrouter",
257
+ "native_model_id": "z-ai/glm-5.3",
258
+ "api": "openai-completions",
259
+ "base_url": "https://openrouter.ai/api/v1"
260
+ },
261
+ {
262
+ "model_id": "zai-org/GLM-5.3-Flash",
263
+ "provider": "openrouter",
264
+ "native_model_id": "z-ai/glm-5.3-flash",
265
+ "api": "openai-completions",
266
+ "base_url": "https://openrouter.ai/api/v1"
267
+ },
268
+ {
269
+ "model_id": "deepseek-ai/DeepSeek-V4-Pro-0813",
270
+ "provider": "openrouter",
271
+ "native_model_id": "deepseek/deepseek-v4-pro-0813",
272
+ "api": "openai-completions",
273
+ "base_url": "https://openrouter.ai/api/v1"
274
+ },
275
+ {
276
+ "model_id": "zai-org/GLM-5.2",
277
+ "provider": "openrouter",
278
+ "native_model_id": "z-ai/glm-5.2",
279
+ "api": "openai-completions",
280
+ "base_url": "https://openrouter.ai/api/v1"
281
+ },
282
+ {
283
+ "model_id": "deepseek-ai/DeepSeek-V4-Flash-0731",
284
+ "provider": "openrouter",
285
+ "native_model_id": "deepseek/deepseek-v4-flash-0731",
286
+ "api": "openai-completions",
287
+ "base_url": "https://openrouter.ai/api/v1"
288
+ },
289
+ {
290
+ "model_id": "deepseek-ai/DeepSeek-V4.1-Flash-1017",
291
+ "provider": "openrouter",
292
+ "native_model_id": "deepseek/deepseek-v4.1-flash-1017",
293
+ "api": "openai-completions",
294
+ "base_url": "https://openrouter.ai/api/v1"
295
+ },
296
+ {
297
+ "model_id": "deepseek-ai/DeepSeek-V4.1-Flash",
298
+ "provider": "openrouter",
299
+ "native_model_id": "deepseek/deepseek-v4.1-flash",
300
+ "api": "openai-completions",
301
+ "base_url": "https://openrouter.ai/api/v1"
302
+ },
303
+ {
304
+ "model_id": "xai/grok-4.6",
305
+ "provider": "openrouter",
306
+ "native_model_id": "x-ai/grok-4.6",
307
+ "api": "openai-completions",
308
+ "base_url": "https://openrouter.ai/api/v1"
309
+ },
310
+ {
311
+ "model_id": "xai/grok-4.7",
312
+ "provider": "openrouter",
313
+ "native_model_id": "x-ai/grok-4.7",
314
+ "api": "openai-completions",
315
+ "base_url": "https://openrouter.ai/api/v1"
316
+ },
317
+ {
318
+ "model_id": "meta/muse-ember",
319
+ "provider": "openrouter",
320
+ "native_model_id": "meta/muse-ember",
321
+ "api": "openai-completions",
322
+ "base_url": "https://openrouter.ai/api/v1"
323
+ },
324
+ {
325
+ "model_id": "meta/muse-spark-1.2",
326
+ "provider": "openrouter",
327
+ "native_model_id": "meta/muse-spark-1.2",
328
+ "api": "openai-completions",
329
+ "base_url": "https://openrouter.ai/api/v1"
330
+ },
331
+ {
332
+ "model_id": "meta/muse-spark-1.3",
333
+ "provider": "openrouter",
334
+ "native_model_id": "meta/muse-spark-1.3",
335
+ "api": "openai-completions",
336
+ "base_url": "https://openrouter.ai/api/v1"
337
+ },
338
+ {
339
+ "model_id": "meta/muse-wonder-1.0",
340
+ "provider": "openrouter",
341
+ "native_model_id": "meta/muse-wonder",
342
+ "api": "openai-completions",
343
+ "base_url": "https://openrouter.ai/api/v1"
344
+ },
345
+ {
346
+ "model_id": "meta/muse-spark-open",
347
+ "provider": "openrouter",
348
+ "native_model_id": "meta/muse-spark-open",
349
+ "api": "openai-completions",
350
+ "base_url": "https://openrouter.ai/api/v1"
351
+ },
352
+ {
353
+ "model_id": "openai/gpt-6.2-astra",
354
+ "provider": "vercel-ai-gateway",
355
+ "native_model_id": "openai/gpt-6.2-astra",
356
+ "api": "openai-completions",
357
+ "base_url": "https://ai-gateway.vercel.sh/v1"
358
+ },
359
+ {
360
+ "model_id": "openai/gpt-6-astra",
361
+ "provider": "vercel-ai-gateway",
362
+ "native_model_id": "openai/gpt-6-astra",
363
+ "api": "openai-completions",
364
+ "base_url": "https://ai-gateway.vercel.sh/v1"
365
+ },
366
+ {
367
+ "model_id": "openai/gpt-6.1-terra",
368
+ "provider": "openrouter",
369
+ "native_model_id": "openai/gpt-6.1-terra",
370
+ "api": "openai-completions",
371
+ "base_url": "https://openrouter.ai/api/v1"
372
+ },
373
+ {
374
+ "model_id": "openai/gpt-6.1-terra",
375
+ "provider": "vercel-ai-gateway",
376
+ "native_model_id": "openai/gpt-6.1-terra",
377
+ "api": "openai-completions",
378
+ "base_url": "https://ai-gateway.vercel.sh/v1"
379
+ },
380
+ {
381
+ "model_id": "openai/gpt-6.2-sol",
382
+ "provider": "openrouter",
383
+ "native_model_id": "openai/gpt-6.2-sol",
384
+ "api": "openai-completions",
385
+ "base_url": "https://openrouter.ai/api/v1"
386
+ },
387
+ {
388
+ "model_id": "openai/gpt-6.1-sol",
389
+ "provider": "openrouter",
390
+ "native_model_id": "openai/gpt-6.1-sol",
391
+ "api": "openai-completions",
392
+ "base_url": "https://openrouter.ai/api/v1"
393
+ },
394
+ {
395
+ "model_id": "openai/gpt-6.2-sol",
396
+ "provider": "vercel-ai-gateway",
397
+ "native_model_id": "openai/gpt-6.2-sol",
398
+ "api": "openai-completions",
399
+ "base_url": "https://ai-gateway.vercel.sh/v1"
400
+ },
401
+ {
402
+ "model_id": "openai/gpt-6.1-sol",
403
+ "provider": "vercel-ai-gateway",
404
+ "native_model_id": "openai/gpt-6.1-sol",
405
+ "api": "openai-completions",
406
+ "base_url": "https://ai-gateway.vercel.sh/v1"
407
+ },
408
+ {
409
+ "model_id": "openai/gpt-6-sol",
410
+ "provider": "vercel-ai-gateway",
411
+ "native_model_id": "openai/gpt-6-sol",
412
+ "api": "openai-completions",
413
+ "base_url": "https://ai-gateway.vercel.sh/v1"
414
+ },
415
+ {
416
+ "model_id": "openai/gpt-6-luna",
417
+ "provider": "vercel-ai-gateway",
418
+ "native_model_id": "openai/gpt-6-luna",
419
+ "api": "openai-completions",
420
+ "base_url": "https://ai-gateway.vercel.sh/v1"
421
+ },
422
+ {
423
+ "model_id": "openai/gpt-5.6-sol",
424
+ "provider": "vercel-ai-gateway",
425
+ "native_model_id": "openai/gpt-5.6-sol",
426
+ "api": "openai-completions",
427
+ "base_url": "https://ai-gateway.vercel.sh/v1"
428
+ },
429
+ {
430
+ "model_id": "openai/gpt-5.6-terra",
431
+ "provider": "vercel-ai-gateway",
432
+ "native_model_id": "openai/gpt-5.6-terra",
433
+ "api": "openai-completions",
434
+ "base_url": "https://ai-gateway.vercel.sh/v1"
435
+ },
436
+ {
437
+ "model_id": "openai/gpt-5.6-luna",
438
+ "provider": "vercel-ai-gateway",
439
+ "native_model_id": "openai/gpt-5.6-luna",
440
+ "api": "openai-completions",
441
+ "base_url": "https://ai-gateway.vercel.sh/v1"
442
+ },
443
+ {
444
+ "model_id": "anthropic/claude-opus-5-5",
445
+ "provider": "vercel-ai-gateway",
446
+ "native_model_id": "anthropic/claude-opus-5.5",
447
+ "api": "openai-completions",
448
+ "base_url": "https://ai-gateway.vercel.sh/v1"
449
+ },
450
+ {
451
+ "model_id": "anthropic/claude-opus-5",
452
+ "provider": "vercel-ai-gateway",
453
+ "native_model_id": "anthropic/claude-opus-5",
454
+ "api": "openai-completions",
455
+ "base_url": "https://ai-gateway.vercel.sh/v1"
456
+ },
457
+ {
458
+ "model_id": "anthropic/claude-sonnet-5-5",
459
+ "provider": "vercel-ai-gateway",
460
+ "native_model_id": "anthropic/claude-sonnet-5.5",
461
+ "api": "openai-completions",
462
+ "base_url": "https://ai-gateway.vercel.sh/v1"
463
+ },
464
+ {
465
+ "model_id": "anthropic/claude-sonnet-5",
466
+ "provider": "vercel-ai-gateway",
467
+ "native_model_id": "anthropic/claude-sonnet-5",
468
+ "api": "openai-completions",
469
+ "base_url": "https://ai-gateway.vercel.sh/v1"
470
+ },
471
+ {
472
+ "model_id": "anthropic/claude-fable-5-2",
473
+ "provider": "openrouter",
474
+ "native_model_id": "anthropic/claude-fable-5.2",
475
+ "api": "openai-completions",
476
+ "base_url": "https://openrouter.ai/api/v1"
477
+ },
478
+ {
479
+ "model_id": "anthropic/claude-fable-5-2",
480
+ "provider": "vercel-ai-gateway",
481
+ "native_model_id": "anthropic/claude-fable-5.2",
482
+ "api": "openai-completions",
483
+ "base_url": "https://ai-gateway.vercel.sh/v1"
484
+ },
485
+ {
486
+ "model_id": "anthropic/claude-fable-5-1",
487
+ "provider": "openrouter",
488
+ "native_model_id": "anthropic/claude-fable-5.1",
489
+ "api": "openai-completions",
490
+ "base_url": "https://openrouter.ai/api/v1"
491
+ },
492
+ {
493
+ "model_id": "anthropic/claude-fable-5-1",
494
+ "provider": "vercel-ai-gateway",
495
+ "native_model_id": "anthropic/claude-fable-5.1",
496
+ "api": "openai-completions",
497
+ "base_url": "https://ai-gateway.vercel.sh/v1"
498
+ },
499
+ {
500
+ "model_id": "anthropic/claude-fable-5",
501
+ "provider": "vercel-ai-gateway",
502
+ "native_model_id": "anthropic/claude-fable-5",
503
+ "api": "openai-completions",
504
+ "base_url": "https://ai-gateway.vercel.sh/v1"
505
+ },
506
+ {
507
+ "model_id": "anthropic/claude-haiku-4-5",
508
+ "provider": "vercel-ai-gateway",
509
+ "native_model_id": "anthropic/claude-haiku-4.5",
510
+ "api": "openai-completions",
511
+ "base_url": "https://ai-gateway.vercel.sh/v1"
512
+ },
513
+ {
514
+ "model_id": "moonshotai/Kimi-K3",
515
+ "provider": "vercel-ai-gateway",
516
+ "native_model_id": "moonshotai/kimi-k3",
517
+ "api": "openai-completions",
518
+ "base_url": "https://ai-gateway.vercel.sh/v1"
519
+ },
520
+ {
521
+ "model_id": "moonshotai/Kimi-K3.1-Pro",
522
+ "provider": "vercel-ai-gateway",
523
+ "native_model_id": "moonshotai/kimi-k3.1-pro",
524
+ "api": "openai-completions",
525
+ "base_url": "https://ai-gateway.vercel.sh/v1"
526
+ },
527
+ {
528
+ "model_id": "zai-org/GLM-5.3",
529
+ "provider": "vercel-ai-gateway",
530
+ "native_model_id": "zai/glm-5.3",
531
+ "api": "openai-completions",
532
+ "base_url": "https://ai-gateway.vercel.sh/v1"
533
+ },
534
+ {
535
+ "model_id": "zai-org/GLM-5.3-Flash",
536
+ "provider": "vercel-ai-gateway",
537
+ "native_model_id": "zai/glm-5.3-flash",
538
+ "api": "openai-completions",
539
+ "base_url": "https://ai-gateway.vercel.sh/v1"
540
+ },
541
+ {
542
+ "model_id": "deepseek-ai/DeepSeek-V4-Pro-0813",
543
+ "provider": "vercel-ai-gateway",
544
+ "native_model_id": "deepseek/deepseek-v4-pro-0813",
545
+ "api": "openai-completions",
546
+ "base_url": "https://ai-gateway.vercel.sh/v1"
547
+ },
548
+ {
549
+ "model_id": "zai-org/GLM-5.2",
550
+ "provider": "vercel-ai-gateway",
551
+ "native_model_id": "zai/glm-5.2",
552
+ "api": "openai-completions",
553
+ "base_url": "https://ai-gateway.vercel.sh/v1"
554
+ },
555
+ {
556
+ "model_id": "deepseek-ai/DeepSeek-V4-Flash-0731",
557
+ "provider": "vercel-ai-gateway",
558
+ "native_model_id": "deepseek/deepseek-v4-flash-0731",
559
+ "api": "openai-completions",
560
+ "base_url": "https://ai-gateway.vercel.sh/v1"
561
+ },
562
+ {
563
+ "model_id": "deepseek-ai/DeepSeek-V4.1-Flash-1017",
564
+ "provider": "vercel-ai-gateway",
565
+ "native_model_id": "deepseek/deepseek-v4.1-flash-1017",
566
+ "api": "openai-completions",
567
+ "base_url": "https://ai-gateway.vercel.sh/v1"
568
+ },
569
+ {
570
+ "model_id": "deepseek-ai/DeepSeek-V4.1-Flash",
571
+ "provider": "vercel-ai-gateway",
572
+ "native_model_id": "deepseek/deepseek-v4.1-flash",
573
+ "api": "openai-completions",
574
+ "base_url": "https://ai-gateway.vercel.sh/v1"
575
+ },
576
+ {
577
+ "model_id": "xai/grok-4.6",
578
+ "provider": "vercel-ai-gateway",
579
+ "native_model_id": "spacexai/grok-4.6",
580
+ "api": "openai-completions",
581
+ "base_url": "https://ai-gateway.vercel.sh/v1"
582
+ },
583
+ {
584
+ "model_id": "xai/grok-4.7",
585
+ "provider": "vercel-ai-gateway",
586
+ "native_model_id": "spacexai/grok-4.7",
587
+ "api": "openai-completions",
588
+ "base_url": "https://ai-gateway.vercel.sh/v1"
589
+ },
590
+ {
591
+ "model_id": "meta/muse-ember",
592
+ "provider": "vercel-ai-gateway",
593
+ "native_model_id": "meta/muse-ember",
594
+ "api": "openai-completions",
595
+ "base_url": "https://ai-gateway.vercel.sh/v1"
596
+ },
597
+ {
598
+ "model_id": "meta/muse-spark-1.2",
599
+ "provider": "vercel-ai-gateway",
600
+ "native_model_id": "meta/muse-spark-1.2",
601
+ "api": "openai-completions",
602
+ "base_url": "https://ai-gateway.vercel.sh/v1"
603
+ },
604
+ {
605
+ "model_id": "meta/muse-spark-1.3",
606
+ "provider": "vercel-ai-gateway",
607
+ "native_model_id": "meta/muse-spark-1.3",
608
+ "api": "openai-completions",
609
+ "base_url": "https://ai-gateway.vercel.sh/v1"
610
+ },
611
+ {
612
+ "model_id": "meta/muse-wonder-1.0",
613
+ "provider": "vercel-ai-gateway",
614
+ "native_model_id": "meta/muse-wonder-1.0",
615
+ "api": "openai-completions",
616
+ "base_url": "https://ai-gateway.vercel.sh/v1"
617
+ },
618
+ {
619
+ "model_id": "meta/muse-spark-open",
620
+ "provider": "vercel-ai-gateway",
621
+ "native_model_id": "meta/muse-spark-open",
622
+ "api": "openai-completions",
623
+ "base_url": "https://ai-gateway.vercel.sh/v1"
148
624
  }
149
625
  ]
@@ -7,7 +7,7 @@ import {
7
7
 
8
8
  import { CLIENT_HARNESSES } from "../ingress/client_harness.js";
9
9
  import { checkSources, DEFAULT_RESET_MIN_HOURS, type Source } from "../models/sources.js";
10
- import { otherModelProviders, providerModel } from "../models/canonical.js";
10
+ import { modelKeyProviders, otherModelProviders, providerModel } from "../models/canonical.js";
11
11
  import type { ClientHarness, RouterRole, RouterRoleModels, RouterRolePrompts } from "../types.js";
12
12
 
13
13
  /**
@@ -114,6 +114,14 @@ export function modelProvider(model: RouterModelConfig): string {
114
114
  return model.provider ?? providerForModel(model.id);
115
115
  }
116
116
 
117
+ /**
118
+ * The providers whose API key may serve a model, in order: the one its spec
119
+ * names, else those the catalog runs it on (see `modelKeyProviders`).
120
+ */
121
+ export function keyProviders(model: RouterModelConfig): string[] {
122
+ return model.provider === undefined ? modelKeyProviders(model.id) : [model.provider];
123
+ }
124
+
117
125
  export const ROUTER_ID_PATTERN = /^[A-Za-z0-9_-]+$/;
118
126
  const PROVIDER_ID_PATTERN = /^[a-z0-9][a-z0-9.-]*$/;
119
127
  const MODEL_ID_PATTERN = /^[a-z0-9][a-z0-9.-]*\/\S+$/;
@@ -16,7 +16,7 @@ import { HostedSync, readHostedAccounts } from "./hosted_sync.js";
16
16
  import { createSelfHostedPlatform } from "./platform.js";
17
17
  import { checkProviderKey } from "../providers/key_check.js";
18
18
  import { CANONICAL_MODELS } from "../models/canonical.js";
19
- import { allRouterModels, loadGatewayConfig, modelProvider, type GatewayConfig, type RouterConfig } from "./config.js";
19
+ import { allRouterModels, keyProviders, loadGatewayConfig, type GatewayConfig, type RouterConfig } from "./config.js";
20
20
  import {
21
21
  configuredProviderApiKey,
22
22
  gatewayKeyIndex,
@@ -261,7 +261,7 @@ async function checkConfiguredProviderKeys(
261
261
  providerApiKey: (provider: string) => Promise<string | undefined>,
262
262
  ): Promise<void> {
263
263
  const providers = new Set(
264
- routers.flatMap((router) => allRouterModels(router).map(modelProvider)),
264
+ routers.flatMap((router) => allRouterModels(router).flatMap(keyProviders)),
265
265
  );
266
266
  const checks = await Promise.all([...providers].map(async (provider) => {
267
267
  const endpoint = config.providers[provider];
@@ -32,6 +32,7 @@ import type {
32
32
  } from "../types.js";
33
33
  import {
34
34
  allRouterModels,
35
+ keyProviders,
35
36
  modelProvider,
36
37
  routerModelsFor,
37
38
  type GatewayConfig,
@@ -234,10 +235,15 @@ export async function resolveSelfHostedRouter(
234
235
  },
235
236
  });
236
237
  }
238
+ // The first provider with a key serves: the one the spec names, else any
239
+ // the catalog runs the model on. A grant's keys serve as grantModels set.
240
+ const keyed = grant === null ? keyProviders(model) : [base];
237
241
  let keyCandidate = async (): Promise<Candidate | null> => {
238
- const key = await apiKey(base);
239
- if (key === undefined) return null;
240
- return { provider: base, key };
242
+ for (const provider of keyed) {
243
+ const key = await apiKey(provider);
244
+ if (key !== undefined) return { provider, key };
245
+ }
246
+ return null;
241
247
  };
242
248
  // A self-hosted gateway has no managed keys.
243
249
  let managedCandidate = async (): Promise<Candidate | null> => null;
@@ -259,7 +265,7 @@ export async function resolveSelfHostedRouter(
259
265
 
260
266
  if (candidates.length === 0) {
261
267
  for (const kind of heldKinds) exhausted.add(kind);
262
- unserved.add(base);
268
+ for (const provider of keyed) unserved.add(provider);
263
269
  // A granted plan may serve another maker's model: name the plan's provider too.
264
270
  if (grant !== null) for (const kind of heldKinds) unserved.add(subscriptionModelProvider(kind));
265
271
  if (modelHolds.length > 0) {
@@ -536,12 +542,16 @@ export async function providersWithoutCredentials(
536
542
  ): Promise<string[]> {
537
543
  const missing = new Set<string>();
538
544
  for (const model of allRouterModels(router)) {
539
- const provider = modelProvider(model);
540
- if (missing.has(provider)) continue;
541
545
  const sources = model.sources ?? SELF_HOSTED_DEFAULT_SOURCES;
542
546
  const plans = sources.includes("plan") ? modelSubscriptions(model.id) : [];
543
547
  if (plans.some((plan) => deps.subscriptions.list(plan).length > 0)) continue;
544
- if (await configuredProviderApiKey(deps, provider) === undefined) missing.add(provider);
548
+ // Any of its key providers serves it, so each is named when none can.
549
+ const providers = keyProviders(model);
550
+ let keyed = false;
551
+ for (const provider of providers) {
552
+ if (await configuredProviderApiKey(deps, provider) !== undefined) keyed = true;
553
+ }
554
+ if (!keyed) for (const provider of providers) missing.add(provider);
545
555
  }
546
556
  return [...missing];
547
557
  }