@mupt-ai/dari-gateway 1.0.365 → 1.0.367

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.
Files changed (52) hide show
  1. package/README.md +1 -1
  2. package/dist/activity/conversation_detail.js +8 -0
  3. package/dist/link/endpoints.js +5 -25
  4. package/dist/link/service.d.ts +1 -3
  5. package/dist/link/service.js +0 -1
  6. package/dist/models/canonical.d.ts +7 -1
  7. package/dist/models/canonical.js +9 -1
  8. package/dist/models/canonical_models.json +151 -0
  9. package/dist/models/provider_models.json +476 -0
  10. package/dist/platform/platform.d.ts +1 -11
  11. package/dist/protocol/input/anthropic_messages.js +3 -4
  12. package/dist/providers/execution.js +1 -0
  13. package/dist/providers/provider_call.d.ts +1 -0
  14. package/dist/providers/provider_call.js +1 -0
  15. package/dist/runtime/runtime_reporter.d.ts +1 -0
  16. package/dist/runtime/runtime_reporter.js +1 -0
  17. package/dist/self_host/config.d.ts +5 -0
  18. package/dist/self_host/config.js +8 -1
  19. package/dist/self_host/connected.d.ts +5 -4
  20. package/dist/self_host/hosted_sync.d.ts +14 -23
  21. package/dist/self_host/hosted_sync.js +56 -120
  22. package/dist/self_host/main.js +2 -5
  23. package/dist/self_host/platform.js +2 -0
  24. package/dist/self_host/resolve.js +24 -12
  25. package/dist/self_host/subscriptions/index.d.ts +1 -1
  26. package/dist/self_host/subscriptions/index.js +1 -1
  27. package/dist/self_host/subscriptions/store.d.ts +8 -6
  28. package/dist/self_host/subscriptions/store.js +8 -16
  29. package/dist/telemetry/report.js +8 -1
  30. package/dist/types.d.ts +1 -0
  31. package/package.json +2 -2
  32. package/src/activity/conversation_detail.ts +8 -0
  33. package/src/link/endpoints.ts +4 -29
  34. package/src/link/service.ts +0 -4
  35. package/src/models/canonical.ts +15 -1
  36. package/src/models/canonical_models.json +151 -0
  37. package/src/models/provider_models.json +476 -0
  38. package/src/platform/platform.ts +2 -9
  39. package/src/protocol/input/anthropic_messages.ts +3 -9
  40. package/src/providers/execution.ts +1 -0
  41. package/src/providers/provider_call.ts +3 -0
  42. package/src/runtime/runtime_reporter.ts +3 -1
  43. package/src/self_host/config.ts +9 -1
  44. package/src/self_host/connected.ts +5 -4
  45. package/src/self_host/hosted_sync.ts +51 -121
  46. package/src/self_host/main.ts +2 -5
  47. package/src/self_host/platform.ts +2 -1
  48. package/src/self_host/resolve.ts +19 -7
  49. package/src/self_host/subscriptions/index.ts +1 -0
  50. package/src/self_host/subscriptions/store.ts +14 -18
  51. package/src/telemetry/report.ts +8 -1
  52. package/src/types.ts +3 -0
@@ -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
  ]
