@mupt-ai/dari-gateway 1.0.290 → 1.0.291

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.
@@ -1,2 +1,2 @@
1
1
  import type { ResolvedRouter } from "../types.js";
2
- export declare function codexModelsResponse(router: Pick<ResolvedRouter, "enabled_models" | "model_configs" | "allow_long_context" | "autorouting_enabled">, imageInputFor: (model: string) => boolean): Record<string, unknown>;
2
+ export declare function codexModelsResponse(router: Pick<ResolvedRouter, "enabled_models" | "model_configs" | "allow_long_context" | "autorouting_enabled" | "routing_listed">, imageInputFor: (model: string) => boolean): Record<string, unknown>;
@@ -71,7 +71,7 @@ function codexCatalogEntry(args) {
71
71
  export function codexModelsResponse(router, imageInputFor) {
72
72
  return {
73
73
  models: [
74
- ...(router.autorouting_enabled === false ? [] : [codexCatalogEntry({
74
+ ...(router.autorouting_enabled === false || router.routing_listed === false ? [] : [codexCatalogEntry({
75
75
  slug: CANONICAL_ROUTER_MODEL,
76
76
  displayName: "Dari Routing",
77
77
  description: "Routes Codex HTTP Responses requests through the configured Dari model router.",
@@ -25,7 +25,8 @@ export async function handleModels(request, routerId) {
25
25
  const apiKey = anthropicClient ? anthropicToken(request.headers) : bearerToken(request.headers);
26
26
  // Resolution authenticates the key and confirms the router exists even
27
27
  // when the response body (Anthropic shape) does not depend on it.
28
- const router = await resolveRouter({ routerId, apiKey });
28
+ const clientHarness = listedClientHarness(request.headers);
29
+ const router = await resolveRouter({ routerId, apiKey, ...(clientHarness ? { clientHarness } : {}) });
29
30
  const query = new URL(request.url).searchParams;
30
31
  if (query.get("detail") === "1") {
31
32
  const providers = query.get("provider")?.split(",").map((id) => id.trim()).filter(Boolean);
@@ -63,3 +64,12 @@ export async function handleModels(request, routerId) {
63
64
  return response;
64
65
  }
65
66
  }
67
+ // The Dari CLI names the agent a model list is for, so subscriptions that
68
+ // serve only that agent (a Claude Code or Muse Code plan) count toward the
69
+ // list as they will for its requests. It changes only what is listed: each
70
+ // request is still recognized by its own headers.
71
+ const CLIENT_HARNESS_HEADER = "x-dari-client-harness";
72
+ function listedClientHarness(headers) {
73
+ const value = headers.get(CLIENT_HARNESS_HEADER)?.trim();
74
+ return value === "claude_code" || value === "muse_code" ? value : undefined;
75
+ }
@@ -5,5 +5,5 @@ import type { ResolvedRouter } from "../types.js";
5
5
  * models lets Muse Code pick from them and start on the first; `dari/routing`
6
6
  * leads it only on the Autorouting plan.
7
7
  */
8
- export declare function museCodeModelsResponse(router: Pick<ResolvedRouter, "enabled_models" | "autorouting_enabled">): Record<string, unknown>;
8
+ export declare function museCodeModelsResponse(router: Pick<ResolvedRouter, "enabled_models" | "autorouting_enabled" | "routing_listed">): Record<string, unknown>;
9
9
  export declare function handleMuseCodeModels(request: Request, routerId: string): Promise<Response>;
@@ -9,7 +9,7 @@ import { resolveRouter } from "../strategies/routing.js";
9
9
  */
10
10
  export function museCodeModelsResponse(router) {
11
11
  const ids = [
12
- ...(router.autorouting_enabled === false ? [] : ["dari/routing"]),
12
+ ...(router.autorouting_enabled === false || router.routing_listed === false ? [] : ["dari/routing"]),
13
13
  ...router.enabled_models.map((model) => `dari/model/${model}`),
14
14
  ];
15
15
  return {
@@ -1,2 +1,7 @@
1
- /** The canonical model ids Dari serves, from the monorepo's router catalog. */
2
- export declare const CANONICAL_MODEL_IDS: readonly string[];
1
+ export type CanonicalModel = {
2
+ id: string;
3
+ name: string;
4
+ thinking_levels: string[];
5
+ };
6
+ /** The canonical models Dari serves, from the monorepo's router catalog. */
7
+ export declare const CANONICAL_MODELS: readonly CanonicalModel[];
@@ -1,3 +1,3 @@
1
- import canonicalIds from "./canonical_model_ids.json" with { type: "json" };
2
- /** The canonical model ids Dari serves, from the monorepo's router catalog. */
3
- export const CANONICAL_MODEL_IDS = canonicalIds;
1
+ import canonicalModels from "./canonical_models.json" with { type: "json" };
2
+ /** The canonical models Dari serves, from the monorepo's router catalog. */
3
+ export const CANONICAL_MODELS = canonicalModels;
@@ -0,0 +1,337 @@
1
+ [
2
+ {
3
+ "id": "openai/gpt-6-astra",
4
+ "name": "GPT-6 Astra",
5
+ "thinking_levels": [
6
+ "low",
7
+ "medium",
8
+ "high",
9
+ "xhigh",
10
+ "max"
11
+ ]
12
+ },
13
+ {
14
+ "id": "openai/gpt-6.1-terra",
15
+ "name": "GPT-6.1 Terra",
16
+ "thinking_levels": [
17
+ "off",
18
+ "low",
19
+ "medium",
20
+ "high",
21
+ "xhigh",
22
+ "max"
23
+ ]
24
+ },
25
+ {
26
+ "id": "openai/gpt-6.1-sol",
27
+ "name": "GPT-6.1 Sol",
28
+ "thinking_levels": [
29
+ "off",
30
+ "low",
31
+ "medium",
32
+ "high",
33
+ "xhigh",
34
+ "max"
35
+ ]
36
+ },
37
+ {
38
+ "id": "openai/gpt-6-sol",
39
+ "name": "GPT-6 Sol",
40
+ "thinking_levels": [
41
+ "off",
42
+ "low",
43
+ "medium",
44
+ "high",
45
+ "xhigh",
46
+ "max"
47
+ ]
48
+ },
49
+ {
50
+ "id": "openai/gpt-6-luna",
51
+ "name": "GPT-6 Luna",
52
+ "thinking_levels": [
53
+ "off",
54
+ "low",
55
+ "medium",
56
+ "high",
57
+ "xhigh",
58
+ "max"
59
+ ]
60
+ },
61
+ {
62
+ "id": "openai/gpt-5.6-sol",
63
+ "name": "GPT-5.6 Sol",
64
+ "thinking_levels": [
65
+ "off",
66
+ "low",
67
+ "medium",
68
+ "high",
69
+ "xhigh",
70
+ "max"
71
+ ]
72
+ },
73
+ {
74
+ "id": "openai/gpt-5.6-terra",
75
+ "name": "GPT-5.6 Terra",
76
+ "thinking_levels": [
77
+ "off",
78
+ "low",
79
+ "medium",
80
+ "high",
81
+ "xhigh",
82
+ "max"
83
+ ]
84
+ },
85
+ {
86
+ "id": "openai/gpt-5.6-luna",
87
+ "name": "GPT-5.6 Luna",
88
+ "thinking_levels": [
89
+ "off",
90
+ "low",
91
+ "medium",
92
+ "high",
93
+ "xhigh",
94
+ "max"
95
+ ]
96
+ },
97
+ {
98
+ "id": "anthropic/claude-opus-5-5",
99
+ "name": "Claude Opus 5.5",
100
+ "thinking_levels": [
101
+ "off",
102
+ "low",
103
+ "medium",
104
+ "high",
105
+ "xhigh",
106
+ "max"
107
+ ]
108
+ },
109
+ {
110
+ "id": "anthropic/claude-opus-5",
111
+ "name": "Claude Opus 5",
112
+ "thinking_levels": [
113
+ "off",
114
+ "low",
115
+ "medium",
116
+ "high",
117
+ "xhigh",
118
+ "max"
119
+ ]
120
+ },
121
+ {
122
+ "id": "anthropic/claude-sonnet-5-5",
123
+ "name": "Claude Sonnet 5.5",
124
+ "thinking_levels": [
125
+ "low",
126
+ "medium",
127
+ "high",
128
+ "xhigh",
129
+ "max"
130
+ ]
131
+ },
132
+ {
133
+ "id": "anthropic/claude-sonnet-5",
134
+ "name": "Claude Sonnet 5",
135
+ "thinking_levels": [
136
+ "off",
137
+ "low",
138
+ "medium",
139
+ "high",
140
+ "xhigh",
141
+ "max"
142
+ ]
143
+ },
144
+ {
145
+ "id": "anthropic/claude-fable-5-2",
146
+ "name": "Claude Fable 5.2",
147
+ "thinking_levels": [
148
+ "low",
149
+ "medium",
150
+ "high",
151
+ "xhigh",
152
+ "max"
153
+ ]
154
+ },
155
+ {
156
+ "id": "anthropic/claude-fable-5-1",
157
+ "name": "Claude Fable 5.1",
158
+ "thinking_levels": [
159
+ "low",
160
+ "medium",
161
+ "high",
162
+ "xhigh",
163
+ "max"
164
+ ]
165
+ },
166
+ {
167
+ "id": "anthropic/claude-fable-5",
168
+ "name": "Claude Fable 5",
169
+ "thinking_levels": [
170
+ "low",
171
+ "medium",
172
+ "high",
173
+ "xhigh",
174
+ "max"
175
+ ]
176
+ },
177
+ {
178
+ "id": "anthropic/claude-haiku-5-5",
179
+ "name": "Claude Haiku 5.5",
180
+ "thinking_levels": [
181
+ "low",
182
+ "medium",
183
+ "high",
184
+ "xhigh",
185
+ "max"
186
+ ]
187
+ },
188
+ {
189
+ "id": "anthropic/claude-haiku-4-5",
190
+ "name": "Claude Haiku 4.5",
191
+ "thinking_levels": [
192
+ "off",
193
+ "low",
194
+ "medium",
195
+ "high"
196
+ ]
197
+ },
198
+ {
199
+ "id": "meta/muse-wonder-1.0",
200
+ "name": "Muse Wonder 1.0",
201
+ "thinking_levels": [
202
+ "minimal",
203
+ "low",
204
+ "medium",
205
+ "high",
206
+ "xhigh",
207
+ "max"
208
+ ]
209
+ },
210
+ {
211
+ "id": "meta/muse-spark-1.3",
212
+ "name": "Muse Spark 1.3",
213
+ "thinking_levels": [
214
+ "minimal",
215
+ "low",
216
+ "medium",
217
+ "high",
218
+ "xhigh",
219
+ "max"
220
+ ]
221
+ },
222
+ {
223
+ "id": "meta/muse-ember",
224
+ "name": "Muse Ember",
225
+ "thinking_levels": [
226
+ "minimal",
227
+ "low",
228
+ "medium",
229
+ "high",
230
+ "xhigh",
231
+ "max"
232
+ ]
233
+ },
234
+ {
235
+ "id": "meta/muse-spark-1.2",
236
+ "name": "Muse Spark 1.2",
237
+ "thinking_levels": [
238
+ "minimal",
239
+ "low",
240
+ "medium",
241
+ "high",
242
+ "xhigh"
243
+ ]
244
+ },
245
+ {
246
+ "id": "moonshotai/Kimi-K3",
247
+ "name": "Kimi K3",
248
+ "thinking_levels": [
249
+ "low",
250
+ "high",
251
+ "max"
252
+ ]
253
+ },
254
+ {
255
+ "id": "zai-org/GLM-5.3",
256
+ "name": "GLM 5.3",
257
+ "thinking_levels": [
258
+ "low",
259
+ "high",
260
+ "max"
261
+ ]
262
+ },
263
+ {
264
+ "id": "zai-org/GLM-5.3-Flash",
265
+ "name": "GLM 5.3 Flash",
266
+ "thinking_levels": [
267
+ "low",
268
+ "high",
269
+ "max"
270
+ ]
271
+ },
272
+ {
273
+ "id": "deepseek-ai/DeepSeek-V4-Pro-0813",
274
+ "name": "DeepSeek V4 Pro 0813",
275
+ "thinking_levels": [
276
+ "off",
277
+ "high",
278
+ "max"
279
+ ]
280
+ },
281
+ {
282
+ "id": "zai-org/GLM-5.2",
283
+ "name": "GLM 5.2",
284
+ "thinking_levels": [
285
+ "off",
286
+ "high",
287
+ "max"
288
+ ]
289
+ },
290
+ {
291
+ "id": "deepseek-ai/DeepSeek-V4-Flash-0731",
292
+ "name": "DeepSeek V4 Flash 0731",
293
+ "thinking_levels": [
294
+ "off",
295
+ "high",
296
+ "max"
297
+ ]
298
+ },
299
+ {
300
+ "id": "deepseek-ai/DeepSeek-V4.1-Flash-1017",
301
+ "name": "DeepSeek V4.1 Flash 1017",
302
+ "thinking_levels": [
303
+ "off",
304
+ "high",
305
+ "max"
306
+ ]
307
+ },
308
+ {
309
+ "id": "deepseek-ai/DeepSeek-V4.1-Flash",
310
+ "name": "DeepSeek V4.1 Flash",
311
+ "thinking_levels": [
312
+ "off",
313
+ "high",
314
+ "max"
315
+ ]
316
+ },
317
+ {
318
+ "id": "xai/grok-4.6",
319
+ "name": "Grok 4.6",
320
+ "thinking_levels": [
321
+ "low",
322
+ "medium",
323
+ "high",
324
+ "xhigh"
325
+ ]
326
+ },
327
+ {
328
+ "id": "xai/grok-4.7",
329
+ "name": "Grok 4.7",
330
+ "thinking_levels": [
331
+ "low",
332
+ "medium",
333
+ "high",
334
+ "xhigh"
335
+ ]
336
+ }
337
+ ]
@@ -11,7 +11,7 @@ import { createPrioritySelectorBackend } from "../strategies/priority_selector.j
11
11
  import { createSelfHostedPlatform } from "./platform.js";
12
12
  import { providerForModel } from "@mupt-ai/dari-router/policy-engine";
13
13
  import { checkProviderKey } from "../providers/key_check.js";
14
- import { CANONICAL_MODEL_IDS } from "../models/canonical.js";
14
+ import { CANONICAL_MODELS } from "../models/canonical.js";
15
15
  import { DEFAULT_GATEWAY_CONFIG, loadGatewayConfig } from "./config.js";
16
16
  import { configuredProviderApiKey, gatewayKeyIndex, providersWithoutCredentials } from "./resolve.js";
17
17
  import { PrefixStore } from "./prefix_store.js";
@@ -55,6 +55,7 @@ export async function startSelfHostedGateway(env = process.env) {
55
55
  authContext: { env: async (name) => env[name], fileExists: async () => false },
56
56
  });
57
57
  const providerApiKey = async (provider) => (await piModels.getAuth(provider))?.auth.apiKey;
58
+ const autoRoutingKey = env.DARI_AUTO_ROUTING_API_KEY?.trim();
58
59
  const platform = createSelfHostedPlatform({
59
60
  config,
60
61
  gatewayKeys,
@@ -62,6 +63,7 @@ export async function startSelfHostedGateway(env = process.env) {
62
63
  prefixes,
63
64
  sessionPins,
64
65
  providerApiKey,
66
+ autoRouting: Boolean(autoRoutingKey),
65
67
  env,
66
68
  fetch,
67
69
  });
@@ -74,7 +76,6 @@ export async function startSelfHostedGateway(env = process.env) {
74
76
  }
75
77
  }
76
78
  await checkConfiguredProviderKeys(config, (provider) => configuredProviderApiKey({ config, providerApiKey, env }, provider));
77
- const autoRoutingKey = env.DARI_AUTO_ROUTING_API_KEY?.trim();
78
79
  const selectorBackend = autoRoutingKey
79
80
  ? createAutoRoutingSelectorBackend({
80
81
  apiKey: autoRoutingKey,
@@ -142,7 +143,7 @@ export async function runSelfHostedGateway() {
142
143
  // JSON, and exits; `--print-default-config` prints the built-in default.
143
144
  // The Dari CLI edits a local gateway's models from them.
144
145
  if (process.argv.includes("--print-canonical-models")) {
145
- console.log(JSON.stringify(CANONICAL_MODEL_IDS));
146
+ console.log(JSON.stringify(CANONICAL_MODELS));
146
147
  return;
147
148
  }
148
149
  if (process.argv.includes("--print-default-config")) {
@@ -15,6 +15,7 @@ export type SelfHostedResolverDeps = {
15
15
  conversationId?: string;
16
16
  }) => RouterPrefixHit[];
17
17
  providerApiKey: (provider: string) => Promise<string | undefined>;
18
+ autoRouting: boolean;
18
19
  env: Record<string, string | undefined>;
19
20
  fetch: OAuthFetch;
20
21
  };
@@ -58,6 +58,7 @@ export async function resolveSelfHostedRouter(deps, request) {
58
58
  api_key_id: `gateway_key_${keyIndex + 1}`,
59
59
  attributed_user_id: SELF_HOSTED_USER_ID,
60
60
  enabled_models: models.map((model) => model.id),
61
+ routing_listed: deps.autoRouting,
61
62
  provider_keys: {},
62
63
  provider_key_sources: {},
63
64
  subscription_credential_ids: {},
package/dist/types.d.ts CHANGED
@@ -96,4 +96,5 @@ export type ResolvedRouter = {
96
96
  model_configs?: Record<string, ResolvedRouterModelConfig>;
97
97
  credit_exhausted?: boolean;
98
98
  autorouting_enabled?: boolean;
99
+ routing_listed?: boolean;
99
100
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mupt-ai/dari-gateway",
3
- "version": "1.0.290",
3
+ "version": "1.0.291",
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": {
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@aws-sdk/client-sts": "3.1063.0",
54
- "@mupt-ai/dari-router": "1.0.290",
54
+ "@mupt-ai/dari-router": "1.0.291",
55
55
  "@mupt-ai/pi-ai": "1.4.0-mupt.3"
56
56
  },
57
57
  "devDependencies": {
@@ -90,12 +90,12 @@ function codexCatalogEntry(args: CodexCatalogEntry): Record<string, unknown> {
90
90
  Codex's /model menu can switch to it. The `dari` launchers build every
91
91
  agent's model menu from this list. */
92
92
  export function codexModelsResponse(
93
- router: Pick<ResolvedRouter, "enabled_models" | "model_configs" | "allow_long_context" | "autorouting_enabled">,
93
+ router: Pick<ResolvedRouter, "enabled_models" | "model_configs" | "allow_long_context" | "autorouting_enabled" | "routing_listed">,
94
94
  imageInputFor: (model: string) => boolean
95
95
  ): Record<string, unknown> {
96
96
  return {
97
97
  models: [
98
- ...(router.autorouting_enabled === false ? [] : [codexCatalogEntry({
98
+ ...(router.autorouting_enabled === false || router.routing_listed === false ? [] : [codexCatalogEntry({
99
99
  slug: CANONICAL_ROUTER_MODEL,
100
100
  displayName: "Dari Routing",
101
101
  description: "Routes Codex HTTP Responses requests through the configured Dari model router.",
@@ -14,6 +14,7 @@ import { listModelCatalog } from "../models/catalog.js";
14
14
  import { modelSupportsImageInput } from "../providers/model_capabilities.js";
15
15
  import { modelMetadataLookup } from "../providers/pi.js";
16
16
  import { resolveRouter } from "../strategies/routing.js";
17
+ import type { ClientHarness } from "../types.js";
17
18
  import { anthropicModelsResponse } from "./anthropic_models.js";
18
19
  import { codexModelsResponse } from "./codex_models.js";
19
20
 
@@ -28,7 +29,8 @@ export async function handleModels(request: Request, routerId: string): Promise<
28
29
  const apiKey = anthropicClient ? anthropicToken(request.headers) : bearerToken(request.headers);
29
30
  // Resolution authenticates the key and confirms the router exists even
30
31
  // when the response body (Anthropic shape) does not depend on it.
31
- const router = await resolveRouter({ routerId, apiKey });
32
+ const clientHarness = listedClientHarness(request.headers);
33
+ const router = await resolveRouter({ routerId, apiKey, ...(clientHarness ? { clientHarness } : {}) });
32
34
  const query = new URL(request.url).searchParams;
33
35
  if (query.get("detail") === "1") {
34
36
  const providers = query.get("provider")?.split(",").map((id) => id.trim()).filter(Boolean);
@@ -65,3 +67,14 @@ export async function handleModels(request: Request, routerId: string): Promise<
65
67
  return response;
66
68
  }
67
69
  }
70
+
71
+ // The Dari CLI names the agent a model list is for, so subscriptions that
72
+ // serve only that agent (a Claude Code or Muse Code plan) count toward the
73
+ // list as they will for its requests. It changes only what is listed: each
74
+ // request is still recognized by its own headers.
75
+ const CLIENT_HARNESS_HEADER = "x-dari-client-harness";
76
+
77
+ function listedClientHarness(headers: Headers): ClientHarness | undefined {
78
+ const value = headers.get(CLIENT_HARNESS_HEADER)?.trim();
79
+ return value === "claude_code" || value === "muse_code" ? value : undefined;
80
+ }
@@ -10,10 +10,10 @@ import type { ResolvedRouter } from "../types.js";
10
10
  * leads it only on the Autorouting plan.
11
11
  */
12
12
  export function museCodeModelsResponse(
13
- router: Pick<ResolvedRouter, "enabled_models" | "autorouting_enabled">,
13
+ router: Pick<ResolvedRouter, "enabled_models" | "autorouting_enabled" | "routing_listed">,
14
14
  ): Record<string, unknown> {
15
15
  const ids = [
16
- ...(router.autorouting_enabled === false ? [] : ["dari/routing"]),
16
+ ...(router.autorouting_enabled === false || router.routing_listed === false ? [] : ["dari/routing"]),
17
17
  ...router.enabled_models.map((model) => `dari/model/${model}`),
18
18
  ];
19
19
  return {
@@ -1,4 +1,11 @@
1
- import canonicalIds from "./canonical_model_ids.json" with { type: "json" };
1
+ import canonicalModels from "./canonical_models.json" with { type: "json" };
2
2
 
3
- /** The canonical model ids Dari serves, from the monorepo's router catalog. */
4
- export const CANONICAL_MODEL_IDS: readonly string[] = canonicalIds;
3
+ export type CanonicalModel = {
4
+ id: string;
5
+ name: string;
6
+ // The default provider's accepted thinking levels.
7
+ thinking_levels: string[];
8
+ };
9
+
10
+ /** The canonical models Dari serves, from the monorepo's router catalog. */
11
+ export const CANONICAL_MODELS: readonly CanonicalModel[] = canonicalModels;
@@ -0,0 +1,337 @@
1
+ [
2
+ {
3
+ "id": "openai/gpt-6-astra",
4
+ "name": "GPT-6 Astra",
5
+ "thinking_levels": [
6
+ "low",
7
+ "medium",
8
+ "high",
9
+ "xhigh",
10
+ "max"
11
+ ]
12
+ },
13
+ {
14
+ "id": "openai/gpt-6.1-terra",
15
+ "name": "GPT-6.1 Terra",
16
+ "thinking_levels": [
17
+ "off",
18
+ "low",
19
+ "medium",
20
+ "high",
21
+ "xhigh",
22
+ "max"
23
+ ]
24
+ },
25
+ {
26
+ "id": "openai/gpt-6.1-sol",
27
+ "name": "GPT-6.1 Sol",
28
+ "thinking_levels": [
29
+ "off",
30
+ "low",
31
+ "medium",
32
+ "high",
33
+ "xhigh",
34
+ "max"
35
+ ]
36
+ },
37
+ {
38
+ "id": "openai/gpt-6-sol",
39
+ "name": "GPT-6 Sol",
40
+ "thinking_levels": [
41
+ "off",
42
+ "low",
43
+ "medium",
44
+ "high",
45
+ "xhigh",
46
+ "max"
47
+ ]
48
+ },
49
+ {
50
+ "id": "openai/gpt-6-luna",
51
+ "name": "GPT-6 Luna",
52
+ "thinking_levels": [
53
+ "off",
54
+ "low",
55
+ "medium",
56
+ "high",
57
+ "xhigh",
58
+ "max"
59
+ ]
60
+ },
61
+ {
62
+ "id": "openai/gpt-5.6-sol",
63
+ "name": "GPT-5.6 Sol",
64
+ "thinking_levels": [
65
+ "off",
66
+ "low",
67
+ "medium",
68
+ "high",
69
+ "xhigh",
70
+ "max"
71
+ ]
72
+ },
73
+ {
74
+ "id": "openai/gpt-5.6-terra",
75
+ "name": "GPT-5.6 Terra",
76
+ "thinking_levels": [
77
+ "off",
78
+ "low",
79
+ "medium",
80
+ "high",
81
+ "xhigh",
82
+ "max"
83
+ ]
84
+ },
85
+ {
86
+ "id": "openai/gpt-5.6-luna",
87
+ "name": "GPT-5.6 Luna",
88
+ "thinking_levels": [
89
+ "off",
90
+ "low",
91
+ "medium",
92
+ "high",
93
+ "xhigh",
94
+ "max"
95
+ ]
96
+ },
97
+ {
98
+ "id": "anthropic/claude-opus-5-5",
99
+ "name": "Claude Opus 5.5",
100
+ "thinking_levels": [
101
+ "off",
102
+ "low",
103
+ "medium",
104
+ "high",
105
+ "xhigh",
106
+ "max"
107
+ ]
108
+ },
109
+ {
110
+ "id": "anthropic/claude-opus-5",
111
+ "name": "Claude Opus 5",
112
+ "thinking_levels": [
113
+ "off",
114
+ "low",
115
+ "medium",
116
+ "high",
117
+ "xhigh",
118
+ "max"
119
+ ]
120
+ },
121
+ {
122
+ "id": "anthropic/claude-sonnet-5-5",
123
+ "name": "Claude Sonnet 5.5",
124
+ "thinking_levels": [
125
+ "low",
126
+ "medium",
127
+ "high",
128
+ "xhigh",
129
+ "max"
130
+ ]
131
+ },
132
+ {
133
+ "id": "anthropic/claude-sonnet-5",
134
+ "name": "Claude Sonnet 5",
135
+ "thinking_levels": [
136
+ "off",
137
+ "low",
138
+ "medium",
139
+ "high",
140
+ "xhigh",
141
+ "max"
142
+ ]
143
+ },
144
+ {
145
+ "id": "anthropic/claude-fable-5-2",
146
+ "name": "Claude Fable 5.2",
147
+ "thinking_levels": [
148
+ "low",
149
+ "medium",
150
+ "high",
151
+ "xhigh",
152
+ "max"
153
+ ]
154
+ },
155
+ {
156
+ "id": "anthropic/claude-fable-5-1",
157
+ "name": "Claude Fable 5.1",
158
+ "thinking_levels": [
159
+ "low",
160
+ "medium",
161
+ "high",
162
+ "xhigh",
163
+ "max"
164
+ ]
165
+ },
166
+ {
167
+ "id": "anthropic/claude-fable-5",
168
+ "name": "Claude Fable 5",
169
+ "thinking_levels": [
170
+ "low",
171
+ "medium",
172
+ "high",
173
+ "xhigh",
174
+ "max"
175
+ ]
176
+ },
177
+ {
178
+ "id": "anthropic/claude-haiku-5-5",
179
+ "name": "Claude Haiku 5.5",
180
+ "thinking_levels": [
181
+ "low",
182
+ "medium",
183
+ "high",
184
+ "xhigh",
185
+ "max"
186
+ ]
187
+ },
188
+ {
189
+ "id": "anthropic/claude-haiku-4-5",
190
+ "name": "Claude Haiku 4.5",
191
+ "thinking_levels": [
192
+ "off",
193
+ "low",
194
+ "medium",
195
+ "high"
196
+ ]
197
+ },
198
+ {
199
+ "id": "meta/muse-wonder-1.0",
200
+ "name": "Muse Wonder 1.0",
201
+ "thinking_levels": [
202
+ "minimal",
203
+ "low",
204
+ "medium",
205
+ "high",
206
+ "xhigh",
207
+ "max"
208
+ ]
209
+ },
210
+ {
211
+ "id": "meta/muse-spark-1.3",
212
+ "name": "Muse Spark 1.3",
213
+ "thinking_levels": [
214
+ "minimal",
215
+ "low",
216
+ "medium",
217
+ "high",
218
+ "xhigh",
219
+ "max"
220
+ ]
221
+ },
222
+ {
223
+ "id": "meta/muse-ember",
224
+ "name": "Muse Ember",
225
+ "thinking_levels": [
226
+ "minimal",
227
+ "low",
228
+ "medium",
229
+ "high",
230
+ "xhigh",
231
+ "max"
232
+ ]
233
+ },
234
+ {
235
+ "id": "meta/muse-spark-1.2",
236
+ "name": "Muse Spark 1.2",
237
+ "thinking_levels": [
238
+ "minimal",
239
+ "low",
240
+ "medium",
241
+ "high",
242
+ "xhigh"
243
+ ]
244
+ },
245
+ {
246
+ "id": "moonshotai/Kimi-K3",
247
+ "name": "Kimi K3",
248
+ "thinking_levels": [
249
+ "low",
250
+ "high",
251
+ "max"
252
+ ]
253
+ },
254
+ {
255
+ "id": "zai-org/GLM-5.3",
256
+ "name": "GLM 5.3",
257
+ "thinking_levels": [
258
+ "low",
259
+ "high",
260
+ "max"
261
+ ]
262
+ },
263
+ {
264
+ "id": "zai-org/GLM-5.3-Flash",
265
+ "name": "GLM 5.3 Flash",
266
+ "thinking_levels": [
267
+ "low",
268
+ "high",
269
+ "max"
270
+ ]
271
+ },
272
+ {
273
+ "id": "deepseek-ai/DeepSeek-V4-Pro-0813",
274
+ "name": "DeepSeek V4 Pro 0813",
275
+ "thinking_levels": [
276
+ "off",
277
+ "high",
278
+ "max"
279
+ ]
280
+ },
281
+ {
282
+ "id": "zai-org/GLM-5.2",
283
+ "name": "GLM 5.2",
284
+ "thinking_levels": [
285
+ "off",
286
+ "high",
287
+ "max"
288
+ ]
289
+ },
290
+ {
291
+ "id": "deepseek-ai/DeepSeek-V4-Flash-0731",
292
+ "name": "DeepSeek V4 Flash 0731",
293
+ "thinking_levels": [
294
+ "off",
295
+ "high",
296
+ "max"
297
+ ]
298
+ },
299
+ {
300
+ "id": "deepseek-ai/DeepSeek-V4.1-Flash-1017",
301
+ "name": "DeepSeek V4.1 Flash 1017",
302
+ "thinking_levels": [
303
+ "off",
304
+ "high",
305
+ "max"
306
+ ]
307
+ },
308
+ {
309
+ "id": "deepseek-ai/DeepSeek-V4.1-Flash",
310
+ "name": "DeepSeek V4.1 Flash",
311
+ "thinking_levels": [
312
+ "off",
313
+ "high",
314
+ "max"
315
+ ]
316
+ },
317
+ {
318
+ "id": "xai/grok-4.6",
319
+ "name": "Grok 4.6",
320
+ "thinking_levels": [
321
+ "low",
322
+ "medium",
323
+ "high",
324
+ "xhigh"
325
+ ]
326
+ },
327
+ {
328
+ "id": "xai/grok-4.7",
329
+ "name": "Grok 4.7",
330
+ "thinking_levels": [
331
+ "low",
332
+ "medium",
333
+ "high",
334
+ "xhigh"
335
+ ]
336
+ }
337
+ ]
@@ -13,7 +13,7 @@ import type { SelectorBackend } from "../strategies/routing.js";
13
13
  import { createSelfHostedPlatform } from "./platform.js";
14
14
  import { providerForModel } from "@mupt-ai/dari-router/policy-engine";
15
15
  import { checkProviderKey } from "../providers/key_check.js";
16
- import { CANONICAL_MODEL_IDS } from "../models/canonical.js";
16
+ import { CANONICAL_MODELS } from "../models/canonical.js";
17
17
  import { DEFAULT_GATEWAY_CONFIG, loadGatewayConfig, type GatewayConfig } from "./config.js";
18
18
  import { configuredProviderApiKey, gatewayKeyIndex, providersWithoutCredentials } from "./resolve.js";
19
19
  import { PrefixStore } from "./prefix_store.js";
@@ -59,6 +59,7 @@ export async function startSelfHostedGateway(env: Record<string, string> = proce
59
59
  });
60
60
 
61
61
  const providerApiKey = async (provider: string) => (await piModels.getAuth(provider))?.auth.apiKey;
62
+ const autoRoutingKey = env.DARI_AUTO_ROUTING_API_KEY?.trim();
62
63
  const platform = createSelfHostedPlatform({
63
64
  config,
64
65
  gatewayKeys,
@@ -66,6 +67,7 @@ export async function startSelfHostedGateway(env: Record<string, string> = proce
66
67
  prefixes,
67
68
  sessionPins,
68
69
  providerApiKey,
70
+ autoRouting: Boolean(autoRoutingKey),
69
71
  env,
70
72
  fetch,
71
73
  });
@@ -82,7 +84,6 @@ export async function startSelfHostedGateway(env: Record<string, string> = proce
82
84
  }
83
85
  await checkConfiguredProviderKeys(config, (provider) =>
84
86
  configuredProviderApiKey({ config, providerApiKey, env }, provider));
85
- const autoRoutingKey = env.DARI_AUTO_ROUTING_API_KEY?.trim();
86
87
  const selectorBackend: SelectorBackend = autoRoutingKey
87
88
  ? createAutoRoutingSelectorBackend({
88
89
  apiKey: autoRoutingKey,
@@ -161,7 +162,7 @@ export async function runSelfHostedGateway(): Promise<void> {
161
162
  // JSON, and exits; `--print-default-config` prints the built-in default.
162
163
  // The Dari CLI edits a local gateway's models from them.
163
164
  if (process.argv.includes("--print-canonical-models")) {
164
- console.log(JSON.stringify(CANONICAL_MODEL_IDS));
165
+ console.log(JSON.stringify(CANONICAL_MODELS));
165
166
  return;
166
167
  }
167
168
  if (process.argv.includes("--print-default-config")) {
@@ -36,6 +36,9 @@ export type SelfHostedResolverDeps = {
36
36
  }) => RouterPrefixHit[];
37
37
  // The provider's API key from its standard environment variable.
38
38
  providerApiKey: (provider: string) => Promise<string | undefined>;
39
+ // Dari Auto Routing chooses among models. Without it `dari/routing` serves
40
+ // the first available model, so model lists leave it out.
41
+ autoRouting: boolean;
39
42
  env: Record<string, string | undefined>;
40
43
  fetch: OAuthFetch;
41
44
  };
@@ -102,6 +105,7 @@ export async function resolveSelfHostedRouter(
102
105
  api_key_id: `gateway_key_${keyIndex + 1}`,
103
106
  attributed_user_id: SELF_HOSTED_USER_ID,
104
107
  enabled_models: models.map((model) => model.id),
108
+ routing_listed: deps.autoRouting,
105
109
  provider_keys: {},
106
110
  provider_key_sources: {},
107
111
  subscription_credential_ids: {},
package/src/types.ts CHANGED
@@ -170,4 +170,8 @@ export type ResolvedRouter = {
170
170
  // False when the organization is not on the Autorouting plan. A missing
171
171
  // value is treated as enabled.
172
172
  autorouting_enabled?: boolean;
173
+ // False when model lists leave out `dari/routing` while requests for it are
174
+ // still served: a self-hosted gateway without Dari Auto Routing serves the
175
+ // first available model for it. A missing value lists it.
176
+ routing_listed?: boolean;
173
177
  };
@@ -1,33 +0,0 @@
1
- [
2
- "openai/gpt-6-astra",
3
- "openai/gpt-6.1-terra",
4
- "openai/gpt-6.1-sol",
5
- "openai/gpt-6-sol",
6
- "openai/gpt-6-luna",
7
- "openai/gpt-5.6-sol",
8
- "openai/gpt-5.6-terra",
9
- "openai/gpt-5.6-luna",
10
- "anthropic/claude-opus-5-5",
11
- "anthropic/claude-opus-5",
12
- "anthropic/claude-sonnet-5-5",
13
- "anthropic/claude-sonnet-5",
14
- "anthropic/claude-fable-5-2",
15
- "anthropic/claude-fable-5-1",
16
- "anthropic/claude-fable-5",
17
- "anthropic/claude-haiku-5-5",
18
- "anthropic/claude-haiku-4-5",
19
- "meta/muse-wonder-1.0",
20
- "meta/muse-spark-1.3",
21
- "meta/muse-ember",
22
- "meta/muse-spark-1.2",
23
- "moonshotai/Kimi-K3",
24
- "zai-org/GLM-5.3",
25
- "zai-org/GLM-5.3-Flash",
26
- "deepseek-ai/DeepSeek-V4-Pro-0813",
27
- "zai-org/GLM-5.2",
28
- "deepseek-ai/DeepSeek-V4-Flash-0731",
29
- "deepseek-ai/DeepSeek-V4.1-Flash-1017",
30
- "deepseek-ai/DeepSeek-V4.1-Flash",
31
- "xai/grok-4.6",
32
- "xai/grok-4.7"
33
- ]
@@ -1,33 +0,0 @@
1
- [
2
- "openai/gpt-6-astra",
3
- "openai/gpt-6.1-terra",
4
- "openai/gpt-6.1-sol",
5
- "openai/gpt-6-sol",
6
- "openai/gpt-6-luna",
7
- "openai/gpt-5.6-sol",
8
- "openai/gpt-5.6-terra",
9
- "openai/gpt-5.6-luna",
10
- "anthropic/claude-opus-5-5",
11
- "anthropic/claude-opus-5",
12
- "anthropic/claude-sonnet-5-5",
13
- "anthropic/claude-sonnet-5",
14
- "anthropic/claude-fable-5-2",
15
- "anthropic/claude-fable-5-1",
16
- "anthropic/claude-fable-5",
17
- "anthropic/claude-haiku-5-5",
18
- "anthropic/claude-haiku-4-5",
19
- "meta/muse-wonder-1.0",
20
- "meta/muse-spark-1.3",
21
- "meta/muse-ember",
22
- "meta/muse-spark-1.2",
23
- "moonshotai/Kimi-K3",
24
- "zai-org/GLM-5.3",
25
- "zai-org/GLM-5.3-Flash",
26
- "deepseek-ai/DeepSeek-V4-Pro-0813",
27
- "zai-org/GLM-5.2",
28
- "deepseek-ai/DeepSeek-V4-Flash-0731",
29
- "deepseek-ai/DeepSeek-V4.1-Flash-1017",
30
- "deepseek-ai/DeepSeek-V4.1-Flash",
31
- "xai/grok-4.6",
32
- "xai/grok-4.7"
33
- ]