@mupt-ai/dari-gateway 1.0.364 → 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
  ]
@@ -76,6 +76,11 @@ export type RouterModelConfig = {
76
76
  };
77
77
  /** The provider that serves a router's model, whose credential it needs. */
78
78
  export declare function modelProvider(model: RouterModelConfig): string;
79
+ /**
80
+ * The providers whose API key may serve a model, in order: the one its spec
81
+ * names, else those the catalog runs it on (see `modelKeyProviders`).
82
+ */
83
+ export declare function keyProviders(model: RouterModelConfig): string[];
79
84
  export declare const ROUTER_ID_PATTERN: RegExp;
80
85
  export declare const DEFAULT_GATEWAY_CONFIG: GatewayConfig;
81
86
  /**
@@ -1,12 +1,19 @@
1
1
  import { isReasoningEffort, isRecord, providerForModel, } from "@mupt-ai/dari-router/policy-engine";
2
2
  import { CLIENT_HARNESSES } from "../ingress/client_harness.js";
3
3
  import { checkSources, DEFAULT_RESET_MIN_HOURS } from "../models/sources.js";
4
- import { otherModelProviders, providerModel } from "../models/canonical.js";
4
+ import { modelKeyProviders, otherModelProviders, providerModel } from "../models/canonical.js";
5
5
  const REDIRECT_HOST_PATTERN = /^(\*\.)?[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/;
6
6
  /** The provider that serves a router's model, whose credential it needs. */
7
7
  export function modelProvider(model) {
8
8
  return model.provider ?? providerForModel(model.id);
9
9
  }
10
+ /**
11
+ * The providers whose API key may serve a model, in order: the one its spec
12
+ * names, else those the catalog runs it on (see `modelKeyProviders`).
13
+ */
14
+ export function keyProviders(model) {
15
+ return model.provider === undefined ? modelKeyProviders(model.id) : [model.provider];
16
+ }
10
17
  export const ROUTER_ID_PATTERN = /^[A-Za-z0-9_-]+$/;
11
18
  const PROVIDER_ID_PATTERN = /^[a-z0-9][a-z0-9.-]*$/;
12
19
  const MODEL_ID_PATTERN = /^[a-z0-9][a-z0-9.-]*\/\S+$/;
@@ -14,7 +14,7 @@ import { HostedSync, readHostedAccounts } from "./hosted_sync.js";
14
14
  import { createSelfHostedPlatform } from "./platform.js";
15
15
  import { checkProviderKey } from "../providers/key_check.js";
16
16
  import { CANONICAL_MODELS } from "../models/canonical.js";
17
- import { allRouterModels, loadGatewayConfig, modelProvider } from "./config.js";
17
+ import { allRouterModels, keyProviders, loadGatewayConfig } from "./config.js";
18
18
  import { configuredProviderApiKey, gatewayKeyIndex, providersWithoutCredentials, SELF_HOSTED_ORGANIZATION_ID, } from "./resolve.js";
19
19
  import { SqliteLinkStore } from "../link/sqlite_store.js";
20
20
  import { secretBoxFromEnv } from "./secret_box.js";