@@ -255,12 +255,6 @@ export type LinkApprovalPage = {
255
255
  addKey(subject: string | null, provider: string, apiKey: string): Promise<LinkPlanAdded>;
256
256
  /** The plans this user connected and the API keys they added, which an approval chooses among. */
257
257
  subscriptions(subject: string): Promise<LinkSubscription[]>;
258
- /**
259
- * The user's plans that live on one of their computers rather than on the
260
- * platform, which apps cannot use; the page says where each is. Absent on
261
- * a platform where every plan is its own.
262
- */
263
- plansOnComputers?(subject: string): Promise<LinkPlanOnComputer[]>;
264
258
  /** Start the provider's sign-in for a plan of this kind. */
265
259
  startConnect(kind: SubscriptionKind): Promise<LinkConnect>;
266
260
  /**
@@ -313,11 +307,6 @@ export type LinkSignIn = {
313
307
  issuedAt: number;
314
308
  } | null>;
315
309
  };
316
- /** A plan kept on one of the user's computers: its kind and the computer's name. */
317
- export type LinkPlanOnComputer = {
318
- provider: SubscriptionKind;
319
- computer: string;
320
- };
321
310
  /** A plan or API key the user added, and who they are now. */
322
311
  export type LinkPlanAdded = {
323
312
  subject: string;
@@ -550,6 +539,7 @@ export type NextSubscriptionRequest = {
550
539
  };
551
540
  export type NextSubscription = {
552
541
  credentialId: string;
542
+ account?: string;
553
543
  apiKey: string;
554
544
  };
555
545
  export type SubscriptionUsageReport = {
@@ -352,12 +352,11 @@ function anthropicImage(value, param) {
352
352
  }
353
353
  function anthropicReasoningItem(block, type, param) {
354
354
  const encoded = requiredString(type === "thinking" ? block.signature : block.data, `${param}.${type === "thinking" ? "signature" : "data"}`);
355
+ // A conversation begun on Anthropic directly carries raw signatures. They
356
+ // name no provider or model, so they cannot be replayed; the turn keeps its
357
+ // readable thinking and the conversation continues.
355
358
  const continuation = decodeUntrustedProviderContinuationState(encoded);
356
359
  const portable = continuation ? null : decodeUntrustedPortableReasoningState(encoded);
357
- if (!continuation && !portable) {
358
- const field = type === "thinking" ? "signature" : "data";
359
- throw new HttpError(400, `${param}.${field} must be a Dari reasoning-state envelope; raw provider state has no recoverable provider/model provenance.`, "invalid_provider_continuation_state", `${param}.${field}`);
360
- }
361
360
  const thinking = type === "thinking" ? requiredStringAllowEmpty(block.thinking, `${param}.thinking`) : "";
362
361
  const reasoning = {
363
362
  type: "reasoning",
@@ -615,6 +615,7 @@ function onNextSubscription(choice, next) {
615
615
  apiKey: next.apiKey,
616
616
  auth: { type: "bearer", apiKey: next.apiKey },
617
617
  subscriptionCredentialId: next.credentialId,
618
+ subscriptionAccount: next.account,
618
619
  },
619
620
  };
620
621
  }
@@ -27,6 +27,7 @@ export type ProviderExecution = ProviderCallConfig & {
27
27
  providerKeySource: ProviderKeySource;
28
28
  subscriptionUserId?: string;
29
29
  subscriptionCredentialId?: string;
30
+ subscriptionAccount?: string;
30
31
  subscriptionLinkGrantId?: string;
31
32
  subscriptionSources?: Source[];
32
33
  subscriptionResetMinHours?: number;
@@ -62,6 +62,7 @@ export function prepareProviderExecution(args) {
62
62
  ...(args.credentials.link_grant_id ? { subscriptionLinkGrantId: args.credentials.link_grant_id } : {}),
63
63
  }
64
64
  : {}),
65
+ ...(providerKeySource === "subscription" && supplied?.account ? { subscriptionAccount: supplied.account } : {}),
65
66
  thinkingLevel,
66
67
  usageContext: usageContextFor({
67
68
  billable: args.billable,
@@ -8,6 +8,7 @@ export type ReportedProviderExecution = {
8
8
  providerKeySource: ProviderKeySource;
9
9
  thinkingLevel?: string;
10
10
  subscriptionCredentialId?: string;
11
+ subscriptionAccount?: string;
11
12
  };
12
13
  export declare function reportedExecution(execution: ReportedProviderExecution): ReportedProviderExecution;
13
14
  export type ReportableProviderOutcome = {
@@ -7,6 +7,7 @@ export function reportedExecution(execution) {
7
7
  ...(execution.subscriptionCredentialId === undefined
8
8
  ? {}
9
9
  : { subscriptionCredentialId: execution.subscriptionCredentialId }),
10
+ ...(execution.subscriptionAccount === undefined ? {} : { subscriptionAccount: execution.subscriptionAccount }),
10
11
  };
11
12
  }
12
13
  export function createExperimentRoutedRuntimeReporter() {
@@ -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+$/;
@@ -16,10 +16,11 @@ import { createSelfHostedPlatform } from "./platform.js";
16
16
  * Dari key (resolve.ts).
17
17
  * - Every other path the gateway does not manage itself, such as commit
18
18
  * reports, goes to hosted with the user's Dari key.
19
- * - The plans and the requests served here sync to hosted (hosted_sync.ts),
20
- * which shows them in Accounts and Activity. Private plans serve, but
21
- * neither they nor their requests sync; requests hosted Dari served are
22
- * hosted's to log. Dari Link and Activity are hosted's, not served here.
19
+ * - The requests served here sync to hosted Activity (hosted_sync.ts), each
20
+ * naming the plan that served it. The plans themselves never leave this
21
+ * computer. A private plan's requests do not sync either; requests hosted
22
+ * Dari served are hosted's to log. Dari Link and Activity are hosted's, not
23
+ * served here.
23
24
  */
24
25
  export type HostedConnection = {
25
26
  url: string;