@mupt-ai/dari-gateway 1.0.330 → 1.0.332

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 (61) hide show
  1. package/README.md +38 -8
  2. package/dari-gateway.example.yaml +4 -0
  3. package/dist/activity/conversations.js +4 -2
  4. package/dist/activity/core.js +52 -28
  5. package/dist/activity/people.js +20 -17
  6. package/dist/link/assets.js +2 -0
  7. package/dist/link/key_providers.js +1 -0
  8. package/dist/models/canonical.d.ts +12 -0
  9. package/dist/models/canonical.js +10 -0
  10. package/dist/models/canonical_models.json +69 -0
  11. package/dist/models/catalog.js +1 -0
  12. package/dist/models/provider_defaults.js +2 -0
  13. package/dist/models/provider_models.json +114 -0
  14. package/dist/models/runtime_overrides.js +13 -0
  15. package/dist/protocol/output/anthropic_messages_output.js +3 -1
  16. package/dist/protocol/output/anthropic_messages_stream.js +14 -0
  17. package/dist/providers/model_capabilities.d.ts +1 -0
  18. package/dist/providers/model_capabilities.js +5 -1
  19. package/dist/providers/pi.js +2 -0
  20. package/dist/providers/pi_context.js +35 -2
  21. package/dist/providers/pi_options.js +50 -0
  22. package/dist/providers/pi_output.js +21 -3
  23. package/dist/self_host/config.d.ts +46 -4
  24. package/dist/self_host/config.js +165 -54
  25. package/dist/self_host/main.d.ts +7 -3
  26. package/dist/self_host/main.js +40 -17
  27. package/dist/self_host/platform.d.ts +4 -3
  28. package/dist/self_host/platform.js +6 -4
  29. package/dist/self_host/resolve.d.ts +2 -0
  30. package/dist/self_host/resolve.js +23 -10
  31. package/dist/self_host/router_models.d.ts +5 -2
  32. package/dist/self_host/router_models.js +10 -5
  33. package/dist/self_host/router_specs.d.ts +64 -0
  34. package/dist/self_host/router_specs.js +194 -0
  35. package/dist/telemetry/requests/interaction_observability.js +1 -0
  36. package/package.json +3 -3
  37. package/src/activity/conversations.ts +4 -2
  38. package/src/activity/core.ts +52 -28
  39. package/src/activity/people.ts +20 -18
  40. package/src/link/assets.ts +2 -0
  41. package/src/link/key_providers.ts +1 -0
  42. package/src/models/canonical.ts +22 -0
  43. package/src/models/canonical_models.json +69 -0
  44. package/src/models/catalog.ts +1 -0
  45. package/src/models/provider_defaults.ts +2 -0
  46. package/src/models/provider_models.json +114 -0
  47. package/src/models/runtime_overrides.ts +13 -0
  48. package/src/protocol/output/anthropic_messages_output.ts +5 -1
  49. package/src/protocol/output/anthropic_messages_stream.ts +16 -0
  50. package/src/providers/model_capabilities.ts +6 -1
  51. package/src/providers/pi.ts +1 -0
  52. package/src/providers/pi_context.ts +34 -3
  53. package/src/providers/pi_options.ts +51 -1
  54. package/src/providers/pi_output.ts +21 -3
  55. package/src/self_host/config.ts +217 -60
  56. package/src/self_host/main.ts +47 -18
  57. package/src/self_host/platform.ts +6 -4
  58. package/src/self_host/resolve.ts +24 -9
  59. package/src/self_host/router_models.ts +16 -6
  60. package/src/self_host/router_specs.ts +236 -0
  61. package/src/telemetry/requests/interaction_observability.ts +1 -0
package/README.md CHANGED
@@ -64,7 +64,8 @@ docker run -p 8080:8080 \
64
64
  | --- | --- |
65
65
  | `DARI_GATEWAY_KEYS` | Required. Comma-separated bearer keys clients authenticate with. |
66
66
  | `DARI_GATEWAY_CONFIG` | Router config file. Default `dari-gateway.yaml`. |
