Skip to content

fix(pi): catalog model ids, strip ANSI from --model - #11

Merged
duyet merged 1 commit into
mainfrom
fix/pi-model-id
Aug 24, 2026
Merged

fix(pi): catalog model ids, strip ANSI from --model#11
duyet merged 1 commit into
mainfrom
fix/pi-model-id

Conversation

@duyet

@duyet duyet commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Why

`anyr pi` with session model `stealth/ox-alpha` 404ed as `stealth/ox-alpha[1m]`.

Two bugs:

  1. We passed `--model anyrouter/` even though `--provider anyrouter` was already set. Official AnyRouter Pi guide is `pi --provider anyrouter --model "openai/gpt-5.4-mini"`.
  2. TUI-copied ids can carry a dangling SGR suffix (`[1m` is bold). The gateway then looks up a model that does not exist.

What

  • `--model` is the catalog id (`stealth/ox-alpha`)
  • Sanitize ANSI / dangling `[Nm` on spawn
  • `anyrouter/auto` resolves to Pi's default sonnet id

Test

`cargo test --all-targets`

Pi was launched with --model anyrouter/<id> while --provider
anyrouter was already set, so stealth/ox-alpha became a 404.
Also strip CSI / dangling [1m tails copied from a TUI.

Co-authored-by: Duyet Le <me@duyet.net>
Co-authored-by: duyetbot <bot@duyet.net>
@github-actions

Copy link
Copy Markdown
Contributor

anyr size and startup

Startup is wall time for a cold anyr --version / anyr --help (median of 21 runs). Size is the stripped release binary, or the .wasm for the browser demo.

Size budget: anyr-linux-x86_64 must stay ≤ 4.0 MiB (4194304 bytes) stripped.

Asset Kind Size --version median --help median
anyr-darwin-arm64 native 2.3 MiB 3.36 ms 2.36 ms
anyr-linux-arm64 native 2.3 MiB 0.73 ms 0.78 ms
anyr-linux-x86_64 native 2.6 MiB 0.93 ms 0.91 ms
anyr-windows-x86_64.exe native 2.2 MiB 9.38 ms 9.22 ms
anyr.wasm wasm 172.9 KiB

Budget check: ok

raw timings
[
  {
    "asset": "anyr-darwin-arm64",
    "kind": "native",
    "path": "/Users/runner/work/cli/cli/anyr-darwin-arm64",
    "bytes": 2461656,
    "size": "2.3 MiB",
    "version": "0.1.10 (built 2026-08-24 11:40:03)",
    "target": "aarch64-apple-darwin",
    "os": "macos-latest",
    "startup_version": {
      "n": 21,
      "min_ms": 2.98,
      "median_ms": 3.36,
      "p95_ms": 3.59,
      "mean_ms": 3.31
    },
    "startup_help": {
      "n": 21,
      "min_ms": 2.28,
      "median_ms": 2.36,
      "p95_ms": 3.0,
      "mean_ms": 2.44
    }
  },
  {
    "asset": "anyr-linux-arm64",
    "kind": "native",
    "path": "/home/runner/work/cli/cli/anyr-linux-arm64",
    "bytes": 2429920,
    "size": "2.3 MiB",
    "version": "0.1.10 (built 2026-08-24 11:39:53)",
    "target": "aarch64-unknown-linux-gnu",
    "os": "ubuntu-24.04-arm",
    "startup_version": {
      "n": 21,
      "min_ms": 0.68,
      "median_ms": 0.73,
      "p95_ms": 0.83,
      "mean_ms": 0.75
    },
    "startup_help": {
      "n": 21,
      "min_ms": 0.7,
      "median_ms": 0.78,
      "p95_ms": 0.84,
      "mean_ms": 0.77
    }
  },
  {
    "asset": "anyr-linux-x86_64",
    "kind": "native",
    "path": "/home/runner/work/cli/cli/anyr-linux-x86_64",
    "bytes": 2728000,
    "size": "2.6 MiB",
    "version": "0.1.10 (built 2026-08-24 11:40:03)",
    "target": "x86_64-unknown-linux-gnu",
    "os": "ubuntu-latest",
    "startup_version": {
      "n": 21,
      "min_ms": 0.92,
      "median_ms": 0.93,
      "p95_ms": 1.0,
      "mean_ms": 0.94
    },
    "startup_help": {
      "n": 21,
      "min_ms": 0.89,
      "median_ms": 0.91,
      "p95_ms": 0.98,
      "mean_ms": 0.92
    }
  },
  {
    "asset": "anyr-windows-x86_64.exe",
    "kind": "native",
    "path": "D:\\a\\cli\\cli\\anyr-windows-x86_64.exe",
    "bytes": 2258432,
    "size": "2.2 MiB",
    "version": "0.1.10 (built 2026-08-24T11:41:12Z)",
    "target": "x86_64-pc-windows-msvc",
    "os": "windows-latest",
    "startup_version": {
      "n": 21,
      "min_ms": 8.96,
      "median_ms": 9.38,
      "p95_ms": 11.1,
      "mean_ms": 9.73
    },
    "startup_help": {
      "n": 21,
      "min_ms": 8.84,
      "median_ms": 9.22,
      "p95_ms": 9.73,
      "mean_ms": 9.29
    }
  },
  {
    "asset": "anyr.wasm",
    "kind": "wasm",
    "path": "/home/runner/work/cli/cli/target/wasm-pkg/anyr_cli_bg.wasm",
    "bytes": 177071,
    "size": "172.9 KiB",
    "version": "wasm",
    "target": "wasm32-unknown-unknown",
    "os": ""
  }
]

@duyet
duyet merged commit aad7641 into main Aug 24, 2026
8 checks passed
@duyet
duyet deleted the fix/pi-model-id branch August 24, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant