@ssweens/pi-vertex 1.0.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/LICENSE +21 -0
- package/README.md +226 -0
- package/auth.ts +108 -0
- package/config.ts +63 -0
- package/index.ts +134 -0
- package/models/claude.ts +246 -0
- package/models/gemini.ts +162 -0
- package/models/index.ts +24 -0
- package/models/maas.ts +462 -0
- package/package.json +47 -0
- package/screenshot.png +0 -0
- package/streaming/gemini.ts +164 -0
- package/streaming/index.ts +25 -0
- package/streaming/maas.ts +97 -0
- package/types.ts +76 -0
- package/utils.ts +194 -0
package/models/claude.ts
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude model definitions for Vertex AI
|
|
3
|
+
* Pricing: https://cloud.google.com/vertex-ai/generative-ai/pricing#partner-models
|
|
4
|
+
* All prices per 1M tokens (as of Feb 2025)
|
|
5
|
+
* Cache write prices shown are for 5-minute TTL
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { VertexModelConfig } from "../types.js";
|
|
9
|
+
|
|
10
|
+
export const CLAUDE_MODELS: VertexModelConfig[] = [
|
|
11
|
+
// Claude 4.6 series - latest, supports global endpoint
|
|
12
|
+
{
|
|
13
|
+
id: "claude-opus-4-6",
|
|
14
|
+
name: "Claude Opus 4.6",
|
|
15
|
+
apiId: "claude-opus-4-6",
|
|
16
|
+
publisher: "anthropic",
|
|
17
|
+
endpointType: "maas",
|
|
18
|
+
contextWindow: 200000,
|
|
19
|
+
maxTokens: 32000,
|
|
20
|
+
input: ["text", "image"],
|
|
21
|
+
reasoning: true,
|
|
22
|
+
tools: true,
|
|
23
|
+
cost: {
|
|
24
|
+
input: 5.00,
|
|
25
|
+
output: 25.00,
|
|
26
|
+
cacheRead: 0.50,
|
|
27
|
+
cacheWrite: 6.25,
|
|
28
|
+
},
|
|
29
|
+
region: "global",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "claude-sonnet-4-6",
|
|
33
|
+
name: "Claude Sonnet 4.6",
|
|
34
|
+
apiId: "claude-sonnet-4-6",
|
|
35
|
+
publisher: "anthropic",
|
|
36
|
+
endpointType: "maas",
|
|
37
|
+
contextWindow: 200000,
|
|
38
|
+
maxTokens: 64000,
|
|
39
|
+
input: ["text", "image"],
|
|
40
|
+
reasoning: true,
|
|
41
|
+
tools: true,
|
|
42
|
+
cost: {
|
|
43
|
+
input: 3.00,
|
|
44
|
+
output: 15.00,
|
|
45
|
+
cacheRead: 0.30,
|
|
46
|
+
cacheWrite: 3.75,
|
|
47
|
+
},
|
|
48
|
+
region: "global",
|
|
49
|
+
},
|
|
50
|
+
// Claude 4.5 series - supports global endpoint
|
|
51
|
+
{
|
|
52
|
+
id: "claude-opus-4-5",
|
|
53
|
+
name: "Claude Opus 4.5",
|
|
54
|
+
apiId: "claude-opus-4-5@20251101",
|
|
55
|
+
publisher: "anthropic",
|
|
56
|
+
endpointType: "maas",
|
|
57
|
+
contextWindow: 200000,
|
|
58
|
+
maxTokens: 32000,
|
|
59
|
+
input: ["text", "image"],
|
|
60
|
+
reasoning: true,
|
|
61
|
+
tools: true,
|
|
62
|
+
cost: {
|
|
63
|
+
input: 5.00,
|
|
64
|
+
output: 25.00,
|
|
65
|
+
cacheRead: 0.50,
|
|
66
|
+
cacheWrite: 6.25,
|
|
67
|
+
},
|
|
68
|
+
region: "global",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: "claude-sonnet-4-5",
|
|
72
|
+
name: "Claude Sonnet 4.5",
|
|
73
|
+
apiId: "claude-sonnet-4-5@20250929",
|
|
74
|
+
publisher: "anthropic",
|
|
75
|
+
endpointType: "maas",
|
|
76
|
+
contextWindow: 200000,
|
|
77
|
+
maxTokens: 64000,
|
|
78
|
+
input: ["text", "image"],
|
|
79
|
+
reasoning: true,
|
|
80
|
+
tools: true,
|
|
81
|
+
cost: {
|
|
82
|
+
input: 3.00,
|
|
83
|
+
output: 15.00,
|
|
84
|
+
cacheRead: 0.30,
|
|
85
|
+
cacheWrite: 3.75,
|
|
86
|
+
},
|
|
87
|
+
region: "global",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "claude-haiku-4-5",
|
|
91
|
+
name: "Claude Haiku 4.5",
|
|
92
|
+
apiId: "claude-haiku-4-5@20251001",
|
|
93
|
+
publisher: "anthropic",
|
|
94
|
+
endpointType: "maas",
|
|
95
|
+
contextWindow: 200000,
|
|
96
|
+
maxTokens: 64000,
|
|
97
|
+
input: ["text", "image"],
|
|
98
|
+
reasoning: true,
|
|
99
|
+
tools: true,
|
|
100
|
+
cost: {
|
|
101
|
+
input: 1.00,
|
|
102
|
+
output: 5.00,
|
|
103
|
+
cacheRead: 0.10,
|
|
104
|
+
cacheWrite: 1.25,
|
|
105
|
+
},
|
|
106
|
+
region: "global",
|
|
107
|
+
},
|
|
108
|
+
// Claude 4.1 series - regional pricing
|
|
109
|
+
{
|
|
110
|
+
id: "claude-opus-4-1",
|
|
111
|
+
name: "Claude Opus 4.1",
|
|
112
|
+
apiId: "claude-opus-4-1@20250805",
|
|
113
|
+
publisher: "anthropic",
|
|
114
|
+
endpointType: "maas",
|
|
115
|
+
contextWindow: 200000,
|
|
116
|
+
maxTokens: 32000,
|
|
117
|
+
input: ["text", "image"],
|
|
118
|
+
reasoning: true,
|
|
119
|
+
tools: true,
|
|
120
|
+
cost: {
|
|
121
|
+
input: 15.00,
|
|
122
|
+
output: 75.00,
|
|
123
|
+
cacheRead: 1.50,
|
|
124
|
+
cacheWrite: 18.75,
|
|
125
|
+
},
|
|
126
|
+
region: "us-east5",
|
|
127
|
+
},
|
|
128
|
+
// Claude 4.0 series - regional pricing
|
|
129
|
+
{
|
|
130
|
+
id: "claude-opus-4",
|
|
131
|
+
name: "Claude Opus 4",
|
|
132
|
+
apiId: "claude-opus-4@20250514",
|
|
133
|
+
publisher: "anthropic",
|
|
134
|
+
endpointType: "maas",
|
|
135
|
+
contextWindow: 200000,
|
|
136
|
+
maxTokens: 32000,
|
|
137
|
+
input: ["text", "image"],
|
|
138
|
+
reasoning: true,
|
|
139
|
+
tools: true,
|
|
140
|
+
cost: {
|
|
141
|
+
input: 15.00,
|
|
142
|
+
output: 75.00,
|
|
143
|
+
cacheRead: 1.50,
|
|
144
|
+
cacheWrite: 18.75,
|
|
145
|
+
},
|
|
146
|
+
region: "us-east5",
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
id: "claude-sonnet-4",
|
|
150
|
+
name: "Claude Sonnet 4",
|
|
151
|
+
apiId: "claude-sonnet-4@20250514",
|
|
152
|
+
publisher: "anthropic",
|
|
153
|
+
endpointType: "maas",
|
|
154
|
+
contextWindow: 200000,
|
|
155
|
+
maxTokens: 64000,
|
|
156
|
+
input: ["text", "image"],
|
|
157
|
+
reasoning: true,
|
|
158
|
+
tools: true,
|
|
159
|
+
cost: {
|
|
160
|
+
input: 3.00,
|
|
161
|
+
output: 15.00,
|
|
162
|
+
cacheRead: 0.30,
|
|
163
|
+
cacheWrite: 3.75,
|
|
164
|
+
},
|
|
165
|
+
region: "us-east5",
|
|
166
|
+
},
|
|
167
|
+
// Claude 3.7 series - regional pricing
|
|
168
|
+
{
|
|
169
|
+
id: "claude-3-7-sonnet",
|
|
170
|
+
name: "Claude 3.7 Sonnet",
|
|
171
|
+
apiId: "claude-3-7-sonnet@20250219",
|
|
172
|
+
publisher: "anthropic",
|
|
173
|
+
endpointType: "maas",
|
|
174
|
+
contextWindow: 200000,
|
|
175
|
+
maxTokens: 64000,
|
|
176
|
+
input: ["text", "image"],
|
|
177
|
+
reasoning: true,
|
|
178
|
+
tools: true,
|
|
179
|
+
cost: {
|
|
180
|
+
input: 3.0,
|
|
181
|
+
output: 15.0,
|
|
182
|
+
cacheRead: 0.3,
|
|
183
|
+
cacheWrite: 3.75,
|
|
184
|
+
},
|
|
185
|
+
region: "us-east5",
|
|
186
|
+
},
|
|
187
|
+
// Claude 3.5 series - regional pricing
|
|
188
|
+
{
|
|
189
|
+
id: "claude-3-5-sonnet-v2",
|
|
190
|
+
name: "Claude 3.5 Sonnet v2",
|
|
191
|
+
apiId: "claude-3-5-sonnet-v2@20241022",
|
|
192
|
+
publisher: "anthropic",
|
|
193
|
+
endpointType: "maas",
|
|
194
|
+
contextWindow: 200000,
|
|
195
|
+
maxTokens: 8192,
|
|
196
|
+
input: ["text", "image"],
|
|
197
|
+
reasoning: false,
|
|
198
|
+
tools: true,
|
|
199
|
+
cost: {
|
|
200
|
+
input: 3.0,
|
|
201
|
+
output: 15.0,
|
|
202
|
+
cacheRead: 0.3,
|
|
203
|
+
cacheWrite: 3.75,
|
|
204
|
+
},
|
|
205
|
+
region: "us-east5",
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
id: "claude-3-5-sonnet",
|
|
209
|
+
name: "Claude 3.5 Sonnet",
|
|
210
|
+
apiId: "claude-3-5-sonnet@20240620",
|
|
211
|
+
publisher: "anthropic",
|
|
212
|
+
endpointType: "maas",
|
|
213
|
+
contextWindow: 200000,
|
|
214
|
+
maxTokens: 8192,
|
|
215
|
+
input: ["text", "image"],
|
|
216
|
+
reasoning: false,
|
|
217
|
+
tools: true,
|
|
218
|
+
cost: {
|
|
219
|
+
input: 3.0,
|
|
220
|
+
output: 15.0,
|
|
221
|
+
cacheRead: 0.3,
|
|
222
|
+
cacheWrite: 3.75,
|
|
223
|
+
},
|
|
224
|
+
region: "us-east5",
|
|
225
|
+
},
|
|
226
|
+
// Claude 3 Haiku - regional pricing
|
|
227
|
+
{
|
|
228
|
+
id: "claude-3-haiku",
|
|
229
|
+
name: "Claude 3 Haiku",
|
|
230
|
+
apiId: "claude-3-haiku@20240307",
|
|
231
|
+
publisher: "anthropic",
|
|
232
|
+
endpointType: "maas",
|
|
233
|
+
contextWindow: 200000,
|
|
234
|
+
maxTokens: 4096,
|
|
235
|
+
input: ["text"],
|
|
236
|
+
reasoning: false,
|
|
237
|
+
tools: true,
|
|
238
|
+
cost: {
|
|
239
|
+
input: 0.25,
|
|
240
|
+
output: 1.25,
|
|
241
|
+
cacheRead: 0.03,
|
|
242
|
+
cacheWrite: 0.3,
|
|
243
|
+
},
|
|
244
|
+
region: "us-east5",
|
|
245
|
+
},
|
|
246
|
+
];
|
package/models/gemini.ts
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gemini model definitions for Vertex AI
|
|
3
|
+
* Pricing: https://cloud.google.com/vertex-ai/generative-ai/pricing#gemini-models
|
|
4
|
+
* All prices per 1M tokens (Standard tier pricing, as of Feb 2026)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { VertexModelConfig } from "../types.js";
|
|
8
|
+
|
|
9
|
+
export const GEMINI_MODELS: VertexModelConfig[] = [
|
|
10
|
+
{
|
|
11
|
+
id: "gemini-3.1-pro",
|
|
12
|
+
name: "Gemini 3.1 Pro",
|
|
13
|
+
apiId: "gemini-3.1-pro-preview",
|
|
14
|
+
publisher: "google",
|
|
15
|
+
endpointType: "gemini",
|
|
16
|
+
contextWindow: 1000000,
|
|
17
|
+
maxTokens: 64000,
|
|
18
|
+
input: ["text", "image"],
|
|
19
|
+
reasoning: true,
|
|
20
|
+
tools: true,
|
|
21
|
+
cost: {
|
|
22
|
+
input: 2.00,
|
|
23
|
+
output: 12.00,
|
|
24
|
+
cacheRead: 0,
|
|
25
|
+
cacheWrite: 0,
|
|
26
|
+
},
|
|
27
|
+
region: "global",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "gemini-3-pro",
|
|
31
|
+
name: "Gemini 3 Pro",
|
|
32
|
+
apiId: "gemini-3-pro-preview",
|
|
33
|
+
publisher: "google",
|
|
34
|
+
endpointType: "gemini",
|
|
35
|
+
contextWindow: 2000000,
|
|
36
|
+
maxTokens: 8192,
|
|
37
|
+
input: ["text", "image"],
|
|
38
|
+
reasoning: true,
|
|
39
|
+
tools: true,
|
|
40
|
+
cost: {
|
|
41
|
+
input: 1.25,
|
|
42
|
+
output: 10.00,
|
|
43
|
+
cacheRead: 0.125,
|
|
44
|
+
cacheWrite: 0,
|
|
45
|
+
},
|
|
46
|
+
region: "global",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "gemini-3-flash",
|
|
50
|
+
name: "Gemini 3 Flash",
|
|
51
|
+
apiId: "gemini-3-flash-preview",
|
|
52
|
+
publisher: "google",
|
|
53
|
+
endpointType: "gemini",
|
|
54
|
+
contextWindow: 1000000,
|
|
55
|
+
maxTokens: 8192,
|
|
56
|
+
input: ["text", "image"],
|
|
57
|
+
reasoning: true,
|
|
58
|
+
tools: true,
|
|
59
|
+
cost: {
|
|
60
|
+
input: 0.15,
|
|
61
|
+
output: 0.60,
|
|
62
|
+
cacheRead: 0.0375,
|
|
63
|
+
cacheWrite: 0,
|
|
64
|
+
},
|
|
65
|
+
region: "global",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "gemini-2.5-pro",
|
|
69
|
+
name: "Gemini 2.5 Pro",
|
|
70
|
+
apiId: "gemini-2.5-pro",
|
|
71
|
+
publisher: "google",
|
|
72
|
+
endpointType: "gemini",
|
|
73
|
+
contextWindow: 1000000,
|
|
74
|
+
maxTokens: 64000,
|
|
75
|
+
input: ["text", "image"],
|
|
76
|
+
reasoning: true,
|
|
77
|
+
tools: true,
|
|
78
|
+
cost: {
|
|
79
|
+
input: 1.25,
|
|
80
|
+
output: 10.00,
|
|
81
|
+
cacheRead: 0.125,
|
|
82
|
+
cacheWrite: 0,
|
|
83
|
+
},
|
|
84
|
+
region: "global",
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: "gemini-2.5-flash",
|
|
88
|
+
name: "Gemini 2.5 Flash",
|
|
89
|
+
apiId: "gemini-2.5-flash",
|
|
90
|
+
publisher: "google",
|
|
91
|
+
endpointType: "gemini",
|
|
92
|
+
contextWindow: 1000000,
|
|
93
|
+
maxTokens: 64000,
|
|
94
|
+
input: ["text", "image"],
|
|
95
|
+
reasoning: true,
|
|
96
|
+
tools: true,
|
|
97
|
+
cost: {
|
|
98
|
+
input: 0.30,
|
|
99
|
+
output: 2.50,
|
|
100
|
+
cacheRead: 0.030,
|
|
101
|
+
cacheWrite: 0,
|
|
102
|
+
},
|
|
103
|
+
region: "global",
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: "gemini-2.5-flash-lite",
|
|
107
|
+
name: "Gemini 2.5 Flash Lite",
|
|
108
|
+
apiId: "gemini-2.5-flash-lite",
|
|
109
|
+
publisher: "google",
|
|
110
|
+
endpointType: "gemini",
|
|
111
|
+
contextWindow: 1000000,
|
|
112
|
+
maxTokens: 64000,
|
|
113
|
+
input: ["text", "image"],
|
|
114
|
+
reasoning: true,
|
|
115
|
+
tools: true,
|
|
116
|
+
cost: {
|
|
117
|
+
input: 0.10,
|
|
118
|
+
output: 0.40,
|
|
119
|
+
cacheRead: 0.010,
|
|
120
|
+
cacheWrite: 0,
|
|
121
|
+
},
|
|
122
|
+
region: "global",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: "gemini-2.0-flash",
|
|
126
|
+
name: "Gemini 2.0 Flash",
|
|
127
|
+
apiId: "gemini-2.0-flash",
|
|
128
|
+
publisher: "google",
|
|
129
|
+
endpointType: "gemini",
|
|
130
|
+
contextWindow: 1000000,
|
|
131
|
+
maxTokens: 8192,
|
|
132
|
+
input: ["text", "image"],
|
|
133
|
+
reasoning: false,
|
|
134
|
+
tools: true,
|
|
135
|
+
cost: {
|
|
136
|
+
input: 0.15,
|
|
137
|
+
output: 0.60,
|
|
138
|
+
cacheRead: 0.025,
|
|
139
|
+
cacheWrite: 0,
|
|
140
|
+
},
|
|
141
|
+
region: "global",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "gemini-2.0-flash-lite",
|
|
145
|
+
name: "Gemini 2.0 Flash Lite",
|
|
146
|
+
apiId: "gemini-2.0-flash-lite",
|
|
147
|
+
publisher: "google",
|
|
148
|
+
endpointType: "gemini",
|
|
149
|
+
contextWindow: 1000000,
|
|
150
|
+
maxTokens: 8192,
|
|
151
|
+
input: ["text"],
|
|
152
|
+
reasoning: false,
|
|
153
|
+
tools: true,
|
|
154
|
+
cost: {
|
|
155
|
+
input: 0.075,
|
|
156
|
+
output: 0.30,
|
|
157
|
+
cacheRead: 0.01875,
|
|
158
|
+
cacheWrite: 0,
|
|
159
|
+
},
|
|
160
|
+
region: "global",
|
|
161
|
+
},
|
|
162
|
+
];
|
package/models/index.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export all Vertex AI model definitions
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { GEMINI_MODELS } from "./gemini.js";
|
|
6
|
+
import { CLAUDE_MODELS } from "./claude.js";
|
|
7
|
+
import { MAAS_MODELS } from "./maas.js";
|
|
8
|
+
import type { VertexModelConfig } from "../types.js";
|
|
9
|
+
|
|
10
|
+
export const ALL_MODELS: VertexModelConfig[] = [
|
|
11
|
+
...GEMINI_MODELS,
|
|
12
|
+
...CLAUDE_MODELS,
|
|
13
|
+
...MAAS_MODELS,
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export function getModelById(id: string): VertexModelConfig | undefined {
|
|
17
|
+
return ALL_MODELS.find((m) => m.id === id);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function getModelsByEndpointType(type: "gemini" | "maas"): VertexModelConfig[] {
|
|
21
|
+
return ALL_MODELS.filter((m) => m.endpointType === type);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { GEMINI_MODELS, CLAUDE_MODELS, MAAS_MODELS };
|