67
- | `DARI_GATEWAY_DB` | SQLite database for subscriptions, Dari Link grants, model lists saved with `dari gateway models`, conversation state, and Activity (each request's log row and, outside ZDR routers, its request and response bodies). Default `dari-gateway.db`. Without `DARI_GATEWAY_ENCRYPTION_KEY` it stores subscription tokens in plaintext; protect it like a secret either way. |
67
+ | `DARI_GATEWAY_ROUTERS_DIR` | Optional. A directory of [router specs](#router-specs), read at startup: each `<id>.yaml` or `<id>.yml` is router `<id>`. |
68
+ | `DARI_GATEWAY_DB` | SQLite database for subscriptions, Dari Link grants, model lists saved with `dari setup <agent>`, router specs saved through the API, conversation state, and Activity (each request's log row and, outside ZDR routers, its request and response bodies). Default `dari-gateway.db`. Without `DARI_GATEWAY_ENCRYPTION_KEY` it stores subscription tokens in plaintext; protect it like a secret either way. |
68
69
  | `DARI_GATEWAY_ENCRYPTION_KEY` | Encrypts the subscription tokens, pending sign-ins, and API keys in the database: a 32-byte key in base64 (`openssl rand -base64 32`). Each value is sealed with AES-256-GCM and bound to its own row, so a copied database, or a token moved into another row, is useless without the key. Keep the key outside the database's storage and backups (a secret manager, not the same disk). To rotate, list the new key first and the old one after a comma, start the gateway once (it re-encrypts everything under the first), then drop the old one. Required for Dari Link: without it the approval page takes nobody's subscriptions or keys. Losing the key loses the stored subscriptions; users connect again. |
69
70
  | `DARI_LINK_SESSION_SECRET` | Signs the cookie that remembers the user of Dari Link's approval and connections pages. Unset, each gateway process makes its own, so a restart forgets who connected which plans. Set it on any gateway that serves Dari Link. |
70
71
  | `DARI_AUTO_ROUTING_API_KEY` | Optional. Select among a router's models with Dari Auto Routing. |
@@ -79,15 +80,15 @@ routers:
79
80
  default: # serves /v1/...
80
81
  models:
81
82
  - anthropic/claude-sonnet-5-5
82
- - id: openai/gpt-6.1-sol
83
+ - id: openai/gpt-6.2-sol
83
84
  thinking: [medium, high]
84
85
  agentModels: # optional: a coding agent's own list, in place of `models`
85
- codex: [openai/gpt-6.1-sol, openai/gpt-6.1-terra]
86
+ codex: [openai/gpt-6.2-sol, openai/gpt-6.1-terra]
86
87
  subscriptions: true # prefer connected subscriptions over API keys
87
88
  sessionPinning: false # route each session and subagent once, then keep its model
88
89
  nativeCompaction: false # let Codex compact server-side; compacted requests route only to supporting models
89
90
  roleModels: # optional: serve the main agent or subagents one model, without routing
90
- subagent: openai/gpt-6.1-sol
91
+ subagent: openai/gpt-6.2-sol
91
92
  rolePrompts: # optional: append to the main agent's or subagents' system prompt
92
93
  main: Delegate codebase exploration to subagents.
93
94
  local: # serves /local/v1/...
@@ -101,7 +102,36 @@ providers: # endpoints outside the built-in catalog
101
102
 
102
103
  Model ids are `provider/model`. Clients send `model: "dari/routing"` to let the router choose, or `model: "dari/model/<id>"` to pin one of its models. A Claude Code subscription serves Anthropic models only for Claude Code itself; a ChatGPT subscription serves OpenAI models for every client. Each coding agent is offered the router's models that a credential can serve it, or its own `agentModels` list (`claude_code`, `codex`, `muse_code`, `opencode`, `pi`, `openclaw`, `hermes`) when the router has one.
103
104
 
104
- `dari gateway models` changes either list on a running gateway, with any gateway key: `dari gateway models --agent codex openai/gpt-6.1-sol`, or no models for the picker. It calls `PUT` and `DELETE /v1/router/models[/<agent>]` (`GET /v1/router/models` reads them). The gateway saves the list in its database and serves it at once in place of the config file's, until `--reset` removes it.
105
+ `dari setup <agent>` opens the model picker on a running gateway, with any gateway key. It calls `PUT /v1/router/models[/<agent>]` (`GET` reads the lists, `DELETE` removes a saved one). The gateway saves the list in its database and serves it at once in place of the config file's.
106
+
107
+ ### Router specs
108
+
109
+ A router spec is a whole router as one YAML file with no credentials, the same file hosted Dari applies:
110
+
111
+ ```yaml
112
+ name: Opus 5.5 + DeepSeek Subagents
113
+ models:
114
+ - anthropic/claude-opus-5-5
115
+ - id: deepseek-ai/DeepSeek-V4.1-Flash-1017
116
+ thinking: [high]
117
+ provider: opencode-go # served by this provider, not the one its id names
118
+ roles:
119
+ main: { model: anthropic/claude-opus-5-5 }
120
+ subagent: { model: deepseek-ai/DeepSeek-V4.1-Flash-1017, prompt: Be brief. }
121
+ routing: { session_pinning: false, retries: 1 }
122
+ payment: { allow: [subscription, key] } # without subscription, only API keys pay
123
+ native_compaction: false
124
+ agents: { codex: [openai/gpt-6.1-sol] }
125
+ ```
126
+
127
+ The gateway pays with connected subscriptions when `payment.allow` lists `subscription`, and otherwise with provider API keys; it has no Dari credits. `hosted` settings and a model's `fast` apply only on hosted Dari and are ignored here; `routing.rules` runs only on hosted Dari and is refused. A model's `provider` must be one that serves it, such as `opencode-go` or `fireworks` for the DeepSeek, Kimi, and GLM models.
128
+
129
+ With any gateway key:
130
+
131
+ - `PUT /v1/routers/<id>` with `{"spec_yaml": "<the file's text>"}` (or `{"spec": {...}}`) checks the spec, saves it, and serves it at once at `/<id>/v1/...` (`default` at `/v1/...`), in place of any router of that id. It answers `{"id", "name"}`, or 400 with the reason.
132
+ - `GET /v1/routers` lists `{"routers": [{"id", "name", "source"}]}`, `source` being `saved` or `config` (the config file or `DARI_GATEWAY_ROUTERS_DIR`).
133
+ - `GET /v1/routers/<id>` answers the spec as `application/yaml`: a saved or file spec as written, and a config file router as the spec it amounts to.
134
+ - `DELETE /v1/routers/<id>` removes a saved spec, so a config router of that id serves again. Routers from files are changed in their files.
105
135
 
106
136
  ### Model catalog
107
137
 
@@ -220,9 +250,9 @@ The gateway refuses a model the grant cannot serve, a plan at its limit, a spent
220
250
  "id": "…", "kind": "openai_codex", "plan": "ChatGPT Plus/Pro", "label": "a@example.com", "account_email": "a@example.com",
221
251
  "serves": "any_app", "state": "ready", "available_at": null, "unavailable_until": null,
222
252
  "usage": [{"window_minutes": 300, "utilization": 0.42, "resets_at": "…"}, {"window_minutes": 10080, "utilization": 0.1, "resets_at": "…"}],
223
- "models": [{"id": "dari/model/openai/gpt-5.5", "name": "GPT-5.5"}, {"id": "dari/model/openai/gpt-6.1-sol", "name": "GPT-6.1 Sol"}]
253
+ "models": [{"id": "dari/model/openai/gpt-5.5", "name": "GPT-5.5"}, {"id": "dari/model/openai/gpt-6.2-sol", "name": "GPT-6.2 Sol"}]
224
254
  }],
225
- "models": [{"id": "dari/model/openai/gpt-5.5", "name": "GPT-5.5"}, {"id": "dari/model/openai/gpt-6.1-sol", "name": "GPT-6.1 Sol"}],
255
+ "models": [{"id": "dari/model/openai/gpt-5.5", "name": "GPT-5.5"}, {"id": "dari/model/openai/gpt-6.2-sol", "name": "GPT-6.2 Sol"}],
226
256
  "routes": true
227
257
  }
