@lunaroute/cli 0.14.4 → 0.14.5
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.
- package/dist/index.js +119 -50
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { Command, InvalidArgumentError, Option } from "commander";
|
|
5
5
|
|
|
6
6
|
// package.json
|
|
7
|
-
var version = "0.14.
|
|
7
|
+
var version = "0.14.5";
|
|
8
8
|
|
|
9
9
|
// src/login.ts
|
|
10
10
|
import { createServer } from "http";
|
|
@@ -1031,6 +1031,10 @@ var LUNAROUTE_SKILL_NAME = "lunaroute-memory";
|
|
|
1031
1031
|
function claudeUserConfigPath() {
|
|
1032
1032
|
return join3(homedir2(), ".claude.json");
|
|
1033
1033
|
}
|
|
1034
|
+
function claudeSettingsPath() {
|
|
1035
|
+
const home = process.env.CLAUDE_CONFIG_DIR || join3(homedir2(), ".claude");
|
|
1036
|
+
return join3(home, "settings.json");
|
|
1037
|
+
}
|
|
1034
1038
|
function claudeUserSkillPath(name = LUNAROUTE_SKILL_NAME) {
|
|
1035
1039
|
return join3(homedir2(), ".claude", "skills", name, "SKILL.md");
|
|
1036
1040
|
}
|
|
@@ -1115,13 +1119,13 @@ function extensionPlan(ctx) {
|
|
|
1115
1119
|
jsonc: true,
|
|
1116
1120
|
// opencode documents JSONC config
|
|
1117
1121
|
merge: (existing) => {
|
|
1118
|
-
const
|
|
1119
|
-
const raw =
|
|
1122
|
+
const obj2 = existing ?? {};
|
|
1123
|
+
const raw = obj2.plugin;
|
|
1120
1124
|
const plugins = Array.isArray(raw) ? raw : typeof raw === "string" ? [raw] : [];
|
|
1121
1125
|
if (!plugins.includes(EXTENSION)) plugins.push(EXTENSION);
|
|
1122
|
-
const next = { ...
|
|
1126
|
+
const next = { ...obj2, plugin: plugins };
|
|
1123
1127
|
if (!isProdGateway(ctx.routingUrl)) {
|
|
1124
|
-
const providers = objectOrEmpty(
|
|
1128
|
+
const providers = objectOrEmpty(obj2.provider);
|
|
1125
1129
|
const lr = objectOrEmpty(providers.lunaroute);
|
|
1126
1130
|
next.provider = {
|
|
1127
1131
|
...providers,
|
|
@@ -1172,10 +1176,10 @@ function providerPlan(ctx) {
|
|
|
1172
1176
|
jsonc: true,
|
|
1173
1177
|
// opencode documents JSONC config
|
|
1174
1178
|
merge: (existing) => {
|
|
1175
|
-
const
|
|
1176
|
-
const existingProviders = objectOrEmpty(
|
|
1179
|
+
const obj2 = existing ?? {};
|
|
1180
|
+
const existingProviders = objectOrEmpty(obj2.provider);
|
|
1177
1181
|
const provider = { ...existingProviders, lunaroute: block };
|
|
1178
|
-
return { ...
|
|
1182
|
+
return { ...obj2, provider };
|
|
1179
1183
|
}
|
|
1180
1184
|
}
|
|
1181
1185
|
],
|
|
@@ -1192,9 +1196,9 @@ function buildKeyPlan(key2) {
|
|
|
1192
1196
|
kind: "json",
|
|
1193
1197
|
path: opencodeAuthPath(),
|
|
1194
1198
|
merge: (existing) => {
|
|
1195
|
-
const
|
|
1196
|
-
delete
|
|
1197
|
-
return { ...
|
|
1199
|
+
const obj2 = existing ?? {};
|
|
1200
|
+
delete obj2["lunaroute/"];
|
|
1201
|
+
return { ...obj2, lunaroute: { type: "api", key: key2 } };
|
|
1198
1202
|
}
|
|
1199
1203
|
}
|
|
1200
1204
|
],
|
|
@@ -1267,10 +1271,10 @@ function buildPlan2(ctx) {
|
|
|
1267
1271
|
kind: "json",
|
|
1268
1272
|
path: piModelsPath(),
|
|
1269
1273
|
merge: (existing) => {
|
|
1270
|
-
const
|
|
1271
|
-
const existingProviders = typeof
|
|
1274
|
+
const obj2 = existing ?? {};
|
|
1275
|
+
const existingProviders = typeof obj2.providers === "object" && obj2.providers !== null ? obj2.providers : {};
|
|
1272
1276
|
const providers = { ...existingProviders, lunaroute: block };
|
|
1273
|
-
return { ...
|
|
1277
|
+
return { ...obj2, providers };
|
|
1274
1278
|
}
|
|
1275
1279
|
}
|
|
1276
1280
|
],
|
|
@@ -1280,8 +1284,8 @@ function buildPlan2(ctx) {
|
|
|
1280
1284
|
}
|
|
1281
1285
|
function stalePiProviderExists() {
|
|
1282
1286
|
try {
|
|
1283
|
-
const
|
|
1284
|
-
return Boolean(
|
|
1287
|
+
const obj2 = JSON.parse(readFileSync5(piModelsPath(), "utf8"));
|
|
1288
|
+
return Boolean(obj2.providers?.lunaroute);
|
|
1285
1289
|
} catch {
|
|
1286
1290
|
return false;
|
|
1287
1291
|
}
|
|
@@ -1293,10 +1297,10 @@ function buildStaleProviderCleanupPlan() {
|
|
|
1293
1297
|
kind: "json",
|
|
1294
1298
|
path: piModelsPath(),
|
|
1295
1299
|
merge: (existing) => {
|
|
1296
|
-
const
|
|
1297
|
-
const providers = { ...
|
|
1300
|
+
const obj2 = existing ?? {};
|
|
1301
|
+
const providers = { ...obj2.providers };
|
|
1298
1302
|
delete providers.lunaroute;
|
|
1299
|
-
const next = { ...
|
|
1303
|
+
const next = { ...obj2 };
|
|
1300
1304
|
if (Object.keys(providers).length > 0) next.providers = providers;
|
|
1301
1305
|
else delete next.providers;
|
|
1302
1306
|
return next;
|
|
@@ -1317,9 +1321,9 @@ function buildKeyPlan2(key2) {
|
|
|
1317
1321
|
kind: "json",
|
|
1318
1322
|
path: piAuthPath(),
|
|
1319
1323
|
merge: (existing) => {
|
|
1320
|
-
const
|
|
1324
|
+
const obj2 = existing ?? {};
|
|
1321
1325
|
return {
|
|
1322
|
-
...
|
|
1326
|
+
...obj2,
|
|
1323
1327
|
lunaroute: { type: "oauth", access: key2, refresh: "", expires: Date.now() + KEY_EXPIRES_MS }
|
|
1324
1328
|
};
|
|
1325
1329
|
}
|
|
@@ -1341,6 +1345,43 @@ function requireFirstModel(ctx, harness) {
|
|
|
1341
1345
|
return first;
|
|
1342
1346
|
}
|
|
1343
1347
|
|
|
1348
|
+
// src/model-picker.ts
|
|
1349
|
+
var LUNAROUTE_ROW_DESCRIPTION = "Managed by LunaRoute";
|
|
1350
|
+
function rows(models) {
|
|
1351
|
+
return models.map((m) => ({
|
|
1352
|
+
model: m.id,
|
|
1353
|
+
label: m.display_name || m.id,
|
|
1354
|
+
description: LUNAROUTE_ROW_DESCRIPTION
|
|
1355
|
+
}));
|
|
1356
|
+
}
|
|
1357
|
+
function obj(value) {
|
|
1358
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
1359
|
+
}
|
|
1360
|
+
function isRow(value) {
|
|
1361
|
+
return obj(value) !== null && typeof value.model === "string";
|
|
1362
|
+
}
|
|
1363
|
+
function claudeModelPicker(models) {
|
|
1364
|
+
return { replaceBuiltInOptions: true, options: rows(models) };
|
|
1365
|
+
}
|
|
1366
|
+
function mergeClaudeModelPickerSettings(existing, models) {
|
|
1367
|
+
const settings = obj(existing) ?? {};
|
|
1368
|
+
const prior = obj(settings.modelPicker) ?? {};
|
|
1369
|
+
const priorRows = (Array.isArray(prior.options) ? prior.options : []).filter(isRow);
|
|
1370
|
+
const current = new Set(rows(models).map((row) => row.model));
|
|
1371
|
+
const kept = priorRows.filter(
|
|
1372
|
+
(row) => row.description !== LUNAROUTE_ROW_DESCRIPTION || current.has(row.model)
|
|
1373
|
+
);
|
|
1374
|
+
const listed = new Set(kept.map((row) => row.model));
|
|
1375
|
+
return {
|
|
1376
|
+
...settings,
|
|
1377
|
+
modelPicker: {
|
|
1378
|
+
...prior,
|
|
1379
|
+
replaceBuiltInOptions: typeof prior.replaceBuiltInOptions === "boolean" ? prior.replaceBuiltInOptions : true,
|
|
1380
|
+
options: [...kept, ...rows(models).filter((row) => !listed.has(row.model))]
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1344
1385
|
// src/setup/adapters/claudeCode.ts
|
|
1345
1386
|
function buildPlan3(ctx) {
|
|
1346
1387
|
const firstModel = requireFirstModel(ctx, "claude-code");
|
|
@@ -1349,7 +1390,19 @@ function buildPlan3(ctx) {
|
|
|
1349
1390
|
const windowTokens = row?.context_window_tokens && row.context_window_tokens > 0 ? row.context_window_tokens : void 0;
|
|
1350
1391
|
const outputTokens = row?.max_output_tokens && row.max_output_tokens > 0 ? row.max_output_tokens : void 0;
|
|
1351
1392
|
return {
|
|
1352
|
-
|
|
1393
|
+
// The `/model` picker list. Claude Code reads `modelPicker` from user
|
|
1394
|
+
// settings, takes each row's `model` verbatim and applies no id filter —
|
|
1395
|
+
// the only way a routed (BYOK) model can appear, since discovery keeps only
|
|
1396
|
+
// ids containing "claude"/"anthropic" (kata 4sak) and the alias catalog
|
|
1397
|
+
// only knows rows with a stored `claude_alias` (kata qqs5). Merged, never
|
|
1398
|
+
// replaced: this file also holds the user's permissions, hooks and theme.
|
|
1399
|
+
fileWrites: [
|
|
1400
|
+
{
|
|
1401
|
+
kind: "json",
|
|
1402
|
+
path: claudeSettingsPath(),
|
|
1403
|
+
merge: (existing) => mergeClaudeModelPickerSettings(existing, ctx.models)
|
|
1404
|
+
}
|
|
1405
|
+
],
|
|
1353
1406
|
exports: [
|
|
1354
1407
|
{ name: ctx.keyEnvVar, value: "__KEY__" },
|
|
1355
1408
|
// Point at the routing root; Claude Code appends /v1/messages itself.
|
|
@@ -1411,7 +1464,8 @@ function buildPlan3(ctx) {
|
|
|
1411
1464
|
...windowTokens || outputTokens ? [
|
|
1412
1465
|
"CLAUDE_CODE_MAX_CONTEXT_TOKENS / CLAUDE_CODE_MAX_OUTPUT_TOKENS carry the pinned model's real window and output cap: Claude Code otherwise assumes 200K and asks for 32K whatever /v1/models reports. They describe ANTHROPIC_MODEL, not the Claude-shaped alias ids the /model picker lists (Claude Code ignores the window variable for those, and for any id it recognizes as a Claude model \u2014 those run at their built-in window), and one value serves the whole session \u2014 re-run setup when you switch to a model with a different window or output cap. Claude Code clamps the output value to its own maximum, and a bigger output cap leaves less context before compaction."
|
|
1413
1466
|
] : [],
|
|
1414
|
-
"ANTHROPIC_CUSTOM_HEADERS carries X-LunaRoute-Client: claude-desktop so the /model picker's gateway discovery returns Claude-shaped alias ids instead of an empty list: Claude Code drops any discovered id without 'claude'/'anthropic' in it, and LunaRoute's normal catalog has none. The aliases route back to the real model at the gateway \u2014 pick one in /model like any other, or set ANTHROPIC_MODEL to a plain model id to skip the aliases.",
|
|
1467
|
+
"ANTHROPIC_CUSTOM_HEADERS carries X-LunaRoute-Client: claude-desktop so the /model picker's gateway discovery returns Claude-shaped alias ids instead of an empty list: Claude Code drops any discovered id without 'claude'/'anthropic' in it, and LunaRoute's normal catalog has none. The aliases route back to the real model at the gateway \u2014 pick one in /model like any other, or set ANTHROPIC_MODEL to a plain model id to skip the aliases. This is the fallback for builds older than 2.1.242, which ignore the lineup below.",
|
|
1468
|
+
"~/.claude/settings.json now carries a modelPicker lineup of every model your org can reach (Claude Code 2.1.242+), so /model lists every one of them \u2014 routed/BYOK models included, not just the aliases (the row label is the model's display name where the catalog carries one). Any rows you already had are kept as they are; ours are added or removed on every run to match your catalog (a model that left it drops out of the picker; a row we added keeps its label). It replaces the discovered list; re-run setup, or use `lunaroute run claude` (which passes the same lineup for one session), when your catalog changes.",
|
|
1415
1469
|
"ANTHROPIC_DEFAULT_HAIKU_MODEL pins Claude Code's background model (titles, summaries, compaction, the auxiliary classifier) \u2014 it defaults to your main model, and you can point it at a smaller/faster model from the list above.",
|
|
1416
1470
|
"(Auth travels in the Authorization: Bearer header via ANTHROPIC_AUTH_TOKEN.)",
|
|
1417
1471
|
"CLAUDE_CODE_GATEWAY_HINT_HEADERS=1 makes Claude Code label its auxiliary requests (the auto-mode safety classifier) so LunaRoute can route them to a fast path; without it they are still detected via their wire marker, just less directly.",
|
|
@@ -1515,9 +1569,9 @@ function buildKeyPlan3(routingUrl, key2, appliedPath) {
|
|
|
1515
1569
|
`refusing to modify ${appliedPath}: it is valid JSON but not a JSON object.`
|
|
1516
1570
|
);
|
|
1517
1571
|
}
|
|
1518
|
-
const
|
|
1519
|
-
const existingHeaders = typeof
|
|
1520
|
-
return { ...
|
|
1572
|
+
const obj2 = existing;
|
|
1573
|
+
const existingHeaders = typeof obj2.inferenceCustomHeaders === "object" && obj2.inferenceCustomHeaders !== null && !Array.isArray(obj2.inferenceCustomHeaders) ? obj2.inferenceCustomHeaders : {};
|
|
1574
|
+
return { ...obj2, ...ours, inferenceCustomHeaders: { ...existingHeaders, ...ourHeaders } };
|
|
1521
1575
|
}
|
|
1522
1576
|
}
|
|
1523
1577
|
],
|
|
@@ -1644,14 +1698,14 @@ function buildPlan8(ctx) {
|
|
|
1644
1698
|
// quotes still refuse; widen it if a real openclaw.json needs it (kata tnhh).
|
|
1645
1699
|
jsonc: true,
|
|
1646
1700
|
merge: (existing) => {
|
|
1647
|
-
const
|
|
1648
|
-
const modelsCfg = asRecord(
|
|
1701
|
+
const obj2 = asRecord(existing);
|
|
1702
|
+
const modelsCfg = asRecord(obj2.models);
|
|
1649
1703
|
const providers = asRecord(modelsCfg.providers);
|
|
1650
|
-
const agents = asRecord(
|
|
1704
|
+
const agents = asRecord(obj2.agents);
|
|
1651
1705
|
const defaults = asRecord(agents.defaults);
|
|
1652
1706
|
const model = asRecord(defaults.model);
|
|
1653
1707
|
return {
|
|
1654
|
-
...
|
|
1708
|
+
...obj2,
|
|
1655
1709
|
models: {
|
|
1656
1710
|
...modelsCfg,
|
|
1657
1711
|
mode: modelsCfg.mode ?? "merge",
|
|
@@ -1898,11 +1952,11 @@ function buildPlan10(ctx) {
|
|
|
1898
1952
|
// Zed ships settings.json as JSONC (its template header is comments).
|
|
1899
1953
|
jsonc: true,
|
|
1900
1954
|
merge: (existing) => {
|
|
1901
|
-
const
|
|
1902
|
-
const languageModels = objectOrEmpty2(
|
|
1955
|
+
const obj2 = objectOrEmpty2(existing);
|
|
1956
|
+
const languageModels = objectOrEmpty2(obj2.language_models);
|
|
1903
1957
|
const openaiCompatible = objectOrEmpty2(languageModels.openai_compatible);
|
|
1904
1958
|
return {
|
|
1905
|
-
...
|
|
1959
|
+
...obj2,
|
|
1906
1960
|
language_models: {
|
|
1907
1961
|
...languageModels,
|
|
1908
1962
|
openai_compatible: { ...openaiCompatible, [PROVIDER_ID]: block }
|
|
@@ -2042,15 +2096,15 @@ function ensureSnapshotDir() {
|
|
|
2042
2096
|
}
|
|
2043
2097
|
function alreadyConfigured(existing, keys) {
|
|
2044
2098
|
if (typeof existing !== "object" || existing === null || Array.isArray(existing)) return false;
|
|
2045
|
-
const
|
|
2099
|
+
const obj2 = existing;
|
|
2046
2100
|
for (const [k, v] of Object.entries(keys)) {
|
|
2047
2101
|
if (k === "inferenceCustomHeaders") {
|
|
2048
2102
|
const ours = v["X-LunaRoute-Client"];
|
|
2049
|
-
const theirs =
|
|
2103
|
+
const theirs = obj2.inferenceCustomHeaders?.["X-LunaRoute-Client"];
|
|
2050
2104
|
if (theirs !== ours) return false;
|
|
2051
2105
|
continue;
|
|
2052
2106
|
}
|
|
2053
|
-
if (
|
|
2107
|
+
if (obj2[k] !== v) return false;
|
|
2054
2108
|
}
|
|
2055
2109
|
return true;
|
|
2056
2110
|
}
|
|
@@ -2131,7 +2185,7 @@ function restoreClaudeDesktopProfile(profilePath) {
|
|
|
2131
2185
|
var REVERSES = {
|
|
2132
2186
|
"claude-desktop": removeClaudeDesktop,
|
|
2133
2187
|
codex: removeCodex,
|
|
2134
|
-
"claude-code":
|
|
2188
|
+
"claude-code": removeClaudeCode,
|
|
2135
2189
|
agy: printOnlyRemove("agy"),
|
|
2136
2190
|
"copilot-cli": printOnlyRemove("copilot-cli"),
|
|
2137
2191
|
generic: printOnlyRemove("generic")
|
|
@@ -2257,6 +2311,13 @@ function printOnlyRemove(harness) {
|
|
|
2257
2311
|
return 0;
|
|
2258
2312
|
};
|
|
2259
2313
|
}
|
|
2314
|
+
async function removeClaudeCode() {
|
|
2315
|
+
console.log(
|
|
2316
|
+
`claude-code setup writes no shell configuration; it merged a modelPicker lineup into ${claudeSettingsPath()}. Delete the rows whose description is ${LUNAROUTE_ROW_DESCRIPTION} to restore your own /model list \u2014 any other row, and every other key in the file, is yours.`
|
|
2317
|
+
);
|
|
2318
|
+
for (const line of renderUnsetBlock(PRINTED_VARS["claude-code"] ?? [])) console.log(line);
|
|
2319
|
+
return 0;
|
|
2320
|
+
}
|
|
2260
2321
|
function isEnoent(err) {
|
|
2261
2322
|
return err?.code === "ENOENT";
|
|
2262
2323
|
}
|
|
@@ -3003,13 +3064,13 @@ async function runModels(profile, opts) {
|
|
|
3003
3064
|
}
|
|
3004
3065
|
|
|
3005
3066
|
// src/render.ts
|
|
3006
|
-
function renderTable(headers,
|
|
3007
|
-
const all = [headers, ...
|
|
3067
|
+
function renderTable(headers, rows2) {
|
|
3068
|
+
const all = [headers, ...rows2];
|
|
3008
3069
|
const widths = headers.map(
|
|
3009
3070
|
(_, col) => Math.max(...all.map((r) => (r[col] ?? "").length))
|
|
3010
3071
|
);
|
|
3011
3072
|
const fmt = (r) => r.map((cell, col) => col === r.length - 1 ? cell : (cell ?? "").padEnd(widths[col])).join(" ").replace(/\s+$/, "");
|
|
3012
|
-
return [headers, ...
|
|
3073
|
+
return [headers, ...rows2].map(fmt).join("\n");
|
|
3013
3074
|
}
|
|
3014
3075
|
|
|
3015
3076
|
// src/commands/pricing.ts
|
|
@@ -3019,25 +3080,25 @@ async function runPricing(profile, opts) {
|
|
|
3019
3080
|
console.error('Not logged in. Run "lunaroute login" first.');
|
|
3020
3081
|
return 1;
|
|
3021
3082
|
}
|
|
3022
|
-
let
|
|
3083
|
+
let rows2;
|
|
3023
3084
|
try {
|
|
3024
|
-
|
|
3085
|
+
rows2 = await getPricing({ apiUrl: s.api_url, apiKey: s.routing_key }, opts.model);
|
|
3025
3086
|
} catch (err) {
|
|
3026
3087
|
console.error(err instanceof Error ? err.message : String(err));
|
|
3027
3088
|
return 1;
|
|
3028
3089
|
}
|
|
3029
3090
|
if (opts.json) {
|
|
3030
|
-
console.log(JSON.stringify(
|
|
3091
|
+
console.log(JSON.stringify(rows2, null, 2));
|
|
3031
3092
|
return 0;
|
|
3032
3093
|
}
|
|
3033
|
-
if (
|
|
3094
|
+
if (rows2.length === 0) {
|
|
3034
3095
|
console.log("// no models enabled for your org yet \u2014 contact hello@lunaroute.com to get models enabled");
|
|
3035
3096
|
return 0;
|
|
3036
3097
|
}
|
|
3037
3098
|
const cell = (n) => n === void 0 ? "\u2014" : String(n);
|
|
3038
3099
|
const table = renderTable(
|
|
3039
3100
|
["MODEL", "INPUT (cr/M)", "OUTPUT (cr/M)", "CACHED (cr/M)"],
|
|
3040
|
-
|
|
3101
|
+
rows2.map(
|
|
3041
3102
|
(r) => r.priced ? [r.model, cell(r.input_credits_per_million), cell(r.output_credits_per_million), cell(r.cached_input_credits_per_million)] : [r.model, "\u2014", "\u2014", "\u2014"]
|
|
3042
3103
|
)
|
|
3043
3104
|
);
|
|
@@ -3442,9 +3503,9 @@ function buildSkillPlan(opts) {
|
|
|
3442
3503
|
if (opts.profile !== "default") args.push("--profile", opts.profile);
|
|
3443
3504
|
const entry = { type: "stdio", command: "npx", args };
|
|
3444
3505
|
const mergeMcp = (existing) => {
|
|
3445
|
-
const
|
|
3446
|
-
const servers = typeof
|
|
3447
|
-
return { ...
|
|
3506
|
+
const obj2 = existing ?? {};
|
|
3507
|
+
const servers = typeof obj2.mcpServers === "object" && obj2.mcpServers !== null ? obj2.mcpServers : {};
|
|
3508
|
+
return { ...obj2, mcpServers: { ...servers, [LUNAROUTE_SKILL_NAME]: entry } };
|
|
3448
3509
|
};
|
|
3449
3510
|
const skillPath = opts.project ? claudeProjectSkillPath(opts.root) : claudeUserSkillPath();
|
|
3450
3511
|
const mcpPath = opts.project ? claudeProjectMcpPath(opts.root) : claudeUserConfigPath();
|
|
@@ -3501,7 +3562,13 @@ function buildRunSpec(ctx) {
|
|
|
3501
3562
|
const outputTokens = ctx.maxOutputTokens && ctx.maxOutputTokens > 0 ? ctx.maxOutputTokens : void 0;
|
|
3502
3563
|
return {
|
|
3503
3564
|
command: "claude",
|
|
3504
|
-
|
|
3565
|
+
// The `/model` lineup, passed inline so this one-session path writes nothing
|
|
3566
|
+
// to disk. Rows are taken verbatim, so canonical ids list as-is — including
|
|
3567
|
+
// routed/BYOK models, which discovery can never show (kata qqs5). `--settings`
|
|
3568
|
+
// supplies only the keys it sets; the user's own settings still apply, and a
|
|
3569
|
+
// build older than 2.1.242 simply ignores the key and keeps the aliases
|
|
3570
|
+
// below. Needs the catalog, so it is skipped when that lookup failed.
|
|
3571
|
+
args: ctx.models?.length ? ["--settings", JSON.stringify({ modelPicker: claudeModelPicker(ctx.models) })] : [],
|
|
3505
3572
|
env: {
|
|
3506
3573
|
ANTHROPIC_BASE_URL: ctx.routingUrl,
|
|
3507
3574
|
ANTHROPIC_AUTH_TOKEN: ctx.apiKey,
|
|
@@ -3516,6 +3583,7 @@ function buildRunSpec(ctx) {
|
|
|
3516
3583
|
ANTHROPIC_DEFAULT_HAIKU_MODEL: ctx.model,
|
|
3517
3584
|
// Populates the /model picker from GET /v1/models at startup. LunaRoute
|
|
3518
3585
|
// already serves the Anthropic-native shape (spike-verified, kata nkey).
|
|
3586
|
+
// Kept for builds older than 2.1.242, which ignore the --settings lineup.
|
|
3519
3587
|
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY: "1",
|
|
3520
3588
|
// Claude Code keeps only discovered ids containing "claude"/"anthropic"
|
|
3521
3589
|
// (kata 4sak). The normal catalog has no such id, so discovery would
|
|
@@ -3760,7 +3828,8 @@ async function runRun(harness, opts, deps = realDeps) {
|
|
|
3760
3828
|
apiKey: creds.routing_key,
|
|
3761
3829
|
model,
|
|
3762
3830
|
contextWindow: row?.context_window_tokens,
|
|
3763
|
-
maxOutputTokens: row?.max_output_tokens
|
|
3831
|
+
maxOutputTokens: row?.max_output_tokens,
|
|
3832
|
+
models
|
|
3764
3833
|
});
|
|
3765
3834
|
if (spec.notice) console.error(spec.notice);
|
|
3766
3835
|
const args = spec.args.concat(opts.passthrough ?? []);
|