@weave-os/router 0.2.14 → 0.2.16
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/cc-statusline.sh +18 -11
- package/install.sh +200 -96
- package/package.json +1 -1
- package/pi-router/src/pricing.generated.ts +7 -6
package/cc-statusline.sh
CHANGED
|
@@ -234,8 +234,12 @@ weave_sync_commands() {
|
|
|
234
234
|
# be recovered those three are skipped rather than rewritten to point at the
|
|
235
235
|
# user-scope install.
|
|
236
236
|
local scope_args="" scope_known="false" off="$cmd_dir/router-off.md"
|
|
237
|
+
# Backticks are literal Markdown delimiters.
|
|
238
|
+
# shellcheck disable=SC2016
|
|
237
239
|
if [ -f "$off" ] && grep -Eq '^`npx @(workweave/router|weave-os/router) off --claude.*`$' "$off" 2>/dev/null; then
|
|
238
240
|
scope_known="true"
|
|
241
|
+
# Backticks are literal Markdown delimiters.
|
|
242
|
+
# shellcheck disable=SC2016
|
|
239
243
|
scope_args="$(sed -En 's#^`npx @(workweave/router|weave-os/router) off --claude(.*)`$#\2#p' "$off" | head -n 1)"
|
|
240
244
|
fi
|
|
241
245
|
|
|
@@ -274,7 +278,7 @@ weave_sync_commands() {
|
|
|
274
278
|
if [ -f "$prev" ]; then
|
|
275
279
|
new_body="$(weave_render_command "$raw" "$scope_args")"
|
|
276
280
|
prev_body="$(weave_render_command "$prev" "$scope_args")"
|
|
277
|
-
installed_body="$(
|
|
281
|
+
installed_body="$(sed '/^<!-- weave-router managed command: .* -->$/d' "$installed" 2>/dev/null)" || installed_body=""
|
|
278
282
|
if [ "$prev_body" = "$installed_body" ] && [ "$new_body" != "$installed_body" ]; then
|
|
279
283
|
tmp="$installed.tmp.$$"
|
|
280
284
|
if printf '%s\n<!-- weave-router managed command: %s -->' "$new_body" "$name" >"$tmp" 2>/dev/null; then
|
|
@@ -505,11 +509,12 @@ prices='{
|
|
|
505
509
|
"gpt-5.5-mini": 0.0005,
|
|
506
510
|
"gpt-5.5-nano": 0.00015,
|
|
507
511
|
"gpt-5.5-pro": 0.03,
|
|
508
|
-
"gpt-5.6-luna": 0.
|
|
509
|
-
"gpt-5.6-luna-pro": 0.
|
|
510
|
-
"gpt-5.6-sol": 0.
|
|
511
|
-
"gpt-5.6-sol-pro": 0.
|
|
512
|
-
"gpt-5.6-terra": 0.
|
|
512
|
+
"gpt-5.6-luna": 0.0002,
|
|
513
|
+
"gpt-5.6-luna-pro": 0.0002,
|
|
514
|
+
"gpt-5.6-sol": 0.004,
|
|
515
|
+
"gpt-5.6-sol-pro": 0.004,
|
|
516
|
+
"gpt-5.6-terra": 0.002,
|
|
517
|
+
"gpt-6-astra": 0.01,
|
|
513
518
|
"grok-4.5": 0.002,
|
|
514
519
|
"grok-4.6": 0.002,
|
|
515
520
|
"minimax/minimax-m2.7": 0.0003,
|
|
@@ -585,11 +590,12 @@ prices='{
|
|
|
585
590
|
"gpt-5.5-mini": 0.0025,
|
|
586
591
|
"gpt-5.5-nano": 0.0006,
|
|
587
592
|
"gpt-5.5-pro": 0.18,
|
|
588
|
-
"gpt-5.6-luna": 0.
|
|
589
|
-
"gpt-5.6-luna-pro": 0.
|
|
590
|
-
"gpt-5.6-sol": 0.
|
|
591
|
-
"gpt-5.6-sol-pro": 0.
|
|
592
|
-
"gpt-5.6-terra": 0.
|
|
593
|
+
"gpt-5.6-luna": 0.0012,
|
|
594
|
+
"gpt-5.6-luna-pro": 0.0012,
|
|
595
|
+
"gpt-5.6-sol": 0.02,
|
|
596
|
+
"gpt-5.6-sol-pro": 0.02,
|
|
597
|
+
"gpt-5.6-terra": 0.012,
|
|
598
|
+
"gpt-6-astra": 0.05,
|
|
593
599
|
"grok-4.5": 0.006,
|
|
594
600
|
"grok-4.6": 0.006,
|
|
595
601
|
"minimax/minimax-m2.7": 0.0012,
|
|
@@ -670,6 +676,7 @@ prices='{
|
|
|
670
676
|
"gpt-5.6-sol": 0.1,
|
|
671
677
|
"gpt-5.6-sol-pro": 0.1,
|
|
672
678
|
"gpt-5.6-terra": 0.1,
|
|
679
|
+
"gpt-6-astra": 0.1,
|
|
673
680
|
"grok-4.5": 0.25,
|
|
674
681
|
"grok-4.6": 0.25,
|
|
675
682
|
"minimax/minimax-m2.7": 0.2,
|
package/install.sh
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# opencode.json — since the file is JSON, install/uninstall are structural
|
|
13
13
|
# (jq) rather than marker-delimited. For pi it merges a `weave` provider into
|
|
14
14
|
# ~/.pi/agent/models.json, sets it as the default in settings.json, and adds
|
|
15
|
-
# the @
|
|
15
|
+
# the @weave-os/router extension (which also adds a parallel subagent
|
|
16
16
|
# `dispatch` tool) — all structural (jq) merges.
|
|
17
17
|
#
|
|
18
18
|
# Two scopes (apply to all targets):
|
|
@@ -32,42 +32,42 @@
|
|
|
32
32
|
# <dir>/.pi/ (run: PI_CODING_AGENT_DIR=<dir>/.pi pi) (with --pi)
|
|
33
33
|
#
|
|
34
34
|
# Usage:
|
|
35
|
-
# npx @
|
|
36
|
-
# npx @
|
|
37
|
-
# npx @
|
|
38
|
-
# npx @
|
|
39
|
-
# npx @
|
|
40
|
-
# npx @
|
|
41
|
-
# npx @
|
|
42
|
-
# npx @
|
|
43
|
-
# npx @
|
|
44
|
-
# npx @
|
|
45
|
-
# npx @
|
|
35
|
+
# npx @weave-os/router # interactive picker (Claude Code, Codex, opencode)
|
|
36
|
+
# npx @weave-os/router --claude # skip the picker, target Claude Code
|
|
37
|
+
# npx @weave-os/router --codex # skip the picker, target Codex
|
|
38
|
+
# npx @weave-os/router setup --claude --codex # configure both native clients
|
|
39
|
+
# npx @weave-os/router login claude # enroll Claude Pro/Max
|
|
40
|
+
# npx @weave-os/router login codex # enroll ChatGPT Pro/Plus
|
|
41
|
+
# npx @weave-os/router accounts list # inspect enrolled accounts
|
|
42
|
+
# npx @weave-os/router status # router + native client status
|
|
43
|
+
# npx @weave-os/router --opencode # skip the picker, target opencode
|
|
44
|
+
# npx @weave-os/router --pi # skip the picker, target pi
|
|
45
|
+
# npx @weave-os/router --pi --lsp go,typescript # also install language servers for pi's lsp tool
|
|
46
46
|
# (go/typescript/python/rust; needs that language's toolchain)
|
|
47
|
-
# npx @
|
|
48
|
-
# npx @
|
|
49
|
-
# npx @
|
|
50
|
-
# npx @
|
|
51
|
-
# npx @
|
|
52
|
-
# npx @
|
|
53
|
-
# npx @
|
|
54
|
-
# npx @
|
|
47
|
+
# npx @weave-os/router --scope project # commit-with-team install
|
|
48
|
+
# npx @weave-os/router --dir /tmp/my-sandbox # isolated throwaway install
|
|
49
|
+
# npx @weave-os/router --local # local router on localhost:8080
|
|
50
|
+
# npx @weave-os/router --base-url http://localhost:8080 # self-hosted, custom port
|
|
51
|
+
# npx @weave-os/router --non-interactive # require WEAVE_ROUTER_KEY env var (defaults target to claude)
|
|
52
|
+
# npx @weave-os/router --quiet # suppress banner, ping check, and trailing tips
|
|
53
|
+
# npx @weave-os/router --rotate-key # ignore the installed key and prompt for a new one
|
|
54
|
+
# npx @weave-os/router --uninstall # remove a previous install (delegates to uninstall.sh)
|
|
55
55
|
#
|
|
56
56
|
# Re-running the installer reuses the key already on disk, so you only paste it
|
|
57
57
|
# once — for every client, not just Claude Code. `update` is the scriptable form
|
|
58
58
|
# of that: it never prompts, refreshes the managed config + assets in place, and
|
|
59
59
|
# errors (rather than asking) when no key can be found:
|
|
60
|
-
# npx @
|
|
61
|
-
# npx @
|
|
60
|
+
# npx @weave-os/router update --claude # refresh the Claude Code install in place
|
|
61
|
+
# npx @weave-os/router update --codex # same for Codex / opencode / pi
|
|
62
62
|
#
|
|
63
63
|
# Toggle an existing install on/off without losing the router config (so
|
|
64
64
|
# switching back is instant). These never prompt for a key and require an
|
|
65
65
|
# explicit client (--claude / --codex / --opencode); they only flip config
|
|
66
66
|
# that install.sh already wrote:
|
|
67
|
-
# npx @
|
|
68
|
-
# npx @
|
|
69
|
-
# npx @
|
|
70
|
-
# npx @
|
|
67
|
+
# npx @weave-os/router off --claude # route directly to Anthropic again (Claude Code)
|
|
68
|
+
# npx @weave-os/router on --codex # route through the Weave Router again (Codex)
|
|
69
|
+
# npx @weave-os/router status --opencode # report whether opencode is on the router or direct
|
|
70
|
+
# npx @weave-os/router disable-routing # Codex shortcut: use Codex's normal provider again
|
|
71
71
|
# Claude Code reads env at launch, so an off/on takes effect on the next
|
|
72
72
|
# `claude` start; Codex and opencode re-read config every invocation.
|
|
73
73
|
# Cursor's base URL lives in its own settings UI (no file we own), so there's
|
|
@@ -83,13 +83,13 @@
|
|
|
83
83
|
# the same lists the router dashboard's settings page renders. The endpoint and
|
|
84
84
|
# router key both come from the install already on disk, so nothing is prompted
|
|
85
85
|
# and no key is ever passed on the command line:
|
|
86
|
-
# npx @
|
|
87
|
-
# npx @
|
|
88
|
-
# npx @
|
|
89
|
-
# npx @
|
|
90
|
-
# npx @
|
|
91
|
-
# npx @
|
|
92
|
-
# npx @
|
|
86
|
+
# npx @weave-os/router models --claude # every model, with its on/off state
|
|
87
|
+
# npx @weave-os/router models disable gpt-5.6 --claude # take a model out of rotation
|
|
88
|
+
# npx @weave-os/router models enable gpt-5.6 --claude # put it back
|
|
89
|
+
# npx @weave-os/router models providers --claude # same, one row per provider
|
|
90
|
+
# npx @weave-os/router models providers disable openai --claude # drop a whole provider
|
|
91
|
+
# npx @weave-os/router models prefer claude-opus-5 --claude # set the preferred-model ranking
|
|
92
|
+
# npx @weave-os/router models list --json --claude # machine-readable, for scripts
|
|
93
93
|
# Editing needs a router that mounts the model-selection API (self-hosted and
|
|
94
94
|
# local routers do). The Weave-hosted router keeps model selection with the
|
|
95
95
|
# organization, in the Weave dashboard — there `models` lists and points you at
|
|
@@ -103,8 +103,9 @@ set -euo pipefail
|
|
|
103
103
|
HOSTED_BASE_URL="https://router.workweave.ai"
|
|
104
104
|
DEFAULT_BASE_URL="${WEAVE_ROUTER_URL:-$HOSTED_BASE_URL}"
|
|
105
105
|
# npm package name is supplied by the Node wrapper; direct shell installs keep
|
|
106
|
-
# the
|
|
107
|
-
|
|
106
|
+
# the current package name; WEAVE_ROUTER_NPM_PACKAGE remains an escape hatch for
|
|
107
|
+
# compatibility with wrappers that explicitly select another package.
|
|
108
|
+
npm_package_name="${WEAVE_ROUTER_NPM_PACKAGE:-@weave-os/router}"
|
|
108
109
|
|
|
109
110
|
|
|
110
111
|
scope="user"
|
|
@@ -195,7 +196,7 @@ skip() { printf "%s⊙%s %s%s%s\n" "$C_DIM" "$C_RESET" "$C_DIM" "$*" "$C_RESET";
|
|
|
195
196
|
# uninstall.sh's flag surface.
|
|
196
197
|
uninstall_cmd() {
|
|
197
198
|
# --package + `--` is load-bearing: npm <= 6's bundled npx treats an
|
|
198
|
-
# undeclared `-y` as consuming the NEXT token, so `npx -y @
|
|
199
|
+
# undeclared `-y` as consuming the NEXT token, so `npx -y @weave-os/router`
|
|
199
200
|
# loses the package name and resolves whatever follows as the command.
|
|
200
201
|
local cmd="npx --package $npm_package_name -y -- weave-router --uninstall"
|
|
201
202
|
case "$target" in
|
|
@@ -264,7 +265,9 @@ _spin_cleanup() {
|
|
|
264
265
|
if [ "$tty_out" = "true" ]; then
|
|
265
266
|
printf '\033[?25h' # show cursor
|
|
266
267
|
fi
|
|
267
|
-
[ -n "$spin_log" ]
|
|
268
|
+
if [ -n "$spin_log" ]; then
|
|
269
|
+
rm -f "$spin_log" 2>/dev/null || true
|
|
270
|
+
fi
|
|
268
271
|
# Also restore stty echo in case we died mid-keypaste prompt. macOS
|
|
269
272
|
# `[ -r /dev/tty ]` returns true even when the underlying device errors
|
|
270
273
|
# on open (ENXIO "Device not configured") under `curl | sh` and CI, so
|
|
@@ -842,7 +845,7 @@ write_opencode_config() {
|
|
|
842
845
|
# write_pi_models_config merges a managed `weave` provider into pi's
|
|
843
846
|
# models.json (anthropic-compatible — the router speaks Anthropic Messages
|
|
844
847
|
# natively). The header set carries identity plus the main-loop routing knobs
|
|
845
|
-
# (quality bias); the @
|
|
848
|
+
# (quality bias); the @weave-os/router extension re-registers the provider
|
|
846
849
|
# per process to flip those knobs for subagents/compaction. apiKey is the
|
|
847
850
|
# router key as well as a header — pi treats apiKey as required to consider auth
|
|
848
851
|
# configured, but the router authenticates off X-Weave-Router-Key
|
|
@@ -879,7 +882,7 @@ write_pi_models_config() {
|
|
|
879
882
|
|
|
880
883
|
# Headline models surfaced in pi's /model picker. The router re-routes every
|
|
881
884
|
# request regardless, so this list is UX; keep it Anthropic-shaped and in
|
|
882
|
-
# sync with @
|
|
885
|
+
# sync with @weave-os/router's WEAVE_MODELS constant.
|
|
883
886
|
#
|
|
884
887
|
# baseUrl is the router ROOT (no /v1): pi's anthropic-messages provider uses
|
|
885
888
|
# @anthropic-ai/sdk, which appends /v1/messages itself. Unlike the codex block
|
|
@@ -903,6 +906,7 @@ write_pi_models_config() {
|
|
|
903
906
|
{ id: "claude-opus-4-7", name: "Claude Opus 4.7 (via Weave Router)", reasoning: true, input: ["text","image"], contextWindow: 1000000, maxTokens: 64000 },
|
|
904
907
|
{ id: "claude-sonnet-4-6", name: "Claude Sonnet 4.6 (via Weave Router)", reasoning: true, input: ["text","image"], contextWindow: 1000000, maxTokens: 64000 },
|
|
905
908
|
{ id: "claude-haiku-4-5", name: "Claude Haiku 4.5 (via Weave Router)", reasoning: true, input: ["text","image"], contextWindow: 200000, maxTokens: 32000 },
|
|
909
|
+
{ id: "gpt-6-astra", name: "GPT-6 Astra (via Weave Router)", reasoning: true, input: ["text","image"], contextWindow: 1050000, maxTokens: 128000 },
|
|
906
910
|
{ id: "gpt-5.6-sol", name: "GPT-5.6 Sol (via Weave Router)", reasoning: true, input: ["text","image"], contextWindow: 1050000, maxTokens: 128000 },
|
|
907
911
|
{ id: "grok-4.5", name: "Grok 4.5 (via Weave Router)", reasoning: true, input: ["text","image"], contextWindow: 500000, maxTokens: 131072 },
|
|
908
912
|
{ id: "grok-4.6", name: "Grok 4.6 (via Weave Router)", reasoning: true, input: ["text","image"], contextWindow: 500000, maxTokens: 131072 }
|
|
@@ -1049,7 +1053,7 @@ resolve_user_name() {
|
|
|
1049
1053
|
# canonical uninstall logic lives in a sibling file, and we want both
|
|
1050
1054
|
# direct invocations (`./install.sh --uninstall`) and curl-piped ones
|
|
1051
1055
|
# (`curl ... | sh -s -- --uninstall`) to behave the same as
|
|
1052
|
-
# `npx @
|
|
1056
|
+
# `npx @weave-os/router --uninstall` (which bin.js routes to uninstall.sh on
|
|
1053
1057
|
# its own).
|
|
1054
1058
|
#
|
|
1055
1059
|
# Scan every arg, not just $1, so flag order doesn't matter; build a clean
|
|
@@ -1355,6 +1359,8 @@ if [ -z "$install_dir" ] && [ "$scope_explicit" = "false" ] && [ "$non_interacti
|
|
|
1355
1359
|
# Per-target paths so the prompt text matches what actually gets written.
|
|
1356
1360
|
case "$target" in
|
|
1357
1361
|
codex)
|
|
1362
|
+
# This path is display text, not an expansion target.
|
|
1363
|
+
# shellcheck disable=SC2088
|
|
1358
1364
|
scope_user_path="~/.codex/"
|
|
1359
1365
|
scope_project_path="<repo>/.codex/"
|
|
1360
1366
|
scope_cli_label="codex"
|
|
@@ -1367,17 +1373,23 @@ if [ -z "$install_dir" ] && [ "$scope_explicit" = "false" ] && [ "$non_interacti
|
|
|
1367
1373
|
if [ -n "${XDG_CONFIG_HOME:-}" ]; then
|
|
1368
1374
|
scope_user_path="$XDG_CONFIG_HOME/opencode/"
|
|
1369
1375
|
else
|
|
1376
|
+
# This path is display text, not an expansion target.
|
|
1377
|
+
# shellcheck disable=SC2088
|
|
1370
1378
|
scope_user_path="~/.config/opencode/"
|
|
1371
1379
|
fi
|
|
1372
1380
|
scope_project_path="<repo>/opencode.json"
|
|
1373
1381
|
scope_cli_label="opencode"
|
|
1374
1382
|
;;
|
|
1375
1383
|
pi)
|
|
1384
|
+
# This path is display text, not an expansion target.
|
|
1385
|
+
# shellcheck disable=SC2088
|
|
1376
1386
|
scope_user_path="~/.pi/agent/"
|
|
1377
1387
|
scope_project_path="<repo>/.pi/"
|
|
1378
1388
|
scope_cli_label="pi"
|
|
1379
1389
|
;;
|
|
1380
1390
|
*)
|
|
1391
|
+
# This path is display text, not an expansion target.
|
|
1392
|
+
# shellcheck disable=SC2088
|
|
1381
1393
|
scope_user_path="~/.claude/"
|
|
1382
1394
|
scope_project_path="<repo>/.claude/"
|
|
1383
1395
|
scope_cli_label="claude"
|
|
@@ -1403,6 +1415,8 @@ if [ -z "$install_dir" ] && [ "$scope_explicit" = "false" ] && [ "$non_interacti
|
|
|
1403
1415
|
read -r project_dir_choice </dev/tty || project_dir_choice=""
|
|
1404
1416
|
project_dir="${project_dir_choice:-$default_project_dir}"
|
|
1405
1417
|
# Expand a leading ~ since `read` doesn't.
|
|
1418
|
+
# The pattern intentionally matches a literal tilde.
|
|
1419
|
+
# shellcheck disable=SC2088
|
|
1406
1420
|
case "$project_dir" in
|
|
1407
1421
|
"~") project_dir="$HOME" ;;
|
|
1408
1422
|
"~/"*) project_dir="$HOME/${project_dir#~/}" ;;
|
|
@@ -1475,7 +1489,9 @@ case "$target" in
|
|
|
1475
1489
|
esac
|
|
1476
1490
|
fi
|
|
1477
1491
|
|
|
1478
|
-
script_dir="$(cd "$(dirname "$0")" 2>/dev/null && pwd
|
|
1492
|
+
if ! script_dir="$(cd "$(dirname "$0")" 2>/dev/null && pwd)"; then
|
|
1493
|
+
script_dir=""
|
|
1494
|
+
fi
|
|
1479
1495
|
|
|
1480
1496
|
# ---------- directive registry (embedded) ----------
|
|
1481
1497
|
#
|
|
@@ -1605,7 +1621,9 @@ else
|
|
|
1605
1621
|
# preserved for --scope project passed on the command line).
|
|
1606
1622
|
if [ -n "${project_dir:-}" ]; then
|
|
1607
1623
|
settings_base="$project_dir"
|
|
1608
|
-
git_root="$(cd "$project_dir" && git rev-parse --show-toplevel 2>/dev/null
|
|
1624
|
+
if ! git_root="$(cd "$project_dir" && git rev-parse --show-toplevel 2>/dev/null)"; then
|
|
1625
|
+
git_root=""
|
|
1626
|
+
fi
|
|
1609
1627
|
else
|
|
1610
1628
|
if ! git_root="$(git rev-parse --show-toplevel 2>/dev/null)"; then
|
|
1611
1629
|
err "--scope project must be run inside a git repo, or pass --dir <path>. cd into your project first, or use --dir."
|
|
@@ -1767,6 +1785,17 @@ json_get() {
|
|
|
1767
1785
|
jq -r "${2} // empty" "$1" 2>/dev/null || true
|
|
1768
1786
|
}
|
|
1769
1787
|
|
|
1788
|
+
# strip_trailing_slashes removes every trailing slash from a URL while keeping
|
|
1789
|
+
# comparisons between config files stable when a value was written with more
|
|
1790
|
+
# than one separator.
|
|
1791
|
+
strip_trailing_slashes() {
|
|
1792
|
+
local value="$1"
|
|
1793
|
+
while [ "${value%/}" != "$value" ]; do
|
|
1794
|
+
value="${value%/}"
|
|
1795
|
+
done
|
|
1796
|
+
printf '%s' "$value"
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1770
1799
|
# read_claude_key prints the router key already installed in the given settings
|
|
1771
1800
|
# file, or nothing when the file is absent / carries no key header. Claude Code
|
|
1772
1801
|
# packs several headers into one newline-delimited ANTHROPIC_CUSTOM_HEADERS
|
|
@@ -1842,7 +1871,7 @@ read_opencode_key() {
|
|
|
1842
1871
|
}
|
|
1843
1872
|
|
|
1844
1873
|
# read_pi_key prints the router key this pi install already has. The dedicated
|
|
1845
|
-
# key file comes first — it is what the @
|
|
1874
|
+
# key file comes first — it is what the @weave-os/router extension itself reads
|
|
1846
1875
|
# at runtime — and models.json is the fallback for an install whose key file was
|
|
1847
1876
|
# removed by hand.
|
|
1848
1877
|
read_pi_key() {
|
|
@@ -1937,6 +1966,41 @@ resolve_installed_base_url() {
|
|
|
1937
1966
|
printf ''
|
|
1938
1967
|
}
|
|
1939
1968
|
|
|
1969
|
+
# resolve_installed_base_source prints the file that supplied the expected
|
|
1970
|
+
# Claude Code endpoint, or nothing when no file matches. Keeping the source
|
|
1971
|
+
# alongside the endpoint lets update apply the same provenance check as models
|
|
1972
|
+
# before it sends the installed key to that endpoint.
|
|
1973
|
+
resolve_installed_base_source() {
|
|
1974
|
+
local expected="$1" normalized_expected candidate found normalized_found
|
|
1975
|
+
normalized_expected="$(strip_trailing_slashes "$expected")"
|
|
1976
|
+
while IFS= read -r candidate; do
|
|
1977
|
+
[ -n "$candidate" ] || continue
|
|
1978
|
+
found="$(json_get "$candidate" '.env.ANTHROPIC_BASE_URL')"
|
|
1979
|
+
normalized_found="$(strip_trailing_slashes "$found")"
|
|
1980
|
+
if [ "$normalized_found" = "$normalized_expected" ]; then
|
|
1981
|
+
printf '%s' "$candidate"
|
|
1982
|
+
return 0
|
|
1983
|
+
fi
|
|
1984
|
+
done <<<"$(models_base_file_order)"
|
|
1985
|
+
printf ''
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
# resolve_installed_key_source prints the file that supplied the installed
|
|
1989
|
+
# Claude Code key, or nothing when the key came from the environment or is
|
|
1990
|
+
# absent. The update trust gate uses this to distinguish the normal project
|
|
1991
|
+
# split from a repo-planted endpoint.
|
|
1992
|
+
resolve_installed_key_source() {
|
|
1993
|
+
local candidate
|
|
1994
|
+
while IFS= read -r candidate; do
|
|
1995
|
+
[ -n "$candidate" ] || continue
|
|
1996
|
+
if [ -n "$(read_claude_key "$candidate")" ]; then
|
|
1997
|
+
printf '%s' "$candidate"
|
|
1998
|
+
return 0
|
|
1999
|
+
fi
|
|
2000
|
+
done <<<"$(models_key_file_order)"
|
|
2001
|
+
printf ''
|
|
2002
|
+
}
|
|
2003
|
+
|
|
1940
2004
|
# resolve_installed_endpoint prints the router endpoint this install already
|
|
1941
2005
|
# points at, for whichever client is being installed, or nothing. `update` uses
|
|
1942
2006
|
# it so a refresh never silently retargets a self-hosted install at the hosted
|
|
@@ -1998,20 +2062,25 @@ resolve_installed_endpoint() {
|
|
|
1998
2062
|
# hosted default, or an explicit --base-url — rather than whatever the checkout
|
|
1999
2063
|
# happened to contain.
|
|
2000
2064
|
models_endpoint_is_trusted() {
|
|
2001
|
-
local url="$1" base_src="$2" key_src="$3"
|
|
2065
|
+
local url="$1" base_src="$2" key_src="$3" normalized_url normalized_marked_url
|
|
2066
|
+
normalized_url="$(strip_trailing_slashes "$url")"
|
|
2002
2067
|
[ "$base_url_explicit" = "true" ] && return 0
|
|
2003
|
-
[ "$
|
|
2068
|
+
[ "$normalized_url" = "$(strip_trailing_slashes "$HOSTED_BASE_URL")" ] && return 0
|
|
2004
2069
|
[ -n "$base_src" ] && [ "$base_src" = "$key_src" ] && return 0
|
|
2005
2070
|
# Project-scoped self-hosted installs intentionally split the endpoint and
|
|
2006
2071
|
# key. The installer writes a gitignored marker beside the key; require that
|
|
2007
2072
|
# marker to match before trusting the split. A tracked/symlinked local file is
|
|
2008
2073
|
# not a teammate's private configuration and cannot vouch for an endpoint.
|
|
2009
|
-
|
|
2074
|
+
# The marker vouches for the endpoint independently of whether this run uses
|
|
2075
|
+
# the key from disk or a replacement supplied through WEAVE_ROUTER_KEY.
|
|
2076
|
+
if [ "$target" = "claude" ] && [ -n "$local_settings_file" ] \
|
|
2077
|
+
&& [ ! -L "$local_settings_file" ]; then
|
|
2010
2078
|
local marked_url
|
|
2011
|
-
marked_url="$(json_get "$
|
|
2012
|
-
|
|
2079
|
+
marked_url="$(json_get "$local_settings_file" '.env.WEAVE_ROUTER_BASE_URL')"
|
|
2080
|
+
normalized_marked_url="$(strip_trailing_slashes "$marked_url")"
|
|
2081
|
+
if [ "$normalized_marked_url" = "$normalized_url" ]; then
|
|
2013
2082
|
command -v git >/dev/null 2>&1 || return 1
|
|
2014
|
-
git -C "$(dirname "$
|
|
2083
|
+
git -C "$(dirname "$local_settings_file")" ls-files --error-unmatch -- "$local_settings_file" >/dev/null 2>&1 && return 1
|
|
2015
2084
|
return 0
|
|
2016
2085
|
fi
|
|
2017
2086
|
fi
|
|
@@ -2751,7 +2820,10 @@ run_login_claude() {
|
|
|
2751
2820
|
authorize_endpoint="${WEAVE_ANTHROPIC_OAUTH_AUTHORIZE:-https://claude.ai/oauth/authorize}"
|
|
2752
2821
|
authorize_url="$authorize_endpoint?code=true&client_id=9d1c250a-e61b-44d9-88ed-5944d1962f5e&response_type=code&redirect_uri=$(jq -nr '"https://console.anthropic.com/oauth/code/callback"|@uri')&scope=$(jq -nr '"org:create_api_key user:profile user:inference"|@uri')&code_challenge=$challenge&code_challenge_method=S256&state=$expected_state"
|
|
2753
2822
|
open_oauth_url "$authorize_url"
|
|
2754
|
-
[ "$non_interactive"
|
|
2823
|
+
if [ "$non_interactive" = "true" ] || [ ! -r /dev/tty ]; then
|
|
2824
|
+
err "Claude login requires an interactive terminal to paste the authorization code."
|
|
2825
|
+
exit 1
|
|
2826
|
+
fi
|
|
2755
2827
|
printf 'Paste the Claude authorization code: ' >/dev/tty
|
|
2756
2828
|
read -r pasted_code </dev/tty
|
|
2757
2829
|
auth_code="${pasted_code%%#*}"
|
|
@@ -2780,7 +2852,10 @@ run_login_codex() {
|
|
|
2780
2852
|
case "$interval" in *[!0-9]*|"") interval=5 ;; esac
|
|
2781
2853
|
[ "$interval" -ge 1 ] || interval=1
|
|
2782
2854
|
[ "$interval" -le 30 ] || interval=5
|
|
2783
|
-
[ -
|
|
2855
|
+
if [ -z "$device_auth_id" ] || [ -z "$user_code" ]; then
|
|
2856
|
+
err "Codex device authorization returned an invalid response."
|
|
2857
|
+
exit 1
|
|
2858
|
+
fi
|
|
2784
2859
|
open_oauth_url "$issuer/codex/device"
|
|
2785
2860
|
printf '%s\n' "Enter code: $user_code"
|
|
2786
2861
|
attempts=0
|
|
@@ -2792,13 +2867,19 @@ run_login_codex() {
|
|
|
2792
2867
|
done
|
|
2793
2868
|
authorization_code="$(printf '%s' "$authorization_response" | jq -r '.authorization_code // empty')"
|
|
2794
2869
|
verifier="$(printf '%s' "$authorization_response" | jq -r '.code_verifier // empty')"
|
|
2795
|
-
[ -
|
|
2870
|
+
if [ -z "$authorization_code" ] || [ -z "$verifier" ]; then
|
|
2871
|
+
err "Codex authorization returned an invalid response."
|
|
2872
|
+
exit 1
|
|
2873
|
+
fi
|
|
2796
2874
|
token_form="grant_type=authorization_code&code=$(jq -nr --arg value "$authorization_code" '$value|@uri')&redirect_uri=$(jq -nr --arg value "$issuer/deviceauth/callback" '$value|@uri')&client_id=app_EMoamEEZ73f0CkXaXp7hrann&code_verifier=$(jq -nr --arg value "$verifier" '$value|@uri')"
|
|
2797
2875
|
token_response="$(oauth_post_form "$issuer/oauth/token" "$token_form")" \
|
|
2798
2876
|
|| { err "Codex token exchange failed."; exit 1; }
|
|
2799
2877
|
refresh_token="$(printf '%s' "$token_response" | jq -r '.refresh_token // empty')"
|
|
2800
2878
|
account_id="$(jwt_account_id "$(printf '%s' "$token_response" | jq -r '.id_token // .access_token // empty')")"
|
|
2801
|
-
[ -
|
|
2879
|
+
if [ -z "$refresh_token" ] || [ -z "$account_id" ]; then
|
|
2880
|
+
err "Codex token exchange omitted account identity or refresh credentials."
|
|
2881
|
+
exit 1
|
|
2882
|
+
fi
|
|
2802
2883
|
body="$(jq -nc --arg provider codex --arg account "$account_id" --arg token "$refresh_token" '{provider:$provider,external_account_id:$account,refresh_token:$token}')"
|
|
2803
2884
|
models_api POST "/v1/subscriptions/accounts" "$body" || models_fail "enrolling Codex subscription"
|
|
2804
2885
|
ok "Codex subscription enrolled."
|
|
@@ -2880,21 +2961,13 @@ if [ "$mode" = "models" ] || [ "$mode" = "accounts" ] || [ "$mode" = "login" ] |
|
|
|
2880
2961
|
exit 1
|
|
2881
2962
|
fi
|
|
2882
2963
|
base_url="$models_base"
|
|
2883
|
-
# resolve_installed_endpoint ran in a command substitution, so
|
|
2884
|
-
#
|
|
2885
|
-
#
|
|
2886
|
-
#
|
|
2887
|
-
#
|
|
2888
|
-
# construction (see models_endpoint_is_trusted's same-file rule).
|
|
2964
|
+
# resolve_installed_endpoint ran in a command substitution, so recover the
|
|
2965
|
+
# source by walking the same precedence to find which file holds the
|
|
2966
|
+
# endpoint we just adopted. Only Claude Code spreads its endpoint across
|
|
2967
|
+
# several files; every other client keeps endpoint and key in one managed
|
|
2968
|
+
# config, which is self-consistent by construction.
|
|
2889
2969
|
if [ "$target" = "claude" ]; then
|
|
2890
|
-
|
|
2891
|
-
[ -n "$models_src_candidate" ] || continue
|
|
2892
|
-
models_src_url="$(json_get "$models_src_candidate" '.env.ANTHROPIC_BASE_URL')"
|
|
2893
|
-
if [ "${models_src_url%/}" = "$models_base" ]; then
|
|
2894
|
-
models_base_source="$models_src_candidate"
|
|
2895
|
-
break
|
|
2896
|
-
fi
|
|
2897
|
-
done <<<"$(models_base_file_order)"
|
|
2970
|
+
models_base_source="$(resolve_installed_base_source "$models_base")"
|
|
2898
2971
|
else
|
|
2899
2972
|
models_base_source="$(models_config_file_for_target)"
|
|
2900
2973
|
fi
|
|
@@ -2909,13 +2982,7 @@ if [ "$mode" = "models" ] || [ "$mode" = "accounts" ] || [ "$mode" = "login" ] |
|
|
|
2909
2982
|
# came from by re-reading them in read_installed_key's own precedence.
|
|
2910
2983
|
models_key_source=""
|
|
2911
2984
|
if [ "$target" = "claude" ]; then
|
|
2912
|
-
|
|
2913
|
-
[ -n "$models_src_candidate" ] || continue
|
|
2914
|
-
if [ -n "$(read_claude_key "$models_src_candidate")" ]; then
|
|
2915
|
-
models_key_source="$models_src_candidate"
|
|
2916
|
-
break
|
|
2917
|
-
fi
|
|
2918
|
-
done <<<"$(models_key_file_order)"
|
|
2985
|
+
models_key_source="$(resolve_installed_key_source)"
|
|
2919
2986
|
else
|
|
2920
2987
|
models_key_source="$(models_config_file_for_target)"
|
|
2921
2988
|
fi
|
|
@@ -2927,9 +2994,9 @@ if [ "$mode" = "models" ] || [ "$mode" = "accounts" ] || [ "$mode" = "login" ] |
|
|
|
2927
2994
|
# Never send a key to an endpoint the checkout supplied. See
|
|
2928
2995
|
# models_endpoint_is_trusted: a hostile repo can commit a settings.json naming
|
|
2929
2996
|
# its own router, and pairing that with the teammate key from the gitignored
|
|
2930
|
-
# settings.local.json would hand the key to whoever wrote
|
|
2931
|
-
|
|
2932
|
-
|
|
2997
|
+
# settings.local.json or WEAVE_ROUTER_KEY would hand the key to whoever wrote
|
|
2998
|
+
# the repo.
|
|
2999
|
+
if ! models_endpoint_is_trusted "$base_url" "$models_base_source" "$models_key_source"; then
|
|
2933
3000
|
err "Refusing to send this installation's router key to $base_url."
|
|
2934
3001
|
printf " %sThat endpoint comes from %s, which git tracks — a checked-out repo can set it —%s\n" \
|
|
2935
3002
|
"$C_DIM" "${models_base_source##*/}" "$C_RESET" >&2
|
|
@@ -2971,10 +3038,15 @@ fi
|
|
|
2971
3038
|
# `off` parks the router URL and points Claude Code at Anthropic, so the parked
|
|
2972
3039
|
# sidecar is the authority while toggled off — reading the live file there would
|
|
2973
3040
|
# pin the install to api.anthropic.com.
|
|
3041
|
+
installed_base=""
|
|
3042
|
+
installed_base_source=""
|
|
2974
3043
|
if [ "$mode" = "update" ] && [ "$base_url_explicit" != "true" ]; then
|
|
2975
3044
|
installed_base="$(resolve_installed_endpoint)"
|
|
2976
3045
|
if [ -n "$installed_base" ]; then
|
|
2977
3046
|
base_url="${installed_base%/}"
|
|
3047
|
+
if [ "$target" = "claude" ]; then
|
|
3048
|
+
installed_base_source="$(resolve_installed_base_source "$base_url")"
|
|
3049
|
+
fi
|
|
2978
3050
|
fi
|
|
2979
3051
|
fi
|
|
2980
3052
|
|
|
@@ -3044,6 +3116,31 @@ else
|
|
|
3044
3116
|
prompt_for_key
|
|
3045
3117
|
fi
|
|
3046
3118
|
|
|
3119
|
+
# A project-scoped Claude install intentionally reads its endpoint from the
|
|
3120
|
+
# tracked settings.json and its key from the ignored settings.local.json. An
|
|
3121
|
+
# update must not carry a newly changed tracked endpoint into the validation or
|
|
3122
|
+
# config write unless the user has independently vouched for it. The same gate
|
|
3123
|
+
# also protects cron/CI runs that provide WEAVE_ROUTER_KEY instead of reading
|
|
3124
|
+
# the installed key from disk.
|
|
3125
|
+
update_key_source=""
|
|
3126
|
+
if [ "$mode" = "update" ] && [ "$target" = "claude" ]; then
|
|
3127
|
+
if [ -n "${WEAVE_ROUTER_KEY:-}" ]; then
|
|
3128
|
+
update_key_source="env:WEAVE_ROUTER_KEY"
|
|
3129
|
+
else
|
|
3130
|
+
update_key_source="$(resolve_installed_key_source)"
|
|
3131
|
+
fi
|
|
3132
|
+
fi
|
|
3133
|
+
if [ "$mode" = "update" ] && [ "$target" = "claude" ] \
|
|
3134
|
+
&& [ "$base_url_explicit" != "true" ] && [ -n "$installed_base" ] \
|
|
3135
|
+
&& ! models_endpoint_is_trusted "$base_url" "$installed_base_source" "$update_key_source"; then
|
|
3136
|
+
err "Refusing to use the installed router endpoint $base_url."
|
|
3137
|
+
printf " %sThat endpoint comes from a git-tracked project file and has not been independently approved.%s\n" \
|
|
3138
|
+
"$C_DIM" "$C_RESET" >&2
|
|
3139
|
+
printf " %sPass --base-url <url> to confirm it, or re-run the installer against the endpoint you want.%s\n" \
|
|
3140
|
+
"$C_DIM" "$C_RESET" >&2
|
|
3141
|
+
exit 1
|
|
3142
|
+
fi
|
|
3143
|
+
|
|
3047
3144
|
# ---------- identity (user email + name) ----------
|
|
3048
3145
|
#
|
|
3049
3146
|
# The router parses X-Weave-User-Email and X-Weave-User-Name on every protocol
|
|
@@ -3232,7 +3329,9 @@ remove_obsolete_codex_prompt_wrappers() {
|
|
|
3232
3329
|
while IFS= read -r cmd; do
|
|
3233
3330
|
src="$commands_src_dir/$cmd.md"
|
|
3234
3331
|
dst="$dst_dir/$cmd.md"
|
|
3235
|
-
[ -f "$src" ]
|
|
3332
|
+
if [ ! -f "$src" ] || [ ! -f "$dst" ]; then
|
|
3333
|
+
continue
|
|
3334
|
+
fi
|
|
3236
3335
|
[ -L "$dst" ] && continue
|
|
3237
3336
|
if [ "$scope" = "project" ] || [ -n "$install_dir" ]; then
|
|
3238
3337
|
refuse_if_symlink "$dst"
|
|
@@ -4222,8 +4321,12 @@ weave_sync_commands() {
|
|
|
4222
4321
|
# be recovered those three are skipped rather than rewritten to point at the
|
|
4223
4322
|
# user-scope install.
|
|
4224
4323
|
local scope_args="" scope_known="false" off="$cmd_dir/router-off.md"
|
|
4324
|
+
# Backticks are literal Markdown delimiters.
|
|
4325
|
+
# shellcheck disable=SC2016
|
|
4225
4326
|
if [ -f "$off" ] && grep -Eq '^`npx @(workweave/router|weave-os/router) off --claude.*`$' "$off" 2>/dev/null; then
|
|
4226
4327
|
scope_known="true"
|
|
4328
|
+
# Backticks are literal Markdown delimiters.
|
|
4329
|
+
# shellcheck disable=SC2016
|
|
4227
4330
|
scope_args="$(sed -En 's#^`npx @(workweave/router|weave-os/router) off --claude(.*)`$#\2#p' "$off" | head -n 1)"
|
|
4228
4331
|
fi
|
|
4229
4332
|
|
|
@@ -4262,7 +4365,7 @@ weave_sync_commands() {
|
|
|
4262
4365
|
if [ -f "$prev" ]; then
|
|
4263
4366
|
new_body="$(weave_render_command "$raw" "$scope_args")"
|
|
4264
4367
|
prev_body="$(weave_render_command "$prev" "$scope_args")"
|
|
4265
|
-
installed_body="$(
|
|
4368
|
+
installed_body="$(sed '/^<!-- weave-router managed command: .* -->$/d' "$installed" 2>/dev/null)" || installed_body=""
|
|
4266
4369
|
if [ "$prev_body" = "$installed_body" ] && [ "$new_body" != "$installed_body" ]; then
|
|
4267
4370
|
tmp="$installed.tmp.$$"
|
|
4268
4371
|
if printf '%s\n<!-- weave-router managed command: %s -->' "$new_body" "$name" >"$tmp" 2>/dev/null; then
|
|
@@ -4493,11 +4596,12 @@ prices='{
|
|
|
4493
4596
|
"gpt-5.5-mini": 0.0005,
|
|
4494
4597
|
"gpt-5.5-nano": 0.00015,
|
|
4495
4598
|
"gpt-5.5-pro": 0.03,
|
|
4496
|
-
"gpt-5.6-luna": 0.
|
|
4497
|
-
"gpt-5.6-luna-pro": 0.
|
|
4498
|
-
"gpt-5.6-sol": 0.
|
|
4499
|
-
"gpt-5.6-sol-pro": 0.
|
|
4500
|
-
"gpt-5.6-terra": 0.
|
|
4599
|
+
"gpt-5.6-luna": 0.0002,
|
|
4600
|
+
"gpt-5.6-luna-pro": 0.0002,
|
|
4601
|
+
"gpt-5.6-sol": 0.004,
|
|
4602
|
+
"gpt-5.6-sol-pro": 0.004,
|
|
4603
|
+
"gpt-5.6-terra": 0.002,
|
|
4604
|
+
"gpt-6-astra": 0.01,
|
|
4501
4605
|
"grok-4.5": 0.002,
|
|
4502
4606
|
"grok-4.6": 0.002,
|
|
4503
4607
|
"minimax/minimax-m2.7": 0.0003,
|
|
@@ -4573,11 +4677,12 @@ prices='{
|
|
|
4573
4677
|
"gpt-5.5-mini": 0.0025,
|
|
4574
4678
|
"gpt-5.5-nano": 0.0006,
|
|
4575
4679
|
"gpt-5.5-pro": 0.18,
|
|
4576
|
-
"gpt-5.6-luna": 0.
|
|
4577
|
-
"gpt-5.6-luna-pro": 0.
|
|
4578
|
-
"gpt-5.6-sol": 0.
|
|
4579
|
-
"gpt-5.6-sol-pro": 0.
|
|
4580
|
-
"gpt-5.6-terra": 0.
|
|
4680
|
+
"gpt-5.6-luna": 0.0012,
|
|
4681
|
+
"gpt-5.6-luna-pro": 0.0012,
|
|
4682
|
+
"gpt-5.6-sol": 0.02,
|
|
4683
|
+
"gpt-5.6-sol-pro": 0.02,
|
|
4684
|
+
"gpt-5.6-terra": 0.012,
|
|
4685
|
+
"gpt-6-astra": 0.05,
|
|
4581
4686
|
"grok-4.5": 0.006,
|
|
4582
4687
|
"grok-4.6": 0.006,
|
|
4583
4688
|
"minimax/minimax-m2.7": 0.0012,
|
|
@@ -4658,6 +4763,7 @@ prices='{
|
|
|
4658
4763
|
"gpt-5.6-sol": 0.1,
|
|
4659
4764
|
"gpt-5.6-sol-pro": 0.1,
|
|
4660
4765
|
"gpt-5.6-terra": 0.1,
|
|
4766
|
+
"gpt-6-astra": 0.1,
|
|
4661
4767
|
"grok-4.5": 0.25,
|
|
4662
4768
|
"grok-4.6": 0.25,
|
|
4663
4769
|
"minimax/minimax-m2.7": 0.2,
|
|
@@ -4974,14 +5080,12 @@ write_claude_settings() {
|
|
|
4974
5080
|
fi
|
|
4975
5081
|
custom_headers="$custom_headers"$'\n'"X-App: claude-code"
|
|
4976
5082
|
|
|
4977
|
-
# Setting ANTHROPIC_BASE_URL makes Claude Code treat us as non-first-party
|
|
4978
|
-
#
|
|
4979
|
-
#
|
|
4980
|
-
# thrash loop. ENABLE_TOOL_SEARCH=auto restores on-demand loading (Claude Code's
|
|
4981
|
-
# own first-party default).
|
|
5083
|
+
# Setting ANTHROPIC_BASE_URL makes Claude Code treat us as non-first-party.
|
|
5084
|
+
# Force tool-search deferral to match first-party Claude Code; "auto" can inline
|
|
5085
|
+
# every tool schema when the custom endpoint advertises a 200K context window.
|
|
4982
5086
|
if [ "$scope" = "project" ] && [ -z "$install_dir" ]; then
|
|
4983
5087
|
jq -n --arg url "$base_url" --arg sl "$statusline_path_for_settings" '{
|
|
4984
|
-
env: { ANTHROPIC_BASE_URL: $url, ENABLE_TOOL_SEARCH: "
|
|
5088
|
+
env: { ANTHROPIC_BASE_URL: $url, ENABLE_TOOL_SEARCH: "true" },
|
|
4985
5089
|
statusLine: { type: "command", command: $sl },
|
|
4986
5090
|
attribution: {
|
|
4987
5091
|
commit: "Co-Authored-By: Weave Router <router@workweave.ai>",
|
|
@@ -4990,7 +5094,7 @@ write_claude_settings() {
|
|
|
4990
5094
|
}' >"$tmp_patch"
|
|
4991
5095
|
else
|
|
4992
5096
|
jq -n --arg url "$base_url" --arg header "$custom_headers" --arg sl "$statusline_path_for_settings" '{
|
|
4993
|
-
env: { ANTHROPIC_BASE_URL: $url, ANTHROPIC_CUSTOM_HEADERS: $header, ENABLE_TOOL_SEARCH: "
|
|
5097
|
+
env: { ANTHROPIC_BASE_URL: $url, ANTHROPIC_CUSTOM_HEADERS: $header, ENABLE_TOOL_SEARCH: "true" },
|
|
4994
5098
|
statusLine: { type: "command", command: $sl },
|
|
4995
5099
|
attribution: {
|
|
4996
5100
|
commit: "Co-Authored-By: Weave Router <router@workweave.ai>",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weave-os/router",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"description": "One-command installer that points Claude Code, Codex, opencode, or pi at the Weave Router. For pi it also ships the routing extension, loaded via pi.extensions.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"weave-router": "bin.js",
|
|
@@ -7,7 +7,7 @@ export interface ModelPricing {
|
|
|
7
7
|
cacheReadMultiplier: number;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const PRICING_VERSION = "catalog-sha256:
|
|
10
|
+
export const PRICING_VERSION = "catalog-sha256:a96c21de7b4ad8ef";
|
|
11
11
|
|
|
12
12
|
export const MODEL_PRICING: Readonly<Record<string, ModelPricing>> = Object.freeze({
|
|
13
13
|
"claude-fable-5": { inputUsdPerMillion: 10, outputUsdPerMillion: 50, cacheReadMultiplier: 0.1 },
|
|
@@ -58,11 +58,12 @@ export const MODEL_PRICING: Readonly<Record<string, ModelPricing>> = Object.free
|
|
|
58
58
|
"gpt-5.5-mini": { inputUsdPerMillion: 0.5, outputUsdPerMillion: 2.5, cacheReadMultiplier: 0.1 },
|
|
59
59
|
"gpt-5.5-nano": { inputUsdPerMillion: 0.15, outputUsdPerMillion: 0.6, cacheReadMultiplier: 0.1 },
|
|
60
60
|
"gpt-5.5-pro": { inputUsdPerMillion: 30, outputUsdPerMillion: 180, cacheReadMultiplier: 1 },
|
|
61
|
-
"gpt-5.6-luna": { inputUsdPerMillion:
|
|
62
|
-
"gpt-5.6-luna-pro": { inputUsdPerMillion:
|
|
63
|
-
"gpt-5.6-sol": { inputUsdPerMillion:
|
|
64
|
-
"gpt-5.6-sol-pro": { inputUsdPerMillion:
|
|
65
|
-
"gpt-5.6-terra": { inputUsdPerMillion: 2
|
|
61
|
+
"gpt-5.6-luna": { inputUsdPerMillion: 0.2, outputUsdPerMillion: 1.2, cacheReadMultiplier: 0.1 },
|
|
62
|
+
"gpt-5.6-luna-pro": { inputUsdPerMillion: 0.2, outputUsdPerMillion: 1.2, cacheReadMultiplier: 0.1 },
|
|
63
|
+
"gpt-5.6-sol": { inputUsdPerMillion: 4, outputUsdPerMillion: 20, cacheReadMultiplier: 0.1 },
|
|
64
|
+
"gpt-5.6-sol-pro": { inputUsdPerMillion: 4, outputUsdPerMillion: 20, cacheReadMultiplier: 0.1 },
|
|
65
|
+
"gpt-5.6-terra": { inputUsdPerMillion: 2, outputUsdPerMillion: 12, cacheReadMultiplier: 0.1 },
|
|
66
|
+
"gpt-6-astra": { inputUsdPerMillion: 10, outputUsdPerMillion: 50, cacheReadMultiplier: 0.1 },
|
|
66
67
|
"grok-4.5": { inputUsdPerMillion: 2, outputUsdPerMillion: 6, cacheReadMultiplier: 0.25 },
|
|
67
68
|
"grok-4.6": { inputUsdPerMillion: 2, outputUsdPerMillion: 6, cacheReadMultiplier: 0.25 },
|
|
68
69
|
"minimax/minimax-m2.7": { inputUsdPerMillion: 0.3, outputUsdPerMillion: 1.2, cacheReadMultiplier: 0.2 },
|