228
258
  ```
@@ -395,7 +425,7 @@ The root entry needs no Bun APIs, so any runtime with web-standard `fetch`, `Req
395
425
  Platforms can also:
396
426
 
397
427
  - implement `resolveProviderCredential({ provider, model, routerId, organizationId, apiKey, clientHarness? })` to supply a per-request `{ apiKey, baseUrl?, headers?, subscription? }`, such as a tenant's own key, in place of the router's resolved key. With `subscription` (`"openai_codex"`, `"anthropic_claude_code"`, or `"meta_muse"`), `apiKey` is that plan's access token: Codex's `auth.json` `tokens.access_token`, the token `claude setup-token` prints, or the Model API key a Meta sign-in mints. The platform keeps it fresh. Strict routers serve these supplied plans, but never subscriptions the gateway resolved itself. A plan serves only its own provider's models; a Claude Code plan serves only Claude Code clients, and a Muse Code plan only Muse Code clients (recognized by their `x-client-id`);
398
- - resolve routers with `strict: true` to serve only the requested `dari/model/<id>` at the requested thinking level, with no selector, lease, or personal subscription. Set `strict_providers: ["openai"]` on the resolved router to permit any bundled-catalog model from that provider without enumerating `enabled_models`. Use `dari/model/openai/gpt-6.1-sol`; bare IDs and unknown models remain refused. This grant is ignored on non-strict routers and does not discover uncatalogued models;
428
+ - resolve routers with `strict: true` to serve only the requested `dari/model/<id>` at the requested thinking level, with no selector, lease, or personal subscription. Set `strict_providers: ["openai"]` on the resolved router to permit any bundled-catalog model from that provider without enumerating `enabled_models`. Use `dari/model/openai/gpt-6.2-sol`; bare IDs and unknown models remain refused. This grant is ignored on non-strict routers and does not discover uncatalogued models;
399
429
  - resolve routers with `session_pinning: true` to route each session once and serve that pair for the rest of the session. Each subagent (Claude Code agent id, Codex subagent thread, OpenCode child session) is routed once on its own. Pins are kept through `readSessionPin` and `writeSessionPin`, keyed by router and an opaque pin key; background requests and `dari/model/<id>` requests never use them;
400
430
  - resolve routers with `native_compaction: true` to let Codex compact context server-side with the provider's native compaction. Requests carrying compaction state are routed only to models that support it;
401
431
  - read exact usage from `recordRequest`: the summary carries input, output, cache-read, and cache-write tokens and `total_cost_usd`, preferring the provider's billed cost (`cost_source: "provider"`, from OpenRouter and Vercel AI Gateway). Each record also carries the router's non-secret routing settings as `router` (enabled models, thinking levels, and the strict, speculative-routing, and session-pinning flags). Failed and aborted requests are recorded too;
@@ -3,6 +3,10 @@
3
3
  # Each router is an endpoint: `default` serves /v1/..., any other router
4
4
  # serves /<router>/v1/.... Clients send `model: dari/routing` to let the
5
5
  # router choose, or `model: dari/model/<id>` to pin one of its models.