@@ -230,7 +230,7 @@ export async function startSelfHostedGateway(env = process.env) {
230
230
  * provider rejects fails startup, and one no check could answer is reported.
231
231
  */
232
232
  async function checkConfiguredProviderKeys(config, routers, providerApiKey) {
233
- const providers = new Set(routers.flatMap((router) => allRouterModels(router).map(modelProvider)));
233
+ const providers = new Set(routers.flatMap((router) => allRouterModels(router).flatMap(keyProviders)));
234
234
  const checks = await Promise.all([...providers].map(async (provider) => {
235
235
  const endpoint = config.providers[provider];
236
236
  // Endpoints configured without a key variable take no key.
@@ -10,7 +10,7 @@ import { gatewayFor } from "../models/gateways.js";
10
10
  import { candidatesFor, DEFAULT_RESET_MIN_HOURS, SELF_HOSTED_DEFAULT_SOURCES } from "../models/sources.js";
11
11
  import { linkNothingServed, plansExhausted, providersUnavailable } from "../link/errors.js";
12
12
  import { buildModel, pi, registeredModelPrice } from "../providers/pi.js";
13
- import { allRouterModels, modelProvider, routerModelsFor, } from "./config.js";
13
+ import { allRouterModels, keyProviders, modelProvider, routerModelsFor, } from "./config.js";
14
14
  import { linkSubscription } from "../link/self_hosted.js";
15
15
  import { linkTokenGrant } from "../link/service.js";
16
16
  import { servedRouter } from "./router_specs.js";
@@ -164,11 +164,16 @@ export async function resolveSelfHostedRouter(deps, request) {
164
164
  },
165
165
  });
166
166
  }
167
+ // The first provider with a key serves: the one the spec names, else any
168
+ // the catalog runs the model on. A grant's keys serve as grantModels set.
169
+ const keyed = grant === null ? keyProviders(model) : [base];
167
170
  let keyCandidate = async () => {
168
- const key = await apiKey(base);
169
- if (key === undefined)
170
- return null;
171
- return { provider: base, key };
171
+ for (const provider of keyed) {
172
+ const key = await apiKey(provider);
173
+ if (key !== undefined)
174
+ return { provider, key };
175
+ }
176
+ return null;
172
177
  };
173
178
  // A self-hosted gateway has no managed keys.
174
179
  let managedCandidate = async () => null;
@@ -191,7 +196,8 @@ export async function resolveSelfHostedRouter(deps, request) {
191
196
  if (candidates.length === 0) {
192
197
  for (const kind of heldKinds)
193
198
  exhausted.add(kind);
194
- unserved.add(base);
199
+ for (const provider of keyed)
200
+ unserved.add(provider);
195
201
  // A granted plan may serve another maker's model: name the plan's provider too.
196
202
  if (grant !== null)
197
203
  for (const kind of heldKinds)
@@ -452,15 +458,20 @@ const SUBSCRIPTION_PLAN_NAMES = {
452
458
  export async function providersWithoutCredentials(deps, router) {
453
459
  const missing = new Set();
454
460
  for (const model of allRouterModels(router)) {
455
- const provider = modelProvider(model);
456
- if (missing.has(provider))
457
- continue;
458
461
  const sources = model.sources ?? SELF_HOSTED_DEFAULT_SOURCES;
459
462
  const plans = sources.includes("plan") ? modelSubscriptions(model.id) : [];
460
463
  if (plans.some((plan) => deps.subscriptions.list(plan).length > 0))
461
464
  continue;
462
- if (await configuredProviderApiKey(deps, provider) === undefined)
463
- missing.add(provider);
465
+ // Any of its key providers serves it, so each is named when none can.
466
+ const providers = keyProviders(model);
467
+ let keyed = false;
468
+ for (const provider of providers) {
469
+ if (await configuredProviderApiKey(deps, provider) !== undefined)
470
+ keyed = true;
471
+ }
472
+ if (!keyed)
473
+ for (const provider of providers)
474
+ missing.add(provider);
464
475
  }
465
476
  return [...missing];
466
477
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mupt-ai/dari-gateway",
3
- "version": "1.0.364",
3
+ "version": "1.0.366",
4
4
  "description": "Self-hostable LLM gateway for coding agents and APIs: one endpoint for Anthropic Messages, OpenAI Chat Completions, and OpenAI Responses, with subscription pooling, failover, and prompt-cache-aware routing.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@aws-sdk/client-sts": "3.1063.0",
55
- "@mupt-ai/dari-router": "1.0.364",
55
+ "@mupt-ai/dari-router": "1.0.366",
56
56
  "@mupt-ai/pi-ai": "1.5.2-mupt.3"
57
57
  },
58
58
  "devDependencies": {
@@ -5,23 +5,15 @@ import { CANONICAL_MODELS } from "../models/canonical.js";
5
5
  import { LINK_KEY_GATEWAYS, gatewayFor } from "../models/gateways.js";
6
6
  import type { LinkKeyProvider } from "../platform/platform.js";
7
7
 
8
- const PROVIDER_NAMES: Record<string, string> = {
9
- anthropic: "Anthropic",
10
- openai: "OpenAI",
11
- meta: "Meta",
12
- moonshotai: "Moonshot AI",
13
- xai: "xAI",
14
- google: "Google",
15
- };
16
-
17
8
  /**
18
9
  * Whose API key a user can add on the approval page: each provider with
19
- * catalog models the gateway can call with a key, then the gateways.
10
+ * catalog models the gateway can call with a key, named for the models'
11
+ * maker, then the gateways.
20
12
  */
21
13
  export const LINK_KEY_PROVIDERS: readonly LinkKeyProvider[] = [
22
- ...[...new Set(CANONICAL_MODELS.map((model) => providerForModel(model.id)))]
23
- .filter((provider) => (getBuiltinProviders() as readonly string[]).includes(provider))
24
- .map((provider) => ({ id: provider, name: PROVIDER_NAMES[provider] ?? provider })),
14
+ ...[...new Map(CANONICAL_MODELS.map((model) => [providerForModel(model.id), model.maker]))]
15
+ .filter(([provider]) => (getBuiltinProviders() as readonly string[]).includes(provider))
16
+ .map(([provider, name]) => ({ id: provider, name })),
25
17
  ...LINK_KEY_GATEWAYS.map((gateway) => ({ id: gateway, name: gatewayFor(gateway)!.label })),
26
18
  ];
27
19