@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
  ]
@@ -242,12 +242,6 @@ export type LinkApprovalPage = {
242
242
  addKey(subject: string | null, provider: string, apiKey: string): Promise<LinkPlanAdded>;
243
243
  /** The plans this user connected and the API keys they added, which an approval chooses among. */
244
244
  subscriptions(subject: string): Promise<LinkSubscription[]>;
245
- /**
246
- * The user's plans that live on one of their computers rather than on the
247
- * platform, which apps cannot use; the page says where each is. Absent on
248
- * a platform where every plan is its own.
249
- */
250
- plansOnComputers?(subject: string): Promise<LinkPlanOnComputer[]>;
251
245
  /** Start the provider's sign-in for a plan of this kind. */
252
246
  startConnect(kind: SubscriptionKind): Promise<LinkConnect>;
253
247
  /**
@@ -296,9 +290,6 @@ export type LinkSignIn = {
296
290
  redeem(ticket: string): Promise<{ subject: string; state: string; issuedAt: number } | null>;
297
291
  };
298
292
 
299
- /** A plan kept on one of the user's computers: its kind and the computer's name. */
300
- export type LinkPlanOnComputer = { provider: SubscriptionKind; computer: string };
301
-
302
293
  /** A plan or API key the user added, and who they are now. */
303
294
  export type LinkPlanAdded = { subject: string; credentialId: string };
304
295
 
@@ -592,6 +583,8 @@ export type NextSubscriptionRequest = {
592
583
 
593
584
  export type NextSubscription = {
594
585
  credentialId: string;
586
+ // The plan's name, as ProviderCredential.account.
587
+ account?: string;
595
588
  // The plan's access token, sent as the bearer credential.
596
589
  apiKey: string;
597
590
  };
@@ -384,17 +384,11 @@ function anthropicReasoningItem(
384
384
  type === "thinking" ? block.signature : block.data,
385
385
  `${param}.${type === "thinking" ? "signature" : "data"}`
386
386
  );
387
+ // A conversation begun on Anthropic directly carries raw signatures. They
388
+ // name no provider or model, so they cannot be replayed; the turn keeps its
389
+ // readable thinking and the conversation continues.
387
390
  const continuation = decodeUntrustedProviderContinuationState(encoded);
388
391
  const portable = continuation ? null : decodeUntrustedPortableReasoningState(encoded);
389
- if (!continuation && !portable) {
390
- const field = type === "thinking" ? "signature" : "data";
391
- throw new HttpError(
392
- 400,
393
- `${param}.${field} must be a Dari reasoning-state envelope; raw provider state has no recoverable provider/model provenance.`,
394
- "invalid_provider_continuation_state",
395
- `${param}.${field}`,
396
- );
397
- }
398
392
  const thinking = type === "thinking" ? requiredStringAllowEmpty(block.thinking, `${param}.thinking`) : "";
399
393
  const reasoning: Extract<InteractionItem, { type: "reasoning" }> = {
400
394
  type: "reasoning",
@@ -942,6 +942,7 @@ function onNextSubscription(choice: ProviderChoice, next: NextSubscription): Pro
942
942
  apiKey: next.apiKey,
943
943
  auth: { type: "bearer", apiKey: next.apiKey },
944
944
  subscriptionCredentialId: next.credentialId,
945
+ subscriptionAccount: next.account,
945
946
  },
946
947
  };
947
948
  }
@@ -79,6 +79,8 @@ export type ProviderExecution = ProviderCallConfig & {
79
79
  // subscriptions it is; undefined for router-owned keys.
80
80
  subscriptionUserId?: string;
81
81
  subscriptionCredentialId?: string;
82
+ // That plan's name, as ProviderCredential.account.
83
+ subscriptionAccount?: string;
82
84
  // The Dari Link grant whose subscriptions alone may serve this call.
83
85
  subscriptionLinkGrantId?: string;
84
86
  // The model's sources and the router's reset threshold, carried onto the
@@ -177,6 +179,7 @@ export function prepareProviderExecution(args: {
177
179
  ...(args.credentials.link_grant_id ? { subscriptionLinkGrantId: args.credentials.link_grant_id } : {}),
178
180
  }
179
181
  : {}),
182
+ ...(providerKeySource === "subscription" && supplied?.account ? { subscriptionAccount: supplied.account } : {}),
180
183
  thinkingLevel,
181
184
  usageContext: usageContextFor({
182
185
  billable: args.billable,
@@ -9,8 +9,9 @@ export type ReportedProviderExecution = {
9
9
  providerKeySource: ProviderKeySource;
10
10
  // The thinking the provider was sent, as X-Dari-Thinking-Level reports it.
11
11
  thinkingLevel?: string;
12
- // The user's subscription that served it.
12
+ // The user's subscription that served it, and its name.
13
13
  subscriptionCredentialId?: string;
14
+ subscriptionAccount?: string;
14
15
  };
15
16
 
16
17
  export function reportedExecution(
@@ -24,6 +25,7 @@ export function reportedExecution(
24
25
  ...(execution.subscriptionCredentialId === undefined
25
26
  ? {}
26
27
  : { subscriptionCredentialId: execution.subscriptionCredentialId }),
28
+ ...(execution.subscriptionAccount === undefined ? {} : { subscriptionAccount: execution.subscriptionAccount }),
27
29
  };
28
30
  }
29
31
 
@@ -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+$/;
@@ -26,10 +26,11 @@ import { gatewayKeyIndex, resolveSelfHostedRouter } from "./resolve.js";
26
26
  * Dari key (resolve.ts).
27
27
  * - Every other path the gateway does not manage itself, such as commit
28
28
  * reports, goes to hosted with the user's Dari key.
29
- * - The plans and the requests served here sync to hosted (hosted_sync.ts),
30
- * which shows them in Accounts and Activity. Private plans serve, but
31
- * neither they nor their requests sync; requests hosted Dari served are
32
- * hosted's to log. Dari Link and Activity are hosted's, not served here.
29
+ * - The requests served here sync to hosted Activity (hosted_sync.ts), each
30
+ * naming the plan that served it. The plans themselves never leave this
31
+ * computer. A private plan's requests do not sync either; requests hosted
32
+ * Dari served are hosted's to log. Dari Link and Activity are hosted's, not
33
+ * served here.
33
34
  */
34
35
  export type HostedConnection = {
35
36
  // The hosted routing service, e.g. https://routing.dari.dev.