6
+ #
7
+ # A router can also be a router spec, the YAML file hosted Dari applies:
8
+ # saved with PUT /v1/routers/<id>, or read from DARI_GATEWAY_ROUTERS_DIR as
9
+ # <id>.yaml. A spec is served in place of the router of its id here.
6
10
  routers:
7
11
  default:
8
12
  models:
@@ -144,8 +144,10 @@ export const conversations = async (request) => {
144
144
  }
145
145
  const items = [];
146
146
  if (keys.length > 0) {
147
- const records = await loadRecords(db, sql `${where} and ${groupsCondition(keys)}`);
148
- const titles = await conversationTitles(db, organizationId, keys);
147
+ const [records, titles] = await Promise.all([
148
+ loadRecords(db, sql `${where} and ${groupsCondition(keys)}`),
149
+ conversationTitles(db, organizationId, keys),
150
+ ]);
149
151
  const entities = await loadEntities(db, records);
150
152
  const byGroup = new Map();
151
153
  for (const record of records) {
@@ -2,7 +2,7 @@
2
2
  import { baseCriteria, bucketIndex, bucketStart, criteria, identityCriteria, MODEL, readActivityQuery, readSourceScope, SELECTOR_UNRESOLVED_MODEL, sourceProtocols, validatedBucketFilters, validatedFilters, } from "./filters.js";
3
3
  import { loadRouterSavings, loadSavings, routeKey } from "./savings.js";
4
4
  import { and, sql } from "./sql.js";
5
- import { CONVERSATION_ID, THINKING_LEVEL, thinkingLevelValue } from "./shared.js";
5
+ import { CONVERSATION_ID, REASONING_EFFORTS, THINKING_LEVEL, thinkingLevelValue } from "./shared.js";
6
6
  import { decimalText, formatInstant, parseDecimal, readInstant, readInt, readOptionalString, sumDecimalText, } from "./values.js";
7
7
  const MAX_MODEL_TRANSITIONS = 200;
8
8
  /** Read the filters, then admit the caller, then validate, as the API orders its checks. */
@@ -185,8 +185,12 @@ export const overview = async (request) => {
185
185
  const { organizationId, filters } = readFilters(request, true);
186
186
  const db = request.db;
187
187
  const where = criteria(db, organizationId, filters);
188
- const points = await loadSeries(db, filters, where);
189
- const savings = await loadSavings(db, where);
188
+ const [points, savings, apiKeys, keySources] = await Promise.all([
189
+ loadSeries(db, filters, where),
190
+ loadSavings(db, where),
191
+ loadApiKeys(db, where),
192
+ loadKeySources(db, where),
193
+ ]);
190
194
  return {
191
195
  from_at: formatInstant(filters.start),
192
196
  to_at: formatInstant(filters.end),
@@ -194,8 +198,8 @@ export const overview = async (request) => {
194
198
  summary: summary(points, savings.total),
195
199
  series: points.map(seriesPointBody),
196
200
  model_mix: modelMix(points),
197
- api_keys: await loadApiKeys(db, where),
198
- key_sources: await loadKeySources(db, where),
201
+ api_keys: apiKeys,
202
+ key_sources: keySources,
199
203
  };
200
204
  };
201
205
  /* Routers. */
@@ -203,7 +207,8 @@ export const routers = async (request) => {
203
207
  const { organizationId, filters } = readFilters(request, true);
204
208
  const db = request.db;
205
209
  const where = criteria(db, organizationId, filters);
206
- const summaries = await db.all(sql `
210
+ const [summaries, savings, seriesRows] = await Promise.all([
211
+ db.all(sql `
207
212
  select
208
213
  r.router_id,
209
214
  count(*) filter (where r.status = 'completed') as completed,
@@ -215,9 +220,9 @@ export const routers = async (request) => {
215
220
  where ${where}
216
221
  and r.router_id is not null
217
222
  group by r.router_id
218
- order by r.router_id`);
219
- const savings = await loadRouterSavings(db, where);
220
- const seriesRows = await db.all(sql `
223
+ order by r.router_id`),
224
+ loadRouterSavings(db, where),
225
+ db.all(sql `
221
226
  select
222
227
  r.router_id,
223
228
  ${bucketIndex(db, filters)} as bucket_index,
@@ -226,7 +231,8 @@ export const routers = async (request) => {
226
231
  where ${where}
227
232
  and r.router_id is not null
228
233
  group by 1, 2
229
- order by 1, 2`);
234
+ order by 1, 2`),
235
+ ]);
230
236
  const seriesByRouter = new Map();
231
237
  for (const row of seriesRows) {
232
238
  const routerId = String(row.router_id);
@@ -258,6 +264,22 @@ export const routers = async (request) => {
258
264
  /* Models. */
259
265
  /** The p95 provider latency per model, thinking level, and provider (`percentile_disc(0.95)`). */
260
266
  async function loadLatencyP95(db, where) {
267
+ const key = (row) => JSON.stringify([String(row.model), thinkingLevelValue(row.thinking_level), readOptionalString(row.provider)]);
268
+ if (db.dialect === "postgres") {
269
+ // Group by the thinking level as the key reads it: an unknown one is none.
270
+ const rows = await db.all(sql `
271
+ select
272
+ ${MODEL} as model,
273
+ case when ${THINKING_LEVEL} in (${REASONING_EFFORTS}) then ${THINKING_LEVEL} end as thinking_level,
274
+ r.selected_provider as provider,
275
+ percentile_disc(0.95) within group (order by r.provider_latency_ms) as latency
276
+ from routing_requests r
277
+ where ${where}
278
+ and r.provider_latency_ms > 0
279
+ group by 1, 2, 3`);
280
+ return new Map(rows.map((row) => [key(row), readInt(row.latency)]));
281
+ }
282
+ // SQLite has no percentile_disc: read every latency and pick the same value.
261
283
  const rows = await db.all(sql `
262
284
  select
263
285
  ${MODEL} as model,
@@ -269,10 +291,9 @@ async function loadLatencyP95(db, where) {
269
291
  and r.provider_latency_ms > 0`);
270
292
  const grouped = new Map();
271
293
  for (const row of rows) {
272
- const key = JSON.stringify([String(row.model), thinkingLevelValue(row.thinking_level), readOptionalString(row.provider)]);
273
- const values = grouped.get(key) ?? [];
294
+ const values = grouped.get(key(row)) ?? [];
274
295
  values.push(readInt(row.latency));
275
- grouped.set(key, values);
296
+ grouped.set(key(row), values);
276
297
  }
277
298
  const p95 = new Map();
278
299
  for (const [key, values] of grouped) {
@@ -282,7 +303,7 @@ async function loadLatencyP95(db, where) {
282
303
  return p95;
283
304
  }
284
305
  async function loadModelRows(db, where) {
285
- const rows = await db.all(sql `
306
+ const [rows, latency] = await Promise.all([db.all(sql `
286
307
  select
287
308
  ${MODEL} as model,
288
309
  ${THINKING_LEVEL} as thinking_level,
@@ -292,8 +313,7 @@ async function loadModelRows(db, where) {
292
313
  from routing_requests r
293
314
  where ${where}
294
315
  group by 1, 2, 3
295
- order by model_steps desc, 1, 2 nulls last, 3 nulls last`);
296
- const latency = await loadLatencyP95(db, where);
316
+ order by model_steps desc, 1, 2 nulls last, 3 nulls last`), loadLatencyP95(db, where)]);
297
317
  return rows.map((row) => {
298
318
  const model = String(row.model);
299
319
  const thinkingLevel = thinkingLevelValue(row.thinking_level);
@@ -450,15 +470,17 @@ export const models = async (request) => {
450
470
  const { organizationId, filters } = readFilters(request, false);
451
471
  const db = request.db;
452
472
  const where = criteria(db, organizationId, filters);
453
- const modelRows = await loadModelRows(db, where);
454
- const switches = await loadTransitions(db, organizationId, filters);
455
- const savings = await loadSavings(db, where);
473
+ const [modelRows, switches, savings, observed] = await Promise.all([
474
+ loadModelRows(db, where),
475
+ loadTransitions(db, organizationId, filters),
476
+ loadSavings(db, where),
477
+ loadObservedConversations(db, where),
478
+ ]);
456
479
  for (const model of modelRows) {
457
480
  if (model.provider !== null) {
458
481
  model.savings_vs_most_expensive_usd = savings.byModel.get(routeKey(model.model, model.thinking_level, model.provider)) ?? null;
459
482
  }
460
483
  }
461
- const observed = await loadObservedConversations(db, where);
462
484
  const totalSwitches = switches.modelSwitches + switches.thinkingLevelSwitches;
463
485
  const transitions = switches.transitions.map((item) => ({ ...item, switch_share: ratio(item.occurrences, totalSwitches) }));
464
486
  return {
@@ -542,7 +564,8 @@ export const filterOptions = async (request) => {
542
564
  const { organizationId, filters } = readFilters(request, false);
543
565
  const db = request.db;
544
566
  const where = baseCriteria(db, organizationId, filters);
545
- const routerRows = await db.all(sql `
567
+ const [routerRows, keyRows, userRows, modelRows] = await Promise.all([
568
+ db.all(sql `
546
569
  select distinct
547
570
  r.router_id,
548
571
  m.name
@@ -550,8 +573,8 @@ export const filterOptions = async (request) => {
550
573
  left join model_routers m on m.id = r.router_id
551
574
  where ${where}
552
575
  and r.router_id is not null
553
- order by m.name nulls last, r.router_id`);
554
- const keyRows = await db.all(sql `
576
+ order by m.name nulls last, r.router_id`),
577
+ db.all(sql `
555
578
  select distinct
556
579
  k.id,
557
580
  k.label,
@@ -564,8 +587,8 @@ export const filterOptions = async (request) => {
564
587
  left join users u on u.id = coalesce(k.created_for_user_id, k.attributed_to_user_id)
565
588
  where ${where}
566
589
  and k.organization_id = ${organizationId}
567
- order by k.label, k.id`);
568
- const userRows = await db.all(sql `
590
+ order by k.label, k.id`),
591
+ db.all(sql `
569
592
  select distinct
570
593
  r.attributed_user_id,
571
594
  u.display_name,
@@ -574,13 +597,14 @@ export const filterOptions = async (request) => {
574
597
  join users u on u.id = r.attributed_user_id
575
598
  where ${where}
576
599
  and r.attributed_user_id is not null
577
- order by u.display_name nulls last, u.email, r.attributed_user_id`);
578
- const modelRows = await db.all(sql `
600
+ order by u.display_name nulls last, u.email, r.attributed_user_id`),
601
+ db.all(sql `
579
602
  select distinct
580
603
  ${MODEL} as model,
581
604
  r.selected_provider
582
605
  from routing_requests r
583
- where ${where}`);
606
+ where ${where}`),
607
+ ]);
584
608
  const providersByModel = new Map();
585
609
  const providers = new Set();
586
610
  for (const row of modelRows) {
@@ -58,7 +58,8 @@ export const peopleSeries = async (request) => {
58
58
  const userIds = validatedComparisonUserIds(requested);
59
59
  const where = criteria(db, organizationId, filters);
60
60
  const bucket = bucketIndex(db, filters);
61
- const activeRows = await db.all(sql `
61
+ const [activeRows, busiest] = await Promise.all([
62
+ db.all(sql `
62
63
  select
63
64
  ${bucket} as bucket_index,
64
65
  count(distinct r.attributed_user_id) as active_people
@@ -66,23 +67,23 @@ export const peopleSeries = async (request) => {
66
67
  where ${where}
67
68
  and r.attributed_user_id is not null
68
69
  group by 1
69
- order by 1`);
70
- if (userIds.length === 0) {
71
- const busiest = await db.all(sql `
70
+ order by 1`),
71
+ userIds.length > 0 ? [] : db.all(sql `
72
72
  select r.attributed_user_id
73
73
  from routing_requests r
74
74
  where ${where}
75
75
  and r.attributed_user_id is not null
76
76
  group by r.attributed_user_id
77
77
  order by count(*) desc, r.attributed_user_id
78
- limit ${DEFAULT_COMPARISON_USERS}`);
79
- userIds.push(...busiest.map((row) => String(row.attributed_user_id)));
80
- }
78
+ limit ${DEFAULT_COMPARISON_USERS}`),
79
+ ]);
80
+ userIds.push(...busiest.map((row) => String(row.attributed_user_id)));
81
81
  const users = await loadComparisonUsers(db, userIds);
82
82
  const compared = users.map((user) => user.id);
83
83
  const peopleSeries = [];
84
84
  if (compared.length > 0) {
85
- const points = await db.all(sql `
85
+ const [points, counts] = await Promise.all([
86
+ db.all(sql `
86
87
  select
87
88
  ${bucket} as bucket_index,
88
89
  r.attributed_user_id,
@@ -94,8 +95,8 @@ export const peopleSeries = async (request) => {
94
95
  where ${where}
95
96
  and r.attributed_user_id in (${compared})
96
97
  group by 1, 2
97
- order by 1, 2`);
98
- const counts = await db.all(sql `
98
+ order by 1, 2`),
99
+ db.all(sql `
99
100
  select
100
101
  d.bucket_index,
101
102
  d.attributed_user_id,
@@ -112,7 +113,8 @@ export const peopleSeries = async (request) => {
112
113
  where ${where}
113
114
  and r.attributed_user_id in (${compared})
114
115
  ) d
115
- group by d.bucket_index, d.attributed_user_id`);
116
+ group by d.bucket_index, d.attributed_user_id`),
117
+ ]);
116
118
  const conversations = new Map(counts.map((row) => [`${readInt(row.bucket_index)}\0${row.attributed_user_id}`, readInt(row.conversations)]));
117
119
  for (const row of points) {
118
120
  peopleSeries.push({
@@ -246,15 +248,17 @@ async function loadIdentityPage(db, organizationId, filters, query) {
246
248
  and (s.identity_api_key_id = c.identity_api_key_id
247
249
  or (s.identity_api_key_id is null and c.identity_api_key_id is null))
248
250
  where ${and(conditions)}`;
249
- const [countRow] = await db.all(sql `select count(*) as count from (${statement}) page`);
250
- const identityCount = readInt(countRow?.count);
251
- const rows = await db.all(sql `
251
+ const [[countRow], rows] = await Promise.all([
252
+ db.all(sql `select count(*) as count from (${statement}) page`),
253
+ db.all(sql `
252
254
  ${statement}
253
255
  order by
254
256
  ${SORTS[query.sortBy]} ${raw(query.direction)},
255
257
  lower(${IDENTITY_NAME}),
256
258
  coalesce(s.attributed_user_id, s.identity_api_key_id, '')
257
- limit ${query.limit} offset ${query.offset}`);
259
+ limit ${query.limit} offset ${query.offset}`),
260
+ ]);
261
+ const identityCount = readInt(countRow?.count);
258
262
  if (rows.length === 0)
259
263
  return { identities: [], identityCount };
260
264
  const page = rows.map((row) => ({
@@ -263,8 +267,7 @@ async function loadIdentityPage(db, organizationId, filters, query) {
263
267
  apiKeyId: readOptionalString(row.identity_api_key_id),
264
268
  }));
265
269
  const pageWhere = sql `${where} and ${pageIdentityCriterion(page)}`;
266
- const mix = await identityModelMix(db, pageWhere);
267
- const usage = await identityKeyUsage(db, pageWhere);
270
+ const [mix, usage] = await Promise.all([identityModelMix(db, pageWhere), identityKeyUsage(db, pageWhere)]);
268
271
  const keys = await loadApiKeys(db, organizationId, new Set([...usage.values()].flatMap((used) => [...used.keys()])));
269
272
  const identities = page.map(({ row, userId, apiKeyId }) => {
270
273
  const key = identityKey(userId, apiKeyId);
@@ -8,6 +8,7 @@ export const DARI_MARK = `<svg class="mark" viewBox="0 0 1024 1024" aria-label="
8
8
  const MARKS = {
9
9
  anthropic: `<svg class="logo" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true"><path d="M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z"></path></svg>`,
10
10
  claude: `<svg class="logo" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true"><path d="M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"></path></svg>`,
11
+ gemini: `<svg class="logo" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true"><path d="M12 24A14.304 14.304 0 000 12 14.304 14.304 0 0012 0a14.305 14.305 0 0012 12 14.305 14.305 0 00-12 12"></path></svg>`,
11
12
  meta: `<svg class="logo" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true"><path d="M6.897 4c1.915 0 3.516.932 5.43 3.376l.282-.373c.19-.246.383-.484.58-.71l.313-.35C14.588 4.788 15.792 4 17.225 4c1.273 0 2.469.557 3.491 1.516l.218.213c1.73 1.765 2.917 4.71 3.053 8.026l.011.392.002.25c0 1.501-.28 2.759-.818 3.7l-.14.23-.108.153c-.301.42-.664.758-1.086 1.009l-.265.142-.087.04a3.493 3.493 0 01-.302.118 4.117 4.117 0 01-1.33.208c-.524 0-.996-.067-1.438-.215-.614-.204-1.163-.56-1.726-1.116l-.227-.235c-.753-.812-1.534-1.976-2.493-3.586l-1.43-2.41-.544-.895-1.766 3.13-.343.592C7.597 19.156 6.227 20 4.356 20c-1.21 0-2.205-.42-2.936-1.182l-.168-.184c-.484-.573-.837-1.311-1.043-2.189l-.067-.32a8.69 8.69 0 01-.136-1.288L0 14.468c.002-.745.06-1.49.174-2.23l.1-.573c.298-1.53.828-2.958 1.536-4.157l.209-.34c1.177-1.83 2.789-3.053 4.615-3.16L6.897 4zm-.033 2.615l-.201.01c-.83.083-1.606.673-2.252 1.577l-.138.199-.01.018c-.67 1.017-1.185 2.378-1.456 3.845l-.004.022a12.591 12.591 0 00-.207 2.254l.002.188c.004.18.017.36.04.54l.043.291c.092.503.257.908.486 1.208l.117.137c.303.323.698.492 1.17.492 1.1 0 1.796-.676 3.696-3.641l2.175-3.4.454-.701-.139-.198C9.11 7.3 8.084 6.616 6.864 6.616zm10.196-.552l-.176.007c-.635.048-1.223.359-1.82.933l-.196.198c-.439.462-.887 1.064-1.367 1.807l.266.398c.18.274.362.56.55.858l.293.475 1.396 2.335.695 1.114c.583.926 1.03 1.6 1.408 2.082l.213.262c.282.326.529.54.777.673l.102.05c.227.1.457.138.718.138.176.002.35-.023.518-.073.338-.104.61-.32.813-.637l.095-.163.077-.162c.194-.459.29-1.06.29-1.785l-.006-.449c-.08-2.871-.938-5.372-2.2-6.798l-.176-.189c-.67-.683-1.444-1.074-2.27-1.074z"></path></svg>`,
12
13
  moonshot: `<svg class="logo" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true"><path d="M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z"></path></svg>`,
13
14
  openai: `<svg class="logo" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true"><path d="M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"></path></svg>`,
@@ -27,6 +28,7 @@ const MARK_FOR = {
27
28
  meta: "meta",
28
29
  moonshotai: "moonshot",
29
30
  xai: "xai",
31
+ google: "gemini",
30
32
  openrouter: "openrouter",
31
33
  "vercel-ai-gateway": "vercel",
32
34
  };
@@ -8,6 +8,7 @@ const PROVIDER_NAMES = {
8
8
  meta: "Meta",
9
9
  moonshotai: "Moonshot AI",
10
10
  xai: "xAI",
11
+ google: "Google",
11
12
  };
12
13
  /**
13
14
  * Whose API key a user can add on the approval page: each provider with
@@ -7,3 +7,15 @@ export type CanonicalModel = {
7
7
  export declare const CANONICAL_MODELS: readonly CanonicalModel[];
8
8
  /** A model's catalog name; a model the catalog does not list keeps its id. */
9
9
  export declare function canonicalModelName(id: string): string;
10
+ /** A canonical model as a provider other than the one its id names serves it. */
11
+ export type ProviderModel = {
12
+ model_id: string;
13
+ provider: string;
14
+ native_model_id: string;
15
+ api: string;
16
+ base_url: string | null;
17
+ };
18
+ /** How `provider` serves a model whose id names another provider, if it does. */
19
+ export declare function providerModel(modelId: string, provider: string): ProviderModel | undefined;
20
+ /** The providers besides the one its id names that serve a model. */
21
+ export declare function otherModelProviders(modelId: string): string[];
@@ -1,7 +1,17 @@
1
1
  import canonicalModels from "./canonical_models.json" with { type: "json" };
2
+ import providerModels from "./provider_models.json" with { type: "json" };
2
3
  /** The canonical models Dari serves, from the monorepo's router catalog. */
3
4
  export const CANONICAL_MODELS = canonicalModels;
4
5
  /** A model's catalog name; a model the catalog does not list keeps its id. */
5
6
  export function canonicalModelName(id) {
6
7
  return CANONICAL_MODELS.find((model) => model.id === id)?.name ?? id;
7
8
  }
9
+ const PROVIDER_MODELS = providerModels;
10
+ /** How `provider` serves a model whose id names another provider, if it does. */
11
+ export function providerModel(modelId, provider) {
12
+ return PROVIDER_MODELS.find((row) => row.model_id === modelId && row.provider === provider);
13
+ }
14
+ /** The providers besides the one its id names that serve a model. */
15
+ export function otherModelProviders(modelId) {
16
+ return PROVIDER_MODELS.filter((row) => row.model_id === modelId).map((row) => row.provider);
17
+ }
@@ -1,4 +1,15 @@
1
1
  [
2
+ {
3
+ "id": "openai/gpt-6.2-astra",
4
+ "name": "GPT-6.2 Astra",
5
+ "thinking_levels": [
6
+ "low",
7
+ "medium",
8
+ "high",
9
+ "xhigh",
10
+ "max"
11
+ ]
12
+ },
2
13
  {
3
14
  "id": "openai/gpt-6-astra",
4
15
  "name": "GPT-6 Astra",
@@ -22,6 +33,17 @@
22
33
  "max"
23
34
  ]
24
35
  },
36
+ {
37
+ "id": "openai/gpt-6.2-sol",
38
+ "name": "GPT-6.2 Sol",
39
+ "thinking_levels": [
40
+ "low",
41
+ "medium",
42
+ "high",
43
+ "xhigh",
44
+ "max"
45
+ ]
46
+ },
25
47
  {
26
48
  "id": "openai/gpt-6.1-sol",
27
49
  "name": "GPT-6.1 Sol",
@@ -352,5 +374,52 @@
352
374
  "high",
353
375
  "xhigh"
354
376
  ]
377
+ },
378
+ {
379
+ "id": "google/gemini-4-argon",
380
+ "name": "Gemini 4 Argon",
381
+ "thinking_levels": [
382
+ "low",
383
+ "medium",
384
+ "high"
385
+ ]
386
+ },
387
+ {
388
+ "id": "google/gemini-4-carbon",
389
+ "name": "Gemini 4 Carbon",
390
+ "thinking_levels": [
391
+ "low",
392
+ "medium",
393
+ "high"
394
+ ]
395
+ },
396
+ {
397
+ "id": "google/gemini-4-neon",
398
+ "name": "Gemini 4 Neon",
399
+ "thinking_levels": [
400
+ "low",
401
+ "medium",
402
+ "high",
403
+ "xhigh"
404
+ ]
405
+ },
406
+ {
407
+ "id": "google/gemini-4-hydrogen",
408
+ "name": "Gemini 4 Hydrogen",
409
+ "thinking_levels": [
410
+ "low",
411
+ "medium",
412
+ "high",
413
+ "xhigh"
414
+ ]
415
+ },
416
+ {
417
+ "id": "google/gemini-3.8-flash",
418
+ "name": "Gemini 3.8 Flash",
419
+ "thinking_levels": [
420
+ "low",
421
+ "medium",
422
+ "high"
423
+ ]
355
424
  }
356
425
  ]
@@ -7,6 +7,7 @@ export const DEFAULT_CATALOG_PROVIDERS = [
7
7
  "anthropic",
8
8
  "meta",
9
9
  "xai",
10
+ "google",
10
11
  "fireworks",
11
12
  "opencode-go",
12
13
  "openrouter",
@@ -8,6 +8,7 @@ const PROVIDER_LABELS = {
8
8
  fireworks: "Fireworks",
9
9
  meta: "Meta",
10
10
  xai: "xAI",
11
+ google: "Google",
11
12
  "opencode-go": "OpenCode Go",
12
13
  dari: "Dari",
13
14
  "amazon-bedrock": "Amazon Bedrock",
@@ -29,6 +30,7 @@ const PROVIDER_BASE_URLS = {
29
30
  anthropic: "https://api.anthropic.com",
30
31
  fireworks: "https://api.fireworks.ai/inference/v1",
31
32
  xai: "https://api.x.ai/v1",
33
+ google: "https://generativelanguage.googleapis.com/v1beta",
32
34
  // A flat-rate plan for open models; each model keeps its own API path
33
35
  // under https://opencode.ai/inference/go/, and this is chat completions.
34
36
  "opencode-go": "https://opencode.ai/inference/go/openai/v1",