@ssweens/pi-vertex 1.1.12 → 1.3.0
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/CHANGELOG.md +115 -0
- package/README.md +66 -35
- package/TEST_COVERAGE.md +22 -2
- package/auth.ts +1 -1
- package/config.ts +1 -1
- package/index.ts +16 -7
- package/models/claude.ts +213 -20
- package/models/gemini.ts +171 -42
- package/models/maas.ts +127 -261
- package/package.json +15 -6
- package/streaming/gemini.ts +69 -34
- package/streaming/index.ts +30 -1
- package/streaming/maas.ts +71 -33
- package/streaming/sse-comment-filter.ts +169 -0
- package/tests/first-byte-timeout-check.mjs +53 -0
- package/types.ts +22 -2
- package/utils.ts +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,121 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.3.0] - 2026-11-15
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Gemini 4 Hydrogen** (`gemini-4-hydrogen`): GA on 2026-11-12. Google calls it a short-term release and retires it with 45 days' notice. It has a 1M token limit that covers input and output together, and 65,536 max output per response. Pricing is $1.50/$7.50 per 1M tokens, with $0.075 per 1M cached input tokens. Thinking levels are `low`, `medium`, `high` (the default), and `xhigh`. Hydrogen is the only Gemini model that accepts `xhigh`.
|
|
9
|
+
- **Gemini 4 Carbon** (`gemini-4-carbon`): GA on 2026-11-10. This Frontier Model is available only to verified enterprise customers. It has a 1M context and 65,536 max output. Thinking levels are `low`, `medium` (the default), and `high`. It shares Argon's introductory pricing: $2.00/$10.00, with $0.10 cached, through 2026-11-30, then $4.00/$20.00.
|
|
10
|
+
- **Claude Fable 5.2** (`claude-fable-5-2`): GA on 2026-11-09. 1M context, 128K max output. $8.00/$40.00 global; regional endpoints cost 10% more. It needs the Advanced AI Safety Addendum, like Fable 5.1. Fast mode (`speed: "fast"`, billed at 2x) is not used.
|
|
11
|
+
- **Claude Haiku 5.5** (`claude-haiku-5-5`): GA on 2026-10-07. 1M context, 128K max output. $0.10/$0.50 global below 100K input tokens. At 100K input tokens or more, every token in the request bills at 5x; cost tracking uses the lower tier.
|
|
12
|
+
- **Grok 4.7** (`grok-4.7`): GA on 2026-09-30. 524K context, global endpoint. $2.00/$6.00 per 1M tokens, $0.50 cached, the same as Grok 4.6.
|
|
13
|
+
- **DeepSeek V4.1 Flash** (`deepseek-v4.1-flash`): 1M context, text and image input, tools, global endpoint only. $0.30/$1.20 per 1M tokens, $0.03 cached. This is now the only DeepSeek model on Vertex.
|
|
14
|
+
- **Meta Muse** (`muse-wonder-1.0`, `muse-spark-1.3`, `muse-ember-1.0`): Preview, global endpoint only. 1,048,576-token context shared by input and output. Text and image input, tools, and reasoning. Wonder costs $4.00/$20.00, Spark $1.25/$4.25, and Ember $0.10/$0.50; Ember costs 3x above 200K input tokens.
|
|
15
|
+
- **A Responses API path for MaaS models.** Muse models run only on Meta's stateless OpenAI-compatible Responses API (`publishers/meta/v1/responses`), not on Chat Completions. Models marked `maasApi: "responses"` now stream through pi-ai's OpenAI Responses client with `store: false`. Reasoning is replayed as encrypted content, so multi-turn tool use keeps its reasoning state. The keepalive filter and first-byte timeout cover these URLs too.
|
|
16
|
+
- **Per-model thinking levels.** Model definitions can carry a `thinkingLevelMap`, which pi-vertex passes to Pi, so the thinking selector shows only the levels each API accepts:
|
|
17
|
+
- Gemini 4 hides `minimal`, because the API answers it with HTTP 400.
|
|
18
|
+
- Gemini 4 Hydrogen adds `xhigh`.
|
|
19
|
+
- Muse offers `minimal` through `xhigh`, and Muse Ember also offers `max`.
|
|
20
|
+
- DeepSeek V4.1 Flash offers `minimal` through `high`, plus `max`.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
- Gemini thinking: `xhigh` is sent as the `XHIGH` thinking level only to models that declare it (Hydrogen). Other Gemini models still cap `xhigh` and `max` at `HIGH`. Every Gemini 4 model now floors `minimal` to `low`; before, only Argon did.
|
|
24
|
+
- DeepSeek V4.1 Flash on Vertex thinks only when `reasoning_effort` is present, so pi-vertex now sends the selected effort. At thinking level `off` it sends nothing, and the model answers without thinking.
|
|
25
|
+
- GLM 5.2 cached input price corrected from $0.26 to $0.14 per 1M tokens, the current list price.
|
|
26
|
+
|
|
27
|
+
### Removed
|
|
28
|
+
- Open models that Google shut down on Vertex on 2026-10-21. Each returns HTTP 404 on the global endpoint:
|
|
29
|
+
- DeepSeek: `deepseek-v3.2`, `deepseek-v3.1`, `deepseek-r1`, `deepseek-ocr`
|
|
30
|
+
- Qwen: `qwen3-235b`, `qwen3-next-instruct`, `qwen3-next-thinking`, `qwen3-coder`
|
|
31
|
+
- Zhipu: `glm-5`, `glm-4.7`
|
|
32
|
+
- Others: `gpt-oss-20b`, `kimi-k2-thinking`, `minimax-m2`, `llama-3.3-70b`
|
|
33
|
+
- `grok-4.1-fast-reasoning`: shut down on 2026-08-20.
|
|
34
|
+
- `claude-3-5-sonnet-v2`: shut down on Vertex on 2026-02-19. It returns HTTP 404 on both global and us-east5.
|
|
35
|
+
|
|
36
|
+
## [1.2.7] - 2026-10-13
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
- **No model received tools or the system prompt under Pi 0.99.** The 0.99 agent loop stops passing `context.systemPrompt`/`context.tools` to `streamSimple` — both are folded into system messages in the transcript (`toolsAdded`/`toolsRemoved` deltas replayed in order). The streaming paths still read the legacy shorthand fields, which are always empty, so every Vertex model (Gemini, Claude, MaaS) ran as a bare text completion: no function declarations, no Pi system prompt. Visible with any agentic prompt; the model reports it has "zero tools attached". `streamVertex` now resolves the prompt and current tool set from the transcript (via pi-ai's `getCurrentSystemMessage`/`getCurrentTools`) before dispatching; explicitly passed fields still win.
|
|
40
|
+
|
|
41
|
+
## [1.2.6] - 2026-10-13
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
- **Gemini 4 Argon** (`gemini-4-argon`) — GA on 2026-10-13, Google's new flagship reasoning model. 1M context, 65,536 max output (1M with long decode; the default synchronous limit is used), reasoning via low/medium/high thinking levels, tools, global Vertex endpoint. Introductory pricing is $2.00/$10.00 per 1M input/output tokens with $0.10/1M cached input tokens through 2026-11-30, rising to $4.00/$20.00 after.
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
- Thinking configuration now treats Gemini 4 like Gemini 3: thinking levels instead of Gemini 2.5 budgets, `thinkingConfig` omitted when no reasoning effort is given so Argon uses its native default, and `minimal` effort floors to `low` (Argon does not support MINIMAL).
|
|
48
|
+
- Cross-provider tool call replay to Gemini 4 models now uses the `skip_thought_signature_validator` escape hatch, matching Gemini 3's functionCall signature requirement.
|
|
49
|
+
|
|
50
|
+
## [1.2.5] - 2026-09-29
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
- **Claude Opus 5.5** (`claude-opus-5-5`) — GA on Vertex 2026-09-22. 1M context, 128K max output, thinking, tools. $4.00/$20.00 global, 10% regional premium. Cache reads $0.20/1M (60% below Opus 5).
|
|
54
|
+
- **Claude Sonnet 5.5** (`claude-sonnet-5-5`) — GA on Vertex 2026-09-28. 1M context, 128K max output, thinking, tools. Same token prices as Sonnet 5 ($2.00/$10.00 global).
|
|
55
|
+
- **Claude Fable 5.1** (`claude-fable-5-1`) — GA on Vertex 2026-09-01. 1M context, 128K max output, thinking, tools. Same input/output prices as Fable 5 ($10.00/$50.00 global); cache reads $0.25/1M (75% below Fable 5's $1.00). Vertex also requires the Advanced AI Safety Addendum.
|
|
56
|
+
|
|
57
|
+
API ids match Google Cloud Model Garden (`claude-opus-5-5`, `claude-sonnet-5-5`, `claude-fable-5-1`). No date suffix. Same MaaS streaming path as the rest of the Claude 5 series.
|
|
58
|
+
|
|
59
|
+
## [1.2.4] - 2026-09-23
|
|
60
|
+
|
|
61
|
+
### Fixed
|
|
62
|
+
- **The startup notice no longer crashes Pi on a narrow terminal.** The `[pi-vertex] Initializing with project: …` widget ignored the render width, and Pi exits on any line wider than the terminal. With a typical project id that line is about 68 columns, so resizing below that, or reloading in a narrow pane, killed the app (`Rendered line … exceeds terminal width (68 > 54)`). The widget now clips to the width it is given.
|
|
63
|
+
|
|
64
|
+
## [1.2.3] - 2026-09-22
|
|
65
|
+
|
|
66
|
+
### Fixed
|
|
67
|
+
- **Streams that are accepted and never start no longer cost five minutes each.** Some Vertex deployments answer a streaming request with `200 text/event-stream` and then send nothing at all. Measured on `zai-org/glm-5.2-maas` (global): 9 of 19 requests, with and without tools, while `zai-org/glm-4.7-maas` and `deepseek-ai/deepseek-v3.2-maas` on the same endpoint and credentials stalled 0 of 22. undici only abandons a silent body after its 300 s timeout, so each dead request burned five minutes before a retry could start — a one-line answer through a delegated agent took ten minutes and two `terminated` errors.
|
|
68
|
+
|
|
69
|
+
The fetch wrapper that strips keepalive lines now also bounds the wait for the **first** byte, default 90 s, configurable with `PI_VERTEX_FIRST_BYTE_TIMEOUT_MS` (`0` disables). A stream that has begun is untouched: genuinely slow ones keep the socket alive with the keepalive lines this wrapper strips further down, and mid-stream gaps remain undici's business. The error names the endpoint and says retrying or another offering is the fix.
|
|
70
|
+
|
|
71
|
+
This is a client-side bound on someone else's outage, not a repair of it. `glm-5.2` on the global MaaS endpoint is unreliable for interactive use; it has no regional endpoint (`us-central1` answers HTTP 400).
|
|
72
|
+
|
|
73
|
+
### Added
|
|
74
|
+
- `npm test` with a first-byte-timeout check covering a dead stream, a slow-starting stream, and keepalive stripping.
|
|
75
|
+
|
|
76
|
+
## [1.2.2] - 2026-09-03
|
|
77
|
+
### Added
|
|
78
|
+
- **GLM 5.2** (`glm-5.2`) — 1M context, 64,000 max output, thinking, tools, and global Vertex endpoint. Pricing is $1.40/$4.40 per 1M input/output tokens with $0.26/1M cached input tokens.
|
|
79
|
+
- **Grok 4.6** (`grok-4.6`) — Preview model with 524K context, image input, reasoning, tools, and global Vertex endpoint. Pricing is $2.00/$6.00 per 1M input/output tokens with $0.50/1M cached input tokens.
|
|
80
|
+
|
|
81
|
+
## [1.2.1] - 2026-09-03
|
|
82
|
+
### Added
|
|
83
|
+
- **Gemini 3.8 Flash** (`gemini-3.8-flash`) — GA on 2026-09-02. 1M context, 65,536 max output, reasoning via low/medium/high thinking levels, tools, and global Vertex endpoint. Introductory pricing is $0.75/$3.75 per 1M input/output tokens with $0.075/1M cached input tokens through 2026-12-31.
|
|
84
|
+
|
|
85
|
+
### Fixed
|
|
86
|
+
- Gemini 3.8 Flash `minimal` reasoning requests now floor to the supported `low` thinking level.
|
|
87
|
+
|
|
88
|
+
## [1.2.0] - 2026-08-14
|
|
89
|
+
### Added
|
|
90
|
+
- **Gemini 3.7 Flash** (`gemini-3.7-flash`) — GA on 2026-08-13. Google's current workhorse Flash model for coding and agents. 1M context, 65,536 max output, reasoning via thinking levels, tools. $0.75/$3.75 per 1M tokens, $0.075/1M cache read — cheaper *and* newer than 3.5/3.6 Flash.
|
|
91
|
+
- **Gemini 3.6 Flash** (`gemini-3.6-flash`) — GA on 2026-07-21. Improved token efficiency and agentic planning over 3.5 Flash at a lower output price. 1M context, 65,536 max output. $1.50/$7.50 per 1M tokens, $0.15/1M cache read.
|
|
92
|
+
- **Gemini 3.5 Flash Lite** (`gemini-3.5-flash-lite`) — GA on 2026-07-21. The current high-volume/low-cost route. 1M context, 65,536 max output. $0.30/$2.50 per 1M tokens, $0.03/1M cache read.
|
|
93
|
+
- **Claude Opus 5** (`claude-opus-5`) — Anthropic's Claude 5 flagship on Vertex Model Garden. 1M context, 128K max output. $5.00/$25.00 global, 10% regional premium.
|
|
94
|
+
- **Claude Sonnet 5** (`claude-sonnet-5`) — 1M context, 128K max output. $2.00/$10.00 global, 10% regional premium — a price cut versus Sonnet 4.6's $3.00/$15.00.
|
|
95
|
+
|
|
96
|
+
### Changed
|
|
97
|
+
- **Gemini 3.1 Flash Lite promoted to GA** — API id moved from `gemini-3.1-flash-lite-preview` to `gemini-3.1-flash-lite`. Its `maxTokens` also corrected from `65535` to `65536`.
|
|
98
|
+
- `ModelInputType` now documents that it intentionally mirrors pi-ai's `Model["input"]` (`("text" | "image")[]`) and must not be widened.
|
|
99
|
+
|
|
100
|
+
### Removed
|
|
101
|
+
- **Gemini 2.0 Flash / Flash Lite** (`gemini-2.0-flash`, `gemini-2.0-flash-lite`) — Google shut these endpoints down on Vertex on 2026-06-01. They were still being advertised in pi's model selector and would fail at request time. Migrate to `gemini-2.5-flash` / `gemini-2.5-flash-lite`, or better, a 3.x Flash model since the 2.5 line retires on 2026-10-16.
|
|
102
|
+
|
|
103
|
+
### Fixed
|
|
104
|
+
- **Package no longer type-checks clean → now it does.** Two pre-existing `tsc --noEmit` errors were blocking a clean build:
|
|
105
|
+
- `models/claude.ts` declared `input: ["text", "image", "file"]` on `claude-fable-5`, but `"file"` is not a member of `ModelInputType` (nor of pi-ai's `Model["input"]`, which is the hard downstream constraint). The modality was never actually deliverable, so it has been dropped rather than the type widened.
|
|
106
|
+
- `streaming/gemini.ts` pushed `output.stopReason` into a `done` event, whose `reason` only accepts `"stop" | "length" | "toolUse"`. Safety blocks and unmapped finish reasons now emit an `error` event instead, matching the catch block's behavior.
|
|
107
|
+
|
|
108
|
+
### Notes
|
|
109
|
+
- `gemini-3.1-pro` remains a Preview offering on Vertex; its API id stays `gemini-3.1-pro-preview`.
|
|
110
|
+
- Claude 5 models require provider data sharing enabled on the publisher model config or Vertex returns HTTP 403.
|
|
111
|
+
|
|
112
|
+
## [1.1.14] - 2026-07-17
|
|
113
|
+
### Fixed
|
|
114
|
+
- **Provider registration failing with `"baseUrl" is required when defining custom models"`** — `toPiModel()` set `baseUrl: ""` on every per-model entry passed to `registerProvider`. Since `??` only falls through on `null`/`undefined`, that empty string beat the provider-level `baseUrl` fallback in pi-coding-agent's resolution (`definition.baseUrl ?? providerConfig.baseUrl`), so every model resolved to an empty URL and the extension failed to load. Per-model entries now correctly omit `baseUrl` (and `provider`, which isn't part of the per-model shape either), letting them inherit the provider's `baseUrl`.
|
|
115
|
+
|
|
116
|
+
## [1.1.13] - 2026-06-09
|
|
117
|
+
### Added
|
|
118
|
+
- **Claude Fable 5** (`claude-fable-5`) — Anthropic's first public Mythos-class model, positioned above Opus 4.8. 1M context, 128K max output, text/image/file input, reasoning (adaptive thinking always on), tools. $10/$50 per 1M tokens (global), $1/1M cache read, 10% regional premium. Available on Vertex AI Model Garden.
|
|
119
|
+
|
|
5
120
|
## [1.1.12] - 2026-06-03
|
|
6
121
|
### Added
|
|
7
122
|
- **Claude Opus 4.8** (`claude-opus-4-8`) — added the new Vertex/Gemini Enterprise Agent Platform Anthropic partner model with 1M context, 128K max output tokens, and the same published global/regional pricing tier used by Opus 4.7.
|
package/README.md
CHANGED
|
@@ -11,19 +11,19 @@ export GOOGLE_CLOUD_PROJECT=your-project-id
|
|
|
11
11
|
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Set your GCP project and credentials. Vertex AI models (Gemini, Claude, Llama, DeepSeek,
|
|
14
|
+
Set your GCP project and credentials. Vertex AI models (Gemini, Claude, Grok, Meta Muse and Llama, DeepSeek, Mistral, and others) appear in pi's model selector, billed through your GCP project.
|
|
15
15
|
|
|
16
16
|
## Features
|
|
17
17
|
|
|
18
|
-
- **
|
|
19
|
-
- **Gemini** (
|
|
20
|
-
- **Claude** (
|
|
21
|
-
- **
|
|
22
|
-
- **Other MaaS** (
|
|
18
|
+
- **49 models** across 4 categories:
|
|
19
|
+
- **Gemini** (14): 4 Hydrogen, 4 Carbon, 4 Argon, 3.8 Flash, 3.7 Flash, 3.6 Flash, 3.5 Flash, 3.5 Flash-Lite, 3.1 Pro, 3.1 Flash-Lite, 3 Flash, 2.5 Pro, 2.5 Flash, 2.5 Flash-Lite
|
|
20
|
+
- **Claude** (18): Fable 5.2, Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.1, Opus 5, Sonnet 5, Fable 5, Opus 4.8, Opus 4.7, Opus 4.6, Sonnet 4.6, Opus/Sonnet/Haiku 4.5, Opus 4.1, Opus 4, Sonnet 4
|
|
21
|
+
- **Meta** (5): Muse Wonder 1.0, Muse Spark 1.3, Muse Ember 1.0, Llama 4 Maverick, Llama 4 Scout
|
|
22
|
+
- **Other MaaS** (10): Grok 4.7, Grok 4.6, Grok 4.3, Grok 4.20, DeepSeek V4.1 Flash, Mistral (4), OpenAI GPT-OSS 120B, Gemma 4, GLM 5.2
|
|
23
23
|
|
|
24
24
|
- **Unified streaming**: Single provider, multiple model families
|
|
25
25
|
- **Full tool calling support**: All models with multi-turn tool use and proper tool result handling
|
|
26
|
-
- **Thinking/reasoning**: Gemini 3 thinking levels, Gemini 2.5 thinking budgets, thought signature preservation
|
|
26
|
+
- **Thinking/reasoning**: Gemini 3/4 thinking levels (including XHIGH on Gemini 4 Hydrogen), Gemini 2.5 thinking budgets, per-model reasoning effort for Claude, Muse, and DeepSeek, thought signature preservation
|
|
27
27
|
- **Automatic auth**: Uses Google Application Default Credentials
|
|
28
28
|
- **Region awareness**: Global endpoints where supported, regional where required
|
|
29
29
|
- **Pricing tracking**: Built-in cost per token for all models (including thinking tokens and regional endpoint premiums)
|
|
@@ -86,14 +86,21 @@ pi --provider vertex --model gemini-2.5-pro --version
|
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
88
|
# Use any supported model
|
|
89
|
-
pi --provider vertex --model claude-opus-
|
|
90
|
-
pi --provider vertex --model
|
|
91
|
-
pi --provider vertex --model
|
|
89
|
+
pi --provider vertex --model claude-opus-5-5
|
|
90
|
+
pi --provider vertex --model claude-sonnet-5-5
|
|
91
|
+
pi --provider vertex --model claude-fable-5-2
|
|
92
|
+
pi --provider vertex --model claude-haiku-5-5
|
|
93
|
+
pi --provider vertex --model grok-4.7
|
|
94
|
+
pi --provider vertex --model glm-5.2
|
|
95
|
+
pi --provider vertex --model gemini-4-hydrogen
|
|
96
|
+
pi --provider vertex --model gemini-4-argon
|
|
97
|
+
pi --provider vertex --model gemini-3.8-flash
|
|
98
|
+
pi --provider vertex --model muse-wonder-1.0
|
|
92
99
|
pi --provider vertex --model llama-4-maverick
|
|
93
|
-
pi --provider vertex --model deepseek-
|
|
100
|
+
pi --provider vertex --model deepseek-v4.1-flash
|
|
94
101
|
|
|
95
102
|
# With options
|
|
96
|
-
pi --provider vertex --model
|
|
103
|
+
pi --provider vertex --model gemini-4-hydrogen --thinking xhigh
|
|
97
104
|
```
|
|
98
105
|
|
|
99
106
|
### Shell alias (recommended)
|
|
@@ -120,15 +127,30 @@ alias pil="GOOGLE_CLOUD_PROJECT=your-project pi --provider vertex --model llama-
|
|
|
120
127
|
|
|
121
128
|
| Model | Context | Max Tokens | Input | Reasoning | Price (in/out) |
|
|
122
129
|
|-------|---------|------------|-------|-----------|----------------|
|
|
130
|
+
| gemini-4-hydrogen | 1M | 65,536 | text, image | ✅ | $1.50/$7.50 |
|
|
131
|
+
| gemini-4-carbon | 1M | 65,536 | text, image | ✅ | $2.00/$10.00 |
|
|
132
|
+
| gemini-4-argon | 1M | 65,536 | text, image | ✅ | $2.00/$10.00 |
|
|
133
|
+
| gemini-3.8-flash | 1M | 65,536 | text, image | ✅ | $0.75/$3.75 |
|
|
134
|
+
| gemini-3.7-flash | 1M | 65,536 | text, image | ✅ | $0.75/$3.75 |
|
|
135
|
+
| gemini-3.6-flash | 1M | 65,536 | text, image | ✅ | $1.50/$7.50 |
|
|
136
|
+
| gemini-3.5-flash | 1M | 65,536 | text, image | ✅ | $1.50/$9.00 |
|
|
137
|
+
| gemini-3.5-flash-lite | 1M | 65,536 | text, image | ✅ | $0.30/$2.50 |
|
|
123
138
|
| gemini-3.1-pro | 1M | 65,536 | text, image | ✅ | $2.00/$12.00 |
|
|
124
|
-
| gemini-3.1-flash-lite | 1M | 65,
|
|
125
|
-
| gemini-3-pro | 1M | 65,536 | text, image | ✅ | $2.00/$12.00 |
|
|
139
|
+
| gemini-3.1-flash-lite | 1M | 65,536 | text, image | ✅ | $0.25/$1.50 |
|
|
126
140
|
| gemini-3-flash | 1M | 65,536 | text, image | ✅ | $0.50/$3.00 |
|
|
127
141
|
| gemini-2.5-pro | 1M | 65,536 | text, image | ✅ | $1.25/$10.00 |
|
|
128
142
|
| gemini-2.5-flash | 1M | 65,536 | text, image | ✅ | $0.30/$2.50 |
|
|
129
143
|
| gemini-2.5-flash-lite | 1M | 65,536 | text, image | ✅ | $0.10/$0.40 |
|
|
130
|
-
|
|
131
|
-
|
|
144
|
+
|
|
145
|
+
`gemini-4-argon` and `gemini-4-carbon` use introductory pricing of $2.00/$10.00 per 1M tokens (cached input $0.10) through 2026-11-30, rising to $4.00/$20.00 after. Argon supports "long decode" up to 1M output tokens; this extension uses the default 65,536 synchronous limit. `gemini-4-carbon` is a Frontier Model available only to verified enterprise customers.
|
|
146
|
+
|
|
147
|
+
`gemini-4-hydrogen` is a short-term release: Google retires it with 45 days' notice. Its 1M token limit covers input and output together. It is the only Gemini model that accepts the `xhigh` thinking level.
|
|
148
|
+
|
|
149
|
+
Gemini 4 models reject the MINIMAL thinking level, so pi does not offer `minimal` for them.
|
|
150
|
+
|
|
151
|
+
`gemini-3.1-pro` is still a Preview offering on Vertex (API id `gemini-3.1-pro-preview`); everything else in this table is GA.
|
|
152
|
+
|
|
153
|
+
**Retired:** `gemini-2.0-flash` and `gemini-2.0-flash-lite` were shut down on Vertex on 2026-06-01 and have been removed. `gemini-2.5-*` retires on 2026-10-16 — migrate to a 3.x Flash model before then.
|
|
132
154
|
|
|
133
155
|
### Claude Models
|
|
134
156
|
|
|
@@ -136,6 +158,14 @@ Prices shown are for the **global** endpoint. Non-global regions (us-east5, euro
|
|
|
136
158
|
|
|
137
159
|
| Model | Context | Max Tokens | Input | Reasoning | Price global (in/out) | Price regional (in/out) |
|
|
138
160
|
|-------|---------|------------|-------|-----------|----------------------|------------------------|
|
|
161
|
+
| claude-fable-5-2 | 1M | 128,000 | text, image | ✅ | $8.00/$40.00 | $8.80/$44.00 |
|
|
162
|
+
| claude-opus-5-5 | 1M | 128,000 | text, image | ✅ | $4.00/$20.00 | $4.40/$22.00 |
|
|
163
|
+
| claude-sonnet-5-5 | 1M | 128,000 | text, image | ✅ | $2.00/$10.00 | $2.20/$11.00 |
|
|
164
|
+
| claude-haiku-5-5 | 1M | 128,000 | text, image | ✅ | $0.10/$0.50 | $0.11/$0.55 |
|
|
165
|
+
| claude-fable-5-1 | 1M | 128,000 | text, image | ✅ | $10.00/$50.00 | $11.00/$55.00 |
|
|
166
|
+
| claude-opus-5 | 1M | 128,000 | text, image | ✅ | $5.00/$25.00 | $5.50/$27.50 |
|
|
167
|
+
| claude-sonnet-5 | 1M | 128,000 | text, image | ✅ | $2.00/$10.00 | $2.20/$11.00 |
|
|
168
|
+
| claude-fable-5 | 1M | 128,000 | text, image | ✅ | $10.00/$50.00 | $11.00/$55.00 |
|
|
139
169
|
| claude-opus-4-8 | 1M | 128,000 | text, image | ✅ | $5.00/$25.00 | $5.50/$27.50 |
|
|
140
170
|
| claude-opus-4-7 | 1M | 128,000 | text, image | ✅ | $5.00/$25.00 | $5.50/$27.50 |
|
|
141
171
|
| claude-opus-4-6 | 1M | 128,000 | text, image | ✅ | $5.00/$25.00 | $5.50/$27.50 |
|
|
@@ -146,15 +176,22 @@ Prices shown are for the **global** endpoint. Non-global regions (us-east5, euro
|
|
|
146
176
|
| claude-opus-4-1 | 200K | 32,000 | text, image | ✅ | $15.00/$75.00 | (uniform) |
|
|
147
177
|
| claude-opus-4 | 200K | 32,000 | text, image | ✅ | $15.00/$75.00 | (uniform) |
|
|
148
178
|
| claude-sonnet-4 | 200K | 64,000 | text, image | ✅ | $3.00/$15.00 | (uniform) |
|
|
149
|
-
| claude-3-5-sonnet-v2 | 200K | 8,192 | text, image | ❌ | $3.00/$15.00 | (uniform) |
|
|
150
179
|
|
|
151
|
-
|
|
180
|
+
Claude 5, 5.5, and Fable models require provider data sharing on your project's publisher model config. Without it Vertex returns HTTP 403 asking you to set `PublisherModelConfig.data_sharing_enabled_provider`. Fable 5.1 and 5.2 also require the Advanced AI Safety Addendum in Model Garden. Every Claude model must be enabled on its Model Garden card first; until then Vertex returns HTTP 404.
|
|
181
|
+
|
|
182
|
+
`claude-haiku-5-5` prices apply below 100K input tokens. At 100K input tokens or more, every token in the request bills at 5x. Claude 3.5 Sonnet v2 was shut down on Vertex on 2026-02-19 and has been removed.
|
|
183
|
+
|
|
184
|
+
### Meta Models
|
|
152
185
|
|
|
153
186
|
| Model | Context | Max Tokens | Input | Reasoning | Price (in/out) | Region |
|
|
154
187
|
|-------|---------|------------|-------|-----------|----------------|--------|
|
|
188
|
+
| muse-wonder-1.0 | 1M | 128,000 | text, image | ✅ | $4.00/$20.00 | global |
|
|
189
|
+
| muse-spark-1.3 | 1M | 128,000 | text, image | ✅ | $1.25/$4.25 | global |
|
|
190
|
+
| muse-ember-1.0 | 1M | 128,000 | text, image | ✅ | $0.10/$0.50 | global |
|
|
155
191
|
| llama-4-maverick | 524K | 32,000 | text | ✅ | $0.35/$1.15 | global |
|
|
156
192
|
| llama-4-scout | 1,310K | 32,000 | text | ✅ | $0.25/$0.70 | global |
|
|
157
|
-
|
|
193
|
+
|
|
194
|
+
The Muse models are in Preview. They run only on the global endpoint and only through Meta's stateless Responses API (`publishers/meta/v1/responses`), which pi-vertex calls for them automatically. Their 1,048,576-token context covers input and output together; 128,000 is the default output cap. Reasoning effort is `minimal` to `xhigh`; `muse-ember-1.0` also accepts `max`. At thinking level `off`, pi-vertex sends no effort and the model uses its default. Above 200K input tokens, `muse-ember-1.0` bills every token at 3x.
|
|
158
195
|
|
|
159
196
|
### Other MaaS Models
|
|
160
197
|
|
|
@@ -164,25 +201,19 @@ Prices shown are for the **global** endpoint. Non-global regions (us-east5, euro
|
|
|
164
201
|
| mistral-small-3.1 | 128K | mistralai | $0.10/$0.30 | global |
|
|
165
202
|
| mistral-ocr | 30 pages | mistralai | $0.0005/page | global |
|
|
166
203
|
| codestral-2 | 128K | mistralai | $0.30/$0.90 | global |
|
|
167
|
-
| deepseek-
|
|
168
|
-
| deepseek-v3.1 | 163K | deepseek-ai | $0.60/$1.70 | global |
|
|
169
|
-
| deepseek-r1 | 163K | deepseek-ai | $1.35/$5.40 | global |
|
|
170
|
-
| deepseek-ocr | Varies | deepseek-ai | $0.0003/page | global |
|
|
171
|
-
| qwen3-235b | 262K | qwen | $0.22/$0.88 | global |
|
|
172
|
-
| qwen3-next-instruct | 262K | qwen | $0.15/$1.20 | global |
|
|
173
|
-
| qwen3-next-thinking | 262K | qwen | $0.15/$1.20 | global |
|
|
174
|
-
| qwen3-coder | 262K | qwen | $0.22/$1.80 | global |
|
|
204
|
+
| deepseek-v4.1-flash | 1M | deepseek-ai | $0.30/$1.20 | global |
|
|
175
205
|
| gpt-oss-120b | 131K | openai | $0.09/$0.36 | global |
|
|
176
|
-
|
|
|
177
|
-
|
|
|
178
|
-
|
|
|
179
|
-
| glm-5 | 200K | zai-org | $1.00/$3.20 | global |
|
|
180
|
-
| glm-4.7 | 200K | zai-org | $0.60/$2.20 | global |
|
|
206
|
+
| glm-5.2 | 1M | zai-org | $1.40/$4.40 | global |
|
|
207
|
+
| grok-4.7 | 524K | xai | $2.00/$6.00 | global |
|
|
208
|
+
| grok-4.6 | 524K | xai | $2.00/$6.00 | global |
|
|
181
209
|
| grok-4.3 | 1M | xai | $1.25/$2.50 | global |
|
|
182
210
|
| grok-4.20-reasoning | 1M | xai | $1.25/$2.50 | global |
|
|
183
|
-
| grok-4.1-fast-reasoning | 2M | xai | $0.20/$0.50 | global |
|
|
184
211
|
| gemma-4-26b-a4b-it | 262K | google | $0.15/$0.60 | global |
|
|
185
212
|
|
|
213
|
+
`deepseek-v4.1-flash` accepts text and image input. It thinks only when a reasoning effort is set (`minimal` to `high`, or `max`); at thinking level `off` it answers without thinking.
|
|
214
|
+
|
|
215
|
+
**Retired:** Google shut down these open model endpoints on 2026-10-21, and they have been removed: `deepseek-v3.2`, `deepseek-v3.1`, `deepseek-r1`, `deepseek-ocr`, `qwen3-235b`, `qwen3-next-instruct`, `qwen3-next-thinking`, `qwen3-coder`, `gpt-oss-20b`, `kimi-k2-thinking`, `minimax-m2`, `glm-5`, `glm-4.7`, and `llama-3.3-70b`. `grok-4.1-fast-reasoning` was shut down on 2026-08-20 and has also been removed.
|
|
216
|
+
|
|
186
217
|
## Regional Endpoints
|
|
187
218
|
|
|
188
219
|
Models use different endpoints based on availability:
|
|
@@ -227,8 +258,8 @@ export GOOGLE_CLOUD_LOCATION=us-central1
|
|
|
227
258
|
- `@google/genai`: Google GenAI SDK for Gemini models
|
|
228
259
|
- `@anthropic-ai/vertex-sdk`: Official Anthropic-on-Vertex SDK for Claude models (native streaming)
|
|
229
260
|
- `google-auth-library`: ADC authentication for all models
|
|
230
|
-
- `@
|
|
231
|
-
- `@
|
|
261
|
+
- `@earendil-works/pi-ai`: Peer dependency
|
|
262
|
+
- `@earendil-works/pi-coding-agent`: Peer dependency
|
|
232
263
|
|
|
233
264
|
## Acknowledgments
|
|
234
265
|
|
package/TEST_COVERAGE.md
CHANGED
|
@@ -1,14 +1,34 @@
|
|
|
1
1
|
# Test Coverage
|
|
2
2
|
|
|
3
3
|
## Current Status
|
|
4
|
-
- Automated tests:
|
|
5
|
-
- Lint/type checks: `npm run check`
|
|
4
|
+
- Automated tests: `npm test` runs `tests/first-byte-timeout-check.mjs`. It covers a dead stream, a slow-starting stream, and keepalive stripping on the Chat Completions URL. Since v1.3.0 it also covers a dead stream on the publisher Responses API URL (Muse). Against the v1.2.7 filter, that new case hangs instead of failing fast.
|
|
5
|
+
- Lint/type checks: `npm run check` is still a no-op placeholder. `tsc --noEmit` (TypeScript 5) passes clean as of v1.3.0.
|
|
6
6
|
|
|
7
7
|
## Manual Verification
|
|
8
8
|
- Claude 4.6 streaming verified via Anthropic Vertex SDK.
|
|
9
9
|
- Mid-session model switching (tool call replay) verified interactively in pi.
|
|
10
10
|
- Registry sanity checks verified locally for `claude-opus-4-8` and `grok-4.3` after model additions.
|
|
11
|
+
- v1.2.2 catalog checks run against `models/index.ts`: 52 models load, no duplicate ids, the retired `gemini-2.0-*` ids no longer resolve, and `gemini-3.8-flash`, `glm-5.2`, and `grok-4.6` resolve with their expected API ids, context windows, output caps, and pricing.
|
|
12
|
+
- v1.2.5 catalog checks: 55 models load, no duplicate ids, and `claude-opus-5-5`, `claude-sonnet-5-5`, `claude-fable-5-1` resolve with Vertex API ids (no date suffix), 1M context, 128K max output, and published global/regional prices.
|
|
13
|
+
- v1.2.1 streaming source check confirms Gemini 3.8 uses the Gemini 3 `thinkingLevel` path and floors unsupported `minimal` effort to `low`.
|
|
14
|
+
- `bun build index.ts --outdir /tmp/pi-vertex-build-maas --target node` completes successfully.
|
|
15
|
+
- v1.3.0 catalog checks: 49 models load with no duplicate ids. The id diff against v1.2.7 is exactly 8 added and 16 removed. Of the surviving entries, only GLM 5.2's cacheRead changed. `getSupportedThinkingLevels` returns these sets:
|
|
16
|
+
- Hydrogen: off/low/medium/high/xhigh
|
|
17
|
+
- Carbon and Argon: off/low/medium/high
|
|
18
|
+
- Muse Wonder and Spark: off/minimal..xhigh
|
|
19
|
+
- Muse Ember: those levels plus max
|
|
20
|
+
- DeepSeek V4.1 Flash: off/minimal..high/max
|
|
21
|
+
- v1.3.0 live checks, run 2026-11-15 on the global endpoint through `streamVertex`. Each was a two-turn tool round trip: the model calls `get_weather`, gets the tool result, and answers.
|
|
22
|
+
- Passed: `gemini-4-hydrogen` (default, `minimal`→LOW, `xhigh`→XHIGH), `gemini-4-carbon` (`medium`, `minimal`→LOW), `gemini-4-argon` (`xhigh`→HIGH), `muse-wonder-1.0` (`xhigh`, `medium`), `muse-spark-1.3` (default), `muse-ember-1.0` (`max`, `minimal` with `sessionId`), `deepseek-v4.1-flash` (off, `high`, `max`), `glm-5.2`.
|
|
23
|
+
- Regression checks also passed: `grok-4.6`, `grok-4.3`, `claude-sonnet-5-5`, `gpt-oss-120b`, `gemini-3.8-flash`.
|
|
24
|
+
- The request bodies were captured with a fetch spy. They confirmed the thinking level or effort sent for each case, `store: false` and encrypted reasoning replay on Muse, and that `reasoning_effort` is omitted for DeepSeek at off.
|
|
25
|
+
- v1.3.0 Pi end-to-end: `pi -ne -e ./index.ts -p` answered on `vertex/muse-wonder-1.0:xhigh`, `muse-ember-1.0:max`, `gemini-4-hydrogen:xhigh`, `gemini-4-carbon:xhigh` (clamped to high), and `deepseek-v4.1-flash:high`. `--list-models` shows all 8 new ids.
|
|
26
|
+
- Direct API probes confirmed the reasoning effort values each model accepts. Muse Wonder and Spark accept minimal..xhigh, and Muse Ember adds max; all three reject `none`. DeepSeek V4.1 Flash accepts minimal/low/medium/high/max and rejects `xhigh` and `none`. All 16 removed ids return HTTP 404.
|
|
11
27
|
|
|
12
28
|
## Gaps / Next Steps
|
|
29
|
+
- **No live request has succeeded against `claude-fable-5-2`, `claude-haiku-5-5`, or `grok-4.7`.** All three return HTTP 404 ("not found or your project does not have access") because they are not enabled in the test project's Model Garden. Their API ids, limits, and prices come from the Google Cloud model pages and the pricing page.
|
|
30
|
+
- No live request has been made against `gemini-3.7-flash`, `gemini-3.6-flash`, `gemini-3.5-flash-lite`, `claude-opus-5-5`, `claude-fable-5-1`, `claude-opus-5`, or `claude-sonnet-5`.
|
|
31
|
+
- Promotion of `gemini-3.1-flash-lite` off its `-preview` API id is likewise unverified against a live endpoint.
|
|
13
32
|
- Add automated integration tests for Anthropic Vertex streaming and tool replay.
|
|
14
33
|
- Add unit tests for message normalization and replay sequencing.
|
|
34
|
+
- Add a catalog regression test so retired model ids cannot silently linger in the registry again.
|
package/auth.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Resolution order for each value: config file → env var → default
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { GoogleAuth } from "google-auth-library";
|
|
9
8
|
import { existsSync } from "fs";
|
|
10
9
|
import { join } from "path";
|
|
11
10
|
import { homedir } from "os";
|
|
@@ -84,6 +83,7 @@ export function getAuthConfig(preferredRegion?: string): AuthConfig {
|
|
|
84
83
|
*/
|
|
85
84
|
export async function getAccessToken(): Promise<string> {
|
|
86
85
|
const config = loadConfig();
|
|
86
|
+
const { GoogleAuth } = await import("google-auth-library");
|
|
87
87
|
const auth = new GoogleAuth({
|
|
88
88
|
scopes: ["https://www.googleapis.com/auth/cloud-platform"],
|
|
89
89
|
...(config.googleApplicationCredentials ? { keyFile: config.googleApplicationCredentials } : {}),
|
package/config.ts
CHANGED
package/index.ts
CHANGED
|
@@ -21,14 +21,18 @@
|
|
|
21
21
|
* GOOGLE_APPLICATION_CREDENTIALS (optional, for service account auth)
|
|
22
22
|
*
|
|
23
23
|
* Usage:
|
|
24
|
+
* pi --provider vertex --model claude-opus-5-5
|
|
24
25
|
* pi --provider vertex --model claude-opus-4-8
|
|
26
|
+
* pi --provider vertex --model grok-4.6
|
|
25
27
|
* pi --provider vertex --model grok-4.3
|
|
28
|
+
* pi --provider vertex --model glm-5.2
|
|
29
|
+
* pi --provider vertex --model gemini-3.8-flash
|
|
26
30
|
* pi --provider vertex --model gemini-2.5-pro
|
|
27
31
|
* pi --provider vertex --model llama-4-maverick
|
|
28
32
|
*/
|
|
29
33
|
|
|
30
|
-
import type { ExtensionAPI } from "@
|
|
31
|
-
import type { Model, Api } from "@
|
|
34
|
+
import type { ExtensionAPI, ProviderModelConfig } from "@earendil-works/pi-coding-agent";
|
|
35
|
+
import type { Model, Api } from "@earendil-works/pi-ai";
|
|
32
36
|
import { ALL_MODELS, getModelById } from "./models/index.js";
|
|
33
37
|
import { hasAdcCredentials, resolveProjectId } from "./auth.js";
|
|
34
38
|
import { loadConfig, getConfigPath } from "./config.js";
|
|
@@ -36,16 +40,19 @@ import { streamVertex } from "./streaming/index.js";
|
|
|
36
40
|
import type { VertexModelConfig } from "./types.js";
|
|
37
41
|
|
|
38
42
|
/**
|
|
39
|
-
* Convert Vertex model config to Pi model
|
|
43
|
+
* Convert Vertex model config to Pi's per-model provider config.
|
|
44
|
+
* No `baseUrl`/`provider` here: those live on the provider config passed to
|
|
45
|
+
* registerProvider, and per-model entries must omit baseUrl so pi-coding-agent's
|
|
46
|
+
* `definition.baseUrl ?? providerConfig.baseUrl` fallback can apply (an explicit
|
|
47
|
+
* "" defeats that nullish-coalescing fallback and fails provider registration).
|
|
40
48
|
*/
|
|
41
|
-
function toPiModel(config: VertexModelConfig):
|
|
49
|
+
function toPiModel(config: VertexModelConfig): ProviderModelConfig {
|
|
42
50
|
return {
|
|
43
51
|
id: config.id,
|
|
44
52
|
name: config.name,
|
|
45
53
|
api: "vertex-unified",
|
|
46
|
-
provider: "vertex",
|
|
47
|
-
baseUrl: "", // Will be set dynamically
|
|
48
54
|
reasoning: config.reasoning,
|
|
55
|
+
thinkingLevelMap: config.thinkingLevelMap,
|
|
49
56
|
input: config.input,
|
|
50
57
|
cost: config.cost,
|
|
51
58
|
contextWindow: config.contextWindow,
|
|
@@ -118,7 +125,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
118
125
|
];
|
|
119
126
|
pi.on("session_start", async (_event, ctx) => {
|
|
120
127
|
ctx.ui.setWidget("pi-vertex-startup", (_tui, theme) => ({
|
|
121
|
-
render
|
|
128
|
+
// A line wider than the terminal is a fatal render error in Pi. These lines are ASCII
|
|
129
|
+
// (GCP project ids are [a-z0-9-]), so length is their width.
|
|
130
|
+
render: (width: number) => [...vertexStartupLines.map(l => theme.fg("muted", l.length > width ? `${l.slice(0, Math.max(0, width - 1))}…` : l)), ""],
|
|
122
131
|
invalidate: () => {},
|
|
123
132
|
}));
|
|
124
133
|
});
|