@oh-my-pi/pi-ai 8.0.20 → 8.2.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/README.md +11 -12
- package/package.json +49 -26
- package/src/cli.ts +7 -7
- package/src/index.ts +2 -1
- package/src/models.generated.ts +100 -101
- package/src/providers/amazon-bedrock.ts +12 -13
- package/src/providers/anthropic.ts +67 -37
- package/src/providers/cursor.ts +57 -57
- package/src/providers/google-gemini-cli-usage.ts +2 -2
- package/src/providers/google-gemini-cli.ts +8 -10
- package/src/providers/google-shared.ts +12 -13
- package/src/providers/google-vertex.ts +7 -7
- package/src/providers/google.ts +8 -8
- package/src/providers/openai-codex/request-transformer.ts +6 -6
- package/src/providers/openai-codex-responses.ts +28 -28
- package/src/providers/openai-completions.ts +39 -39
- package/src/providers/openai-responses.ts +31 -31
- package/src/providers/transform-messages.ts +3 -3
- package/src/storage.ts +29 -19
- package/src/stream.ts +6 -6
- package/src/types.ts +1 -2
- package/src/usage/claude.ts +4 -4
- package/src/usage/github-copilot.ts +3 -4
- package/src/usage/google-antigravity.ts +3 -3
- package/src/usage/openai-codex.ts +4 -4
- package/src/usage/zai.ts +3 -3
- package/src/usage.ts +0 -1
- package/src/utils/event-stream.ts +4 -4
- package/src/utils/oauth/anthropic.ts +0 -1
- package/src/utils/oauth/callback-server.ts +2 -3
- package/src/utils/oauth/github-copilot.ts +2 -3
- package/src/utils/oauth/google-antigravity.ts +0 -1
- package/src/utils/oauth/google-gemini-cli.ts +2 -3
- package/src/utils/oauth/index.ts +11 -12
- package/src/utils/oauth/openai-codex.ts +0 -1
- package/src/utils/overflow.ts +2 -2
- package/src/utils/retry.ts +78 -0
- package/src/utils/validation.ts +4 -5
- package/tsconfig.json +0 -42
package/README.md
CHANGED
|
@@ -231,7 +231,7 @@ const bookMeetingTool: Tool = {
|
|
|
231
231
|
Tool results use content blocks and can include both text and images:
|
|
232
232
|
|
|
233
233
|
```typescript
|
|
234
|
-
import
|
|
234
|
+
import * as fs from "node:fs";
|
|
235
235
|
|
|
236
236
|
const context: Context = {
|
|
237
237
|
messages: [{ role: "user", content: "What is the weather in London?" }],
|
|
@@ -260,7 +260,7 @@ for (const block of response.content) {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
// Tool results can also include images (for vision-capable models)
|
|
263
|
-
const imageBuffer = readFileSync("chart.png");
|
|
263
|
+
const imageBuffer = fs.readFileSync("chart.png");
|
|
264
264
|
context.messages.push({
|
|
265
265
|
role: "toolResult",
|
|
266
266
|
toolCallId: "tool_xyz",
|
|
@@ -379,7 +379,7 @@ All streaming events emitted during assistant message generation:
|
|
|
379
379
|
Models with vision capabilities can process images. You can check if a model supports images via the `input` property. If you pass images to a non-vision model, they are silently ignored.
|
|
380
380
|
|
|
381
381
|
```typescript
|
|
382
|
-
import
|
|
382
|
+
import * as fs from "node:fs";
|
|
383
383
|
import { getModel, complete } from "@oh-my-pi/pi-ai";
|
|
384
384
|
|
|
385
385
|
const model = getModel("openai", "gpt-4o-mini");
|
|
@@ -389,7 +389,7 @@ if (model.input.includes("image")) {
|
|
|
389
389
|
console.log("Model supports vision");
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
-
const imageBuffer = readFileSync("image.png");
|
|
392
|
+
const imageBuffer = fs.readFileSync("image.png");
|
|
393
393
|
const base64Image = imageBuffer.toString("base64");
|
|
394
394
|
|
|
395
395
|
const response = await complete(model, {
|
|
@@ -551,10 +551,9 @@ The abort signal allows you to cancel in-progress requests. Aborted requests hav
|
|
|
551
551
|
import { getModel, stream } from "@oh-my-pi/pi-ai";
|
|
552
552
|
|
|
553
553
|
const model = getModel("openai", "gpt-4o-mini");
|
|
554
|
-
const controller = new AbortController();
|
|
555
554
|
|
|
556
555
|
// Abort after 2 seconds
|
|
557
|
-
|
|
556
|
+
const signal = AbortSignal.timeout(2000);
|
|
558
557
|
|
|
559
558
|
const s = stream(
|
|
560
559
|
model,
|
|
@@ -562,7 +561,7 @@ const s = stream(
|
|
|
562
561
|
messages: [{ role: "user", content: "Write a long story" }],
|
|
563
562
|
},
|
|
564
563
|
{
|
|
565
|
-
signal
|
|
564
|
+
signal,
|
|
566
565
|
},
|
|
567
566
|
);
|
|
568
567
|
|
|
@@ -1022,7 +1021,7 @@ await loginOpenAICodex({
|
|
|
1022
1021
|
|
|
1023
1022
|
```typescript
|
|
1024
1023
|
import { loginGitHubCopilot } from "@oh-my-pi/pi-ai";
|
|
1025
|
-
import
|
|
1024
|
+
import * as fs from "node:fs";
|
|
1026
1025
|
|
|
1027
1026
|
const credentials = await loginGitHubCopilot({
|
|
1028
1027
|
onAuth: (url, instructions) => {
|
|
@@ -1037,7 +1036,7 @@ const credentials = await loginGitHubCopilot({
|
|
|
1037
1036
|
|
|
1038
1037
|
// Store credentials yourself
|
|
1039
1038
|
const auth = { "github-copilot": { type: "oauth", ...credentials } };
|
|
1040
|
-
writeFileSync("auth.json", JSON.stringify(auth, null, 2));
|
|
1039
|
+
fs.writeFileSync("auth.json", JSON.stringify(auth, null, 2));
|
|
1041
1040
|
```
|
|
1042
1041
|
|
|
1043
1042
|
### Using OAuth Tokens
|
|
@@ -1046,10 +1045,10 @@ Use `getOAuthApiKey()` to get an API key, automatically refreshing if expired:
|
|
|
1046
1045
|
|
|
1047
1046
|
```typescript
|
|
1048
1047
|
import { getModel, complete, getOAuthApiKey } from "@oh-my-pi/pi-ai";
|
|
1049
|
-
import
|
|
1048
|
+
import * as fs from "node:fs";
|
|
1050
1049
|
|
|
1051
1050
|
// Load your stored credentials
|
|
1052
|
-
const auth = JSON.parse(readFileSync("auth.json", "utf-8"));
|
|
1051
|
+
const auth = JSON.parse(fs.readFileSync("auth.json", "utf-8"));
|
|
1053
1052
|
|
|
1054
1053
|
// Get API key (refreshes if expired)
|
|
1055
1054
|
const result = await getOAuthApiKey("github-copilot", auth);
|
|
@@ -1057,7 +1056,7 @@ if (!result) throw new Error("Not logged in");
|
|
|
1057
1056
|
|
|
1058
1057
|
// Save refreshed credentials
|
|
1059
1058
|
auth["github-copilot"] = { type: "oauth", ...result.newCredentials };
|
|
1060
|
-
writeFileSync("auth.json", JSON.stringify(auth, null, 2));
|
|
1059
|
+
fs.writeFileSync("auth.json", JSON.stringify(auth, null, 2));
|
|
1061
1060
|
|
|
1062
1061
|
// Use the API key
|
|
1063
1062
|
const model = getModel("github-copilot", "gpt-4o");
|
package/package.json
CHANGED
|
@@ -1,38 +1,75 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-ai",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
7
7
|
"types": "./src/index.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./src/index.ts",
|
|
11
|
+
"import": "./src/index.ts"
|
|
12
|
+
},
|
|
13
|
+
"./models": {
|
|
14
|
+
"types": "./src/models.ts",
|
|
15
|
+
"import": "./src/models.ts"
|
|
16
|
+
},
|
|
17
|
+
"./models.generated": {
|
|
18
|
+
"types": "./src/models.generated.ts",
|
|
19
|
+
"import": "./src/models.generated.ts"
|
|
20
|
+
},
|
|
21
|
+
"./stream": {
|
|
22
|
+
"types": "./src/stream.ts",
|
|
23
|
+
"import": "./src/stream.ts"
|
|
24
|
+
},
|
|
25
|
+
"./types": {
|
|
26
|
+
"types": "./src/types.ts",
|
|
27
|
+
"import": "./src/types.ts"
|
|
28
|
+
},
|
|
29
|
+
"./usage": {
|
|
30
|
+
"types": "./src/usage.ts",
|
|
31
|
+
"import": "./src/usage.ts"
|
|
32
|
+
},
|
|
33
|
+
"./storage": {
|
|
34
|
+
"types": "./src/storage.ts",
|
|
35
|
+
"import": "./src/storage.ts"
|
|
36
|
+
},
|
|
37
|
+
"./providers/*": {
|
|
38
|
+
"types": "./src/providers/*.ts",
|
|
39
|
+
"import": "./src/providers/*.ts"
|
|
40
|
+
},
|
|
41
|
+
"./utils/*": {
|
|
42
|
+
"types": "./src/utils/*.ts",
|
|
43
|
+
"import": "./src/utils/*.ts"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
8
46
|
"bin": {
|
|
9
47
|
"pi-ai": "./src/cli.ts"
|
|
10
48
|
},
|
|
11
49
|
"files": [
|
|
12
50
|
"src",
|
|
13
|
-
"README.md"
|
|
14
|
-
"tsconfig.json"
|
|
51
|
+
"README.md"
|
|
15
52
|
],
|
|
16
53
|
"scripts": {
|
|
54
|
+
"check": "tsgo -p tsconfig.json",
|
|
17
55
|
"generate-models": "bun scripts/generate-models.ts",
|
|
18
|
-
"test": "bun test"
|
|
19
|
-
"prepublishOnly": "cp tsconfig.publish.json tsconfig.json"
|
|
56
|
+
"test": "bun test"
|
|
20
57
|
},
|
|
21
58
|
"dependencies": {
|
|
22
|
-
"@oh-my-pi/pi-utils": "8.0
|
|
23
|
-
"@anthropic-ai/sdk": "0.71.2",
|
|
24
|
-
"@aws-sdk/client-bedrock-runtime": "^3.
|
|
59
|
+
"@oh-my-pi/pi-utils": "8.2.0",
|
|
60
|
+
"@anthropic-ai/sdk": "^0.71.2",
|
|
61
|
+
"@aws-sdk/client-bedrock-runtime": "^3.975.0",
|
|
25
62
|
"@bufbuild/protobuf": "^2.10.2",
|
|
26
63
|
"@connectrpc/connect": "^2.1.1",
|
|
27
64
|
"@connectrpc/connect-node": "^2.1.1",
|
|
28
|
-
"@google/genai": "1.
|
|
29
|
-
"@mistralai/mistralai": "1.
|
|
65
|
+
"@google/genai": "^1.38.0",
|
|
66
|
+
"@mistralai/mistralai": "^1.13.0",
|
|
30
67
|
"@sinclair/typebox": "^0.34.41",
|
|
31
68
|
"ajv": "^8.17.1",
|
|
32
69
|
"ajv-formats": "^3.0.1",
|
|
33
70
|
"chalk": "^5.6.2",
|
|
34
71
|
"json5": "^2.2.3",
|
|
35
|
-
"openai": "6.
|
|
72
|
+
"openai": "^6.16.0",
|
|
36
73
|
"partial-json": "^0.1.7",
|
|
37
74
|
"zod-to-json-schema": "^3.24.6"
|
|
38
75
|
},
|
|
@@ -56,20 +93,6 @@
|
|
|
56
93
|
"bun": ">=1.0.0"
|
|
57
94
|
},
|
|
58
95
|
"devDependencies": {
|
|
59
|
-
"@types/node": "^
|
|
60
|
-
},
|
|
61
|
-
"exports": {
|
|
62
|
-
".": {
|
|
63
|
-
"types": "./src/index.ts",
|
|
64
|
-
"import": "./src/index.ts"
|
|
65
|
-
},
|
|
66
|
-
"./utils/*": {
|
|
67
|
-
"types": "./src/utils/*.ts",
|
|
68
|
-
"import": "./src/utils/*.ts"
|
|
69
|
-
},
|
|
70
|
-
"./*": {
|
|
71
|
-
"types": "./src/*",
|
|
72
|
-
"import": "./src/*"
|
|
73
|
-
}
|
|
96
|
+
"@types/node": "^25.0.10"
|
|
74
97
|
}
|
|
75
98
|
}
|
package/src/cli.ts
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { createInterface } from "readline";
|
|
3
3
|
import { CliAuthStorage } from "./storage";
|
|
4
4
|
import "./utils/migrate-env";
|
|
5
|
+
import { getOAuthProviders } from "./utils/oauth";
|
|
5
6
|
import { loginAnthropic } from "./utils/oauth/anthropic";
|
|
6
7
|
import { loginCursor } from "./utils/oauth/cursor";
|
|
7
8
|
import { loginGitHubCopilot } from "./utils/oauth/github-copilot";
|
|
8
9
|
import { loginAntigravity } from "./utils/oauth/google-antigravity";
|
|
9
10
|
import { loginGeminiCli } from "./utils/oauth/google-gemini-cli";
|
|
10
|
-
import { getOAuthProviders } from "./utils/oauth/index";
|
|
11
11
|
import { loginOpenAICodex } from "./utils/oauth/openai-codex";
|
|
12
12
|
import type { OAuthCredentials, OAuthProvider } from "./utils/oauth/types";
|
|
13
13
|
|
|
@@ -23,7 +23,7 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
23
23
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
24
24
|
|
|
25
25
|
const promptFn = (msg: string) => prompt(rl, `${msg} `);
|
|
26
|
-
const storage =
|
|
26
|
+
const storage = await CliAuthStorage.create();
|
|
27
27
|
|
|
28
28
|
try {
|
|
29
29
|
let credentials: OAuthCredentials;
|
|
@@ -91,7 +91,7 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
91
91
|
|
|
92
92
|
case "cursor":
|
|
93
93
|
credentials = await loginCursor(
|
|
94
|
-
|
|
94
|
+
url => {
|
|
95
95
|
console.log(`\nOpen this URL in your browser:\n${url}\n`);
|
|
96
96
|
},
|
|
97
97
|
() => {
|
|
@@ -145,7 +145,7 @@ Examples:
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
if (command === "status") {
|
|
148
|
-
const storage =
|
|
148
|
+
const storage = await CliAuthStorage.create();
|
|
149
149
|
try {
|
|
150
150
|
const providers = storage.listProviders();
|
|
151
151
|
if (providers.length === 0) {
|
|
@@ -179,7 +179,7 @@ Examples:
|
|
|
179
179
|
|
|
180
180
|
if (command === "logout") {
|
|
181
181
|
let provider = args[1] as OAuthProvider | undefined;
|
|
182
|
-
const storage =
|
|
182
|
+
const storage = await CliAuthStorage.create();
|
|
183
183
|
|
|
184
184
|
try {
|
|
185
185
|
if (!provider) {
|
|
@@ -243,7 +243,7 @@ Examples:
|
|
|
243
243
|
provider = PROVIDERS[index].id;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
if (!PROVIDERS.some(
|
|
246
|
+
if (!PROVIDERS.some(p => p.id === provider)) {
|
|
247
247
|
console.error(`Unknown provider: ${provider}`);
|
|
248
248
|
console.error(`Use 'bunx @oh-my-pi/pi-ai list' to see available providers`);
|
|
249
249
|
process.exit(1);
|
|
@@ -259,7 +259,7 @@ Examples:
|
|
|
259
259
|
process.exit(1);
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
main().catch(
|
|
262
|
+
main().catch(err => {
|
|
263
263
|
console.error("Error:", err.message);
|
|
264
264
|
process.exit(1);
|
|
265
265
|
});
|
package/src/index.ts
CHANGED
|
@@ -18,7 +18,8 @@ export * from "./usage/google-antigravity";
|
|
|
18
18
|
export * from "./usage/openai-codex";
|
|
19
19
|
export * from "./usage/zai";
|
|
20
20
|
export * from "./utils/event-stream";
|
|
21
|
-
export * from "./utils/oauth
|
|
21
|
+
export * from "./utils/oauth";
|
|
22
22
|
export * from "./utils/overflow";
|
|
23
|
+
export * from "./utils/retry";
|
|
23
24
|
export * from "./utils/typebox-helpers";
|
|
24
25
|
export * from "./utils/validation";
|
package/src/models.generated.ts
CHANGED
|
@@ -1726,7 +1726,7 @@ export const MODELS = {
|
|
|
1726
1726
|
cacheRead: 0,
|
|
1727
1727
|
cacheWrite: 0,
|
|
1728
1728
|
},
|
|
1729
|
-
contextWindow:
|
|
1729
|
+
contextWindow: 64000,
|
|
1730
1730
|
maxTokens: 16384,
|
|
1731
1731
|
} satisfies Model<"openai-completions">,
|
|
1732
1732
|
"gpt-4o": {
|
|
@@ -1766,24 +1766,6 @@ export const MODELS = {
|
|
|
1766
1766
|
contextWindow: 128000,
|
|
1767
1767
|
maxTokens: 128000,
|
|
1768
1768
|
} satisfies Model<"openai-responses">,
|
|
1769
|
-
"gpt-5-codex": {
|
|
1770
|
-
id: "gpt-5-codex",
|
|
1771
|
-
name: "GPT-5-Codex",
|
|
1772
|
-
api: "openai-responses",
|
|
1773
|
-
provider: "github-copilot",
|
|
1774
|
-
baseUrl: "https://api.individual.githubcopilot.com",
|
|
1775
|
-
headers: {"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},
|
|
1776
|
-
reasoning: true,
|
|
1777
|
-
input: ["text", "image"],
|
|
1778
|
-
cost: {
|
|
1779
|
-
input: 0,
|
|
1780
|
-
output: 0,
|
|
1781
|
-
cacheRead: 0,
|
|
1782
|
-
cacheWrite: 0,
|
|
1783
|
-
},
|
|
1784
|
-
contextWindow: 128000,
|
|
1785
|
-
maxTokens: 128000,
|
|
1786
|
-
} satisfies Model<"openai-responses">,
|
|
1787
1769
|
"gpt-5-mini": {
|
|
1788
1770
|
id: "gpt-5-mini",
|
|
1789
1771
|
name: "GPT-5-mini",
|
|
@@ -3641,7 +3623,7 @@ export const MODELS = {
|
|
|
3641
3623
|
cost: {
|
|
3642
3624
|
input: 1.25,
|
|
3643
3625
|
output: 10,
|
|
3644
|
-
cacheRead: 0.
|
|
3626
|
+
cacheRead: 0.125,
|
|
3645
3627
|
cacheWrite: 0,
|
|
3646
3628
|
},
|
|
3647
3629
|
contextWindow: 400000,
|
|
@@ -3692,7 +3674,7 @@ export const MODELS = {
|
|
|
3692
3674
|
cost: {
|
|
3693
3675
|
input: 0.25,
|
|
3694
3676
|
output: 2,
|
|
3695
|
-
cacheRead: 0.
|
|
3677
|
+
cacheRead: 0.025,
|
|
3696
3678
|
cacheWrite: 0,
|
|
3697
3679
|
},
|
|
3698
3680
|
contextWindow: 400000,
|
|
@@ -3709,7 +3691,7 @@ export const MODELS = {
|
|
|
3709
3691
|
cost: {
|
|
3710
3692
|
input: 0.05,
|
|
3711
3693
|
output: 0.4,
|
|
3712
|
-
cacheRead: 0.
|
|
3694
|
+
cacheRead: 0.005,
|
|
3713
3695
|
cacheWrite: 0,
|
|
3714
3696
|
},
|
|
3715
3697
|
contextWindow: 400000,
|
|
@@ -4314,6 +4296,23 @@ export const MODELS = {
|
|
|
4314
4296
|
contextWindow: 204800,
|
|
4315
4297
|
maxTokens: 131072,
|
|
4316
4298
|
} satisfies Model<"openai-completions">,
|
|
4299
|
+
"glm-4.7": {
|
|
4300
|
+
id: "glm-4.7",
|
|
4301
|
+
name: "GLM-4.7",
|
|
4302
|
+
api: "openai-completions",
|
|
4303
|
+
provider: "opencode",
|
|
4304
|
+
baseUrl: "https://opencode.ai/zen/v1",
|
|
4305
|
+
reasoning: true,
|
|
4306
|
+
input: ["text"],
|
|
4307
|
+
cost: {
|
|
4308
|
+
input: 0.6,
|
|
4309
|
+
output: 2.2,
|
|
4310
|
+
cacheRead: 0.1,
|
|
4311
|
+
cacheWrite: 0,
|
|
4312
|
+
},
|
|
4313
|
+
contextWindow: 204800,
|
|
4314
|
+
maxTokens: 131072,
|
|
4315
|
+
} satisfies Model<"openai-completions">,
|
|
4317
4316
|
"glm-4.7-free": {
|
|
4318
4317
|
id: "glm-4.7-free",
|
|
4319
4318
|
name: "GLM-4.7",
|
|
@@ -4615,7 +4614,7 @@ export const MODELS = {
|
|
|
4615
4614
|
input: ["text"],
|
|
4616
4615
|
cost: {
|
|
4617
4616
|
input: 0.09,
|
|
4618
|
-
output: 0.
|
|
4617
|
+
output: 0.44999999999999996,
|
|
4619
4618
|
cacheRead: 0,
|
|
4620
4619
|
cacheWrite: 0,
|
|
4621
4620
|
},
|
|
@@ -5028,7 +5027,7 @@ export const MODELS = {
|
|
|
5028
5027
|
cacheWrite: 0,
|
|
5029
5028
|
},
|
|
5030
5029
|
contextWindow: 262144,
|
|
5031
|
-
maxTokens:
|
|
5030
|
+
maxTokens: 32768,
|
|
5032
5031
|
} satisfies Model<"openai-completions">,
|
|
5033
5032
|
"cohere/command-r-08-2024": {
|
|
5034
5033
|
id: "cohere/command-r-08-2024",
|
|
@@ -5297,7 +5296,7 @@ export const MODELS = {
|
|
|
5297
5296
|
input: 0.09999999999999999,
|
|
5298
5297
|
output: 0.39999999999999997,
|
|
5299
5298
|
cacheRead: 0.024999999999999998,
|
|
5300
|
-
cacheWrite: 0.
|
|
5299
|
+
cacheWrite: 0.08333333333333333,
|
|
5301
5300
|
},
|
|
5302
5301
|
contextWindow: 1048576,
|
|
5303
5302
|
maxTokens: 8192,
|
|
@@ -5311,10 +5310,10 @@ export const MODELS = {
|
|
|
5311
5310
|
reasoning: false,
|
|
5312
5311
|
input: ["text", "image"],
|
|
5313
5312
|
cost: {
|
|
5314
|
-
input: 0,
|
|
5315
|
-
output: 0,
|
|
5316
|
-
cacheRead: 0,
|
|
5317
|
-
cacheWrite: 0,
|
|
5313
|
+
input: 0.09999999999999999,
|
|
5314
|
+
output: 0.39999999999999997,
|
|
5315
|
+
cacheRead: 0.024999999999999998,
|
|
5316
|
+
cacheWrite: 0.08333333333333333,
|
|
5318
5317
|
},
|
|
5319
5318
|
contextWindow: 1048576,
|
|
5320
5319
|
maxTokens: 8192,
|
|
@@ -5348,7 +5347,7 @@ export const MODELS = {
|
|
|
5348
5347
|
input: 0.3,
|
|
5349
5348
|
output: 2.5,
|
|
5350
5349
|
cacheRead: 0.03,
|
|
5351
|
-
cacheWrite: 0.
|
|
5350
|
+
cacheWrite: 0.08333333333333333,
|
|
5352
5351
|
},
|
|
5353
5352
|
contextWindow: 1048576,
|
|
5354
5353
|
maxTokens: 65535,
|
|
@@ -5365,7 +5364,7 @@ export const MODELS = {
|
|
|
5365
5364
|
input: 0.09999999999999999,
|
|
5366
5365
|
output: 0.39999999999999997,
|
|
5367
5366
|
cacheRead: 0.01,
|
|
5368
|
-
cacheWrite: 0.
|
|
5367
|
+
cacheWrite: 0.08333333333333333,
|
|
5369
5368
|
},
|
|
5370
5369
|
contextWindow: 1048576,
|
|
5371
5370
|
maxTokens: 65535,
|
|
@@ -5382,10 +5381,10 @@ export const MODELS = {
|
|
|
5382
5381
|
input: 0.09999999999999999,
|
|
5383
5382
|
output: 0.39999999999999997,
|
|
5384
5383
|
cacheRead: 0.01,
|
|
5385
|
-
cacheWrite: 0.
|
|
5384
|
+
cacheWrite: 0.08333333333333333,
|
|
5386
5385
|
},
|
|
5387
5386
|
contextWindow: 1048576,
|
|
5388
|
-
maxTokens:
|
|
5387
|
+
maxTokens: 65535,
|
|
5389
5388
|
} satisfies Model<"openai-completions">,
|
|
5390
5389
|
"google/gemini-2.5-flash-preview-09-2025": {
|
|
5391
5390
|
id: "google/gemini-2.5-flash-preview-09-2025",
|
|
@@ -5398,8 +5397,8 @@ export const MODELS = {
|
|
|
5398
5397
|
cost: {
|
|
5399
5398
|
input: 0.3,
|
|
5400
5399
|
output: 2.5,
|
|
5401
|
-
cacheRead: 0.
|
|
5402
|
-
cacheWrite: 0.
|
|
5400
|
+
cacheRead: 0.03,
|
|
5401
|
+
cacheWrite: 0.08333333333333333,
|
|
5403
5402
|
},
|
|
5404
5403
|
contextWindow: 1048576,
|
|
5405
5404
|
maxTokens: 65535,
|
|
@@ -5432,7 +5431,7 @@ export const MODELS = {
|
|
|
5432
5431
|
cost: {
|
|
5433
5432
|
input: 1.25,
|
|
5434
5433
|
output: 10,
|
|
5435
|
-
cacheRead: 0.
|
|
5434
|
+
cacheRead: 0.125,
|
|
5436
5435
|
cacheWrite: 0.375,
|
|
5437
5436
|
},
|
|
5438
5437
|
contextWindow: 1048576,
|
|
@@ -5449,7 +5448,7 @@ export const MODELS = {
|
|
|
5449
5448
|
cost: {
|
|
5450
5449
|
input: 1.25,
|
|
5451
5450
|
output: 10,
|
|
5452
|
-
cacheRead: 0.
|
|
5451
|
+
cacheRead: 0.125,
|
|
5453
5452
|
cacheWrite: 0.375,
|
|
5454
5453
|
},
|
|
5455
5454
|
contextWindow: 1048576,
|
|
@@ -5467,7 +5466,7 @@ export const MODELS = {
|
|
|
5467
5466
|
input: 0.5,
|
|
5468
5467
|
output: 3,
|
|
5469
5468
|
cacheRead: 0.049999999999999996,
|
|
5470
|
-
cacheWrite: 0,
|
|
5469
|
+
cacheWrite: 0.08333333333333333,
|
|
5471
5470
|
},
|
|
5472
5471
|
contextWindow: 1048576,
|
|
5473
5472
|
maxTokens: 65535,
|
|
@@ -5754,12 +5753,12 @@ export const MODELS = {
|
|
|
5754
5753
|
input: ["text"],
|
|
5755
5754
|
cost: {
|
|
5756
5755
|
input: 0.27,
|
|
5757
|
-
output: 1.
|
|
5756
|
+
output: 1.1,
|
|
5758
5757
|
cacheRead: 0,
|
|
5759
5758
|
cacheWrite: 0,
|
|
5760
5759
|
},
|
|
5761
5760
|
contextWindow: 196608,
|
|
5762
|
-
maxTokens:
|
|
5761
|
+
maxTokens: 196608,
|
|
5763
5762
|
} satisfies Model<"openai-completions">,
|
|
5764
5763
|
"mistralai/codestral-2508": {
|
|
5765
5764
|
id: "mistralai/codestral-2508",
|
|
@@ -6048,7 +6047,7 @@ export const MODELS = {
|
|
|
6048
6047
|
cacheWrite: 0,
|
|
6049
6048
|
},
|
|
6050
6049
|
contextWindow: 131072,
|
|
6051
|
-
maxTokens:
|
|
6050
|
+
maxTokens: 16384,
|
|
6052
6051
|
} satisfies Model<"openai-completions">,
|
|
6053
6052
|
"mistralai/mistral-saba": {
|
|
6054
6053
|
id: "mistralai/mistral-saba",
|
|
@@ -7869,6 +7868,23 @@ export const MODELS = {
|
|
|
7869
7868
|
contextWindow: 262144,
|
|
7870
7869
|
maxTokens: 4096,
|
|
7871
7870
|
} satisfies Model<"openai-completions">,
|
|
7871
|
+
"qwen/qwen3-vl-235b-a22b-thinking": {
|
|
7872
|
+
id: "qwen/qwen3-vl-235b-a22b-thinking",
|
|
7873
|
+
name: "Qwen: Qwen3 VL 235B A22B Thinking",
|
|
7874
|
+
api: "openai-completions",
|
|
7875
|
+
provider: "openrouter",
|
|
7876
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
7877
|
+
reasoning: true,
|
|
7878
|
+
input: ["text", "image"],
|
|
7879
|
+
cost: {
|
|
7880
|
+
input: 0.44999999999999996,
|
|
7881
|
+
output: 3.5,
|
|
7882
|
+
cacheRead: 0,
|
|
7883
|
+
cacheWrite: 0,
|
|
7884
|
+
},
|
|
7885
|
+
contextWindow: 262144,
|
|
7886
|
+
maxTokens: 262144,
|
|
7887
|
+
} satisfies Model<"openai-completions">,
|
|
7872
7888
|
"qwen/qwen3-vl-30b-a3b-instruct": {
|
|
7873
7889
|
id: "qwen/qwen3-vl-30b-a3b-instruct",
|
|
7874
7890
|
name: "Qwen: Qwen3 VL 30B A3B Instruct",
|
|
@@ -8430,6 +8446,23 @@ export const MODELS = {
|
|
|
8430
8446
|
contextWindow: 202752,
|
|
8431
8447
|
maxTokens: 65535,
|
|
8432
8448
|
} satisfies Model<"openai-completions">,
|
|
8449
|
+
"z-ai/glm-4.7-flash": {
|
|
8450
|
+
id: "z-ai/glm-4.7-flash",
|
|
8451
|
+
name: "Z.AI: GLM 4.7 Flash",
|
|
8452
|
+
api: "openai-completions",
|
|
8453
|
+
provider: "openrouter",
|
|
8454
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
8455
|
+
reasoning: true,
|
|
8456
|
+
input: ["text"],
|
|
8457
|
+
cost: {
|
|
8458
|
+
input: 0.07,
|
|
8459
|
+
output: 0.39999999999999997,
|
|
8460
|
+
cacheRead: 0.01,
|
|
8461
|
+
cacheWrite: 0,
|
|
8462
|
+
},
|
|
8463
|
+
contextWindow: 200000,
|
|
8464
|
+
maxTokens: 131072,
|
|
8465
|
+
} satisfies Model<"openai-completions">,
|
|
8433
8466
|
},
|
|
8434
8467
|
"vercel-ai-gateway": {
|
|
8435
8468
|
"alibaba/qwen-3-14b": {
|
|
@@ -8562,7 +8595,7 @@ export const MODELS = {
|
|
|
8562
8595
|
cost: {
|
|
8563
8596
|
input: 1,
|
|
8564
8597
|
output: 5,
|
|
8565
|
-
cacheRead: 0,
|
|
8598
|
+
cacheRead: 0.19999999999999998,
|
|
8566
8599
|
cacheWrite: 0,
|
|
8567
8600
|
},
|
|
8568
8601
|
contextWindow: 1000000,
|
|
@@ -8619,23 +8652,6 @@ export const MODELS = {
|
|
|
8619
8652
|
contextWindow: 200000,
|
|
8620
8653
|
maxTokens: 4096,
|
|
8621
8654
|
} satisfies Model<"anthropic-messages">,
|
|
8622
|
-
"anthropic/claude-3-opus": {
|
|
8623
|
-
id: "anthropic/claude-3-opus",
|
|
8624
|
-
name: "Claude 3 Opus",
|
|
8625
|
-
api: "anthropic-messages",
|
|
8626
|
-
provider: "vercel-ai-gateway",
|
|
8627
|
-
baseUrl: "https://ai-gateway.vercel.sh",
|
|
8628
|
-
reasoning: false,
|
|
8629
|
-
input: ["text", "image"],
|
|
8630
|
-
cost: {
|
|
8631
|
-
input: 15,
|
|
8632
|
-
output: 75,
|
|
8633
|
-
cacheRead: 0,
|
|
8634
|
-
cacheWrite: 0,
|
|
8635
|
-
},
|
|
8636
|
-
contextWindow: 200000,
|
|
8637
|
-
maxTokens: 8192,
|
|
8638
|
-
} satisfies Model<"anthropic-messages">,
|
|
8639
8655
|
"anthropic/claude-3.5-haiku": {
|
|
8640
8656
|
id: "anthropic/claude-3.5-haiku",
|
|
8641
8657
|
name: "Claude 3.5 Haiku",
|
|
@@ -8786,7 +8802,7 @@ export const MODELS = {
|
|
|
8786
8802
|
cacheRead: 0.3,
|
|
8787
8803
|
cacheWrite: 3.75,
|
|
8788
8804
|
},
|
|
8789
|
-
contextWindow:
|
|
8805
|
+
contextWindow: 1000000,
|
|
8790
8806
|
maxTokens: 64000,
|
|
8791
8807
|
} satisfies Model<"anthropic-messages">,
|
|
8792
8808
|
"anthropic/claude-sonnet-4.5": {
|
|
@@ -8803,7 +8819,7 @@ export const MODELS = {
|
|
|
8803
8819
|
cacheRead: 0.3,
|
|
8804
8820
|
cacheWrite: 3.75,
|
|
8805
8821
|
},
|
|
8806
|
-
contextWindow:
|
|
8822
|
+
contextWindow: 1000000,
|
|
8807
8823
|
maxTokens: 64000,
|
|
8808
8824
|
} satisfies Model<"anthropic-messages">,
|
|
8809
8825
|
"bytedance/seed-1.6": {
|
|
@@ -8925,40 +8941,6 @@ export const MODELS = {
|
|
|
8925
8941
|
contextWindow: 128000,
|
|
8926
8942
|
maxTokens: 64000,
|
|
8927
8943
|
} satisfies Model<"anthropic-messages">,
|
|
8928
|
-
"google/gemini-2.0-flash": {
|
|
8929
|
-
id: "google/gemini-2.0-flash",
|
|
8930
|
-
name: "Gemini 2.0 Flash",
|
|
8931
|
-
api: "anthropic-messages",
|
|
8932
|
-
provider: "vercel-ai-gateway",
|
|
8933
|
-
baseUrl: "https://ai-gateway.vercel.sh",
|
|
8934
|
-
reasoning: false,
|
|
8935
|
-
input: ["text", "image"],
|
|
8936
|
-
cost: {
|
|
8937
|
-
input: 0.09999999999999999,
|
|
8938
|
-
output: 0.39999999999999997,
|
|
8939
|
-
cacheRead: 0.024999999999999998,
|
|
8940
|
-
cacheWrite: 0,
|
|
8941
|
-
},
|
|
8942
|
-
contextWindow: 1000000,
|
|
8943
|
-
maxTokens: 8192,
|
|
8944
|
-
} satisfies Model<"anthropic-messages">,
|
|
8945
|
-
"google/gemini-2.0-flash-lite": {
|
|
8946
|
-
id: "google/gemini-2.0-flash-lite",
|
|
8947
|
-
name: "Gemini 2.0 Flash Lite",
|
|
8948
|
-
api: "anthropic-messages",
|
|
8949
|
-
provider: "vercel-ai-gateway",
|
|
8950
|
-
baseUrl: "https://ai-gateway.vercel.sh",
|
|
8951
|
-
reasoning: false,
|
|
8952
|
-
input: ["text", "image"],
|
|
8953
|
-
cost: {
|
|
8954
|
-
input: 0.075,
|
|
8955
|
-
output: 0.3,
|
|
8956
|
-
cacheRead: 0,
|
|
8957
|
-
cacheWrite: 0,
|
|
8958
|
-
},
|
|
8959
|
-
contextWindow: 1048576,
|
|
8960
|
-
maxTokens: 8192,
|
|
8961
|
-
} satisfies Model<"anthropic-messages">,
|
|
8962
8944
|
"google/gemini-2.5-flash": {
|
|
8963
8945
|
id: "google/gemini-2.5-flash",
|
|
8964
8946
|
name: "Gemini 2.5 Flash",
|
|
@@ -8966,15 +8948,15 @@ export const MODELS = {
|
|
|
8966
8948
|
provider: "vercel-ai-gateway",
|
|
8967
8949
|
baseUrl: "https://ai-gateway.vercel.sh",
|
|
8968
8950
|
reasoning: true,
|
|
8969
|
-
input: ["text"
|
|
8951
|
+
input: ["text"],
|
|
8970
8952
|
cost: {
|
|
8971
8953
|
input: 0.3,
|
|
8972
8954
|
output: 2.5,
|
|
8973
|
-
cacheRead: 0
|
|
8955
|
+
cacheRead: 0,
|
|
8974
8956
|
cacheWrite: 0,
|
|
8975
8957
|
},
|
|
8976
8958
|
contextWindow: 1000000,
|
|
8977
|
-
maxTokens:
|
|
8959
|
+
maxTokens: 65536,
|
|
8978
8960
|
} satisfies Model<"anthropic-messages">,
|
|
8979
8961
|
"google/gemini-2.5-flash-lite": {
|
|
8980
8962
|
id: "google/gemini-2.5-flash-lite",
|
|
@@ -9034,11 +9016,11 @@ export const MODELS = {
|
|
|
9034
9016
|
provider: "vercel-ai-gateway",
|
|
9035
9017
|
baseUrl: "https://ai-gateway.vercel.sh",
|
|
9036
9018
|
reasoning: true,
|
|
9037
|
-
input: ["text"
|
|
9019
|
+
input: ["text"],
|
|
9038
9020
|
cost: {
|
|
9039
9021
|
input: 1.25,
|
|
9040
9022
|
output: 10,
|
|
9041
|
-
cacheRead: 0
|
|
9023
|
+
cacheRead: 0,
|
|
9042
9024
|
cacheWrite: 0,
|
|
9043
9025
|
},
|
|
9044
9026
|
contextWindow: 1048576,
|
|
@@ -10449,7 +10431,7 @@ export const MODELS = {
|
|
|
10449
10431
|
cost: {
|
|
10450
10432
|
input: 0.19999999999999998,
|
|
10451
10433
|
output: 1.1,
|
|
10452
|
-
cacheRead: 0,
|
|
10434
|
+
cacheRead: 0.03,
|
|
10453
10435
|
cacheWrite: 0,
|
|
10454
10436
|
},
|
|
10455
10437
|
contextWindow: 128000,
|
|
@@ -10540,6 +10522,23 @@ export const MODELS = {
|
|
|
10540
10522
|
contextWindow: 202752,
|
|
10541
10523
|
maxTokens: 120000,
|
|
10542
10524
|
} satisfies Model<"anthropic-messages">,
|
|
10525
|
+
"zai/glm-4.7-flashx": {
|
|
10526
|
+
id: "zai/glm-4.7-flashx",
|
|
10527
|
+
name: "GLM 4.7 FlashX",
|
|
10528
|
+
api: "anthropic-messages",
|
|
10529
|
+
provider: "vercel-ai-gateway",
|
|
10530
|
+
baseUrl: "https://ai-gateway.vercel.sh",
|
|
10531
|
+
reasoning: true,
|
|
10532
|
+
input: ["text"],
|
|
10533
|
+
cost: {
|
|
10534
|
+
input: 0.06,
|
|
10535
|
+
output: 0.39999999999999997,
|
|
10536
|
+
cacheRead: 0.01,
|
|
10537
|
+
cacheWrite: 0,
|
|
10538
|
+
},
|
|
10539
|
+
contextWindow: 200000,
|
|
10540
|
+
maxTokens: 128000,
|
|
10541
|
+
} satisfies Model<"anthropic-messages">,
|
|
10543
10542
|
},
|
|
10544
10543
|
"xai": {
|
|
10545
10544
|
"grok-2": {
|