@mariozechner/pi-ai 0.35.0 → 0.37.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/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +17 -1
- package/dist/cli.js.map +1 -1
- package/dist/models.d.ts +1 -1
- package/dist/models.d.ts.map +1 -1
- package/dist/models.generated.d.ts +231 -42
- package/dist/models.generated.d.ts.map +1 -1
- package/dist/models.generated.js +269 -80
- package/dist/models.generated.js.map +1 -1
- package/dist/models.js +3 -2
- package/dist/models.js.map +1 -1
- package/dist/providers/openai-codex/constants.d.ts +21 -0
- package/dist/providers/openai-codex/constants.d.ts.map +1 -0
- package/dist/providers/openai-codex/constants.js +21 -0
- package/dist/providers/openai-codex/constants.js.map +1 -0
- package/dist/providers/openai-codex/prompts/codex-instructions.md +105 -0
- package/dist/providers/openai-codex/prompts/codex.d.ts +11 -0
- package/dist/providers/openai-codex/prompts/codex.d.ts.map +1 -0
- package/dist/providers/openai-codex/prompts/codex.js +184 -0
- package/dist/providers/openai-codex/prompts/codex.js.map +1 -0
- package/dist/providers/openai-codex/prompts/pi-codex-bridge.d.ts +6 -0
- package/dist/providers/openai-codex/prompts/pi-codex-bridge.d.ts.map +1 -0
- package/dist/providers/openai-codex/prompts/pi-codex-bridge.js +48 -0
- package/dist/providers/openai-codex/prompts/pi-codex-bridge.js.map +1 -0
- package/dist/providers/openai-codex/request-transformer.d.ts +41 -0
- package/dist/providers/openai-codex/request-transformer.d.ts.map +1 -0
- package/dist/providers/openai-codex/request-transformer.js +247 -0
- package/dist/providers/openai-codex/request-transformer.js.map +1 -0
- package/dist/providers/openai-codex/response-handler.d.ts +19 -0
- package/dist/providers/openai-codex/response-handler.d.ts.map +1 -0
- package/dist/providers/openai-codex/response-handler.js +107 -0
- package/dist/providers/openai-codex/response-handler.js.map +1 -0
- package/dist/providers/openai-codex-responses.d.ts +10 -0
- package/dist/providers/openai-codex-responses.d.ts.map +1 -0
- package/dist/providers/openai-codex-responses.js +530 -0
- package/dist/providers/openai-codex-responses.js.map +1 -0
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +27 -1
- package/dist/stream.js.map +1 -1
- package/dist/types.d.ts +6 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/oauth/github-copilot.d.ts +2 -0
- package/dist/utils/oauth/github-copilot.d.ts.map +1 -1
- package/dist/utils/oauth/github-copilot.js +28 -5
- package/dist/utils/oauth/github-copilot.js.map +1 -1
- package/dist/utils/oauth/google-antigravity.d.ts +3 -1
- package/dist/utils/oauth/google-antigravity.d.ts.map +1 -1
- package/dist/utils/oauth/google-antigravity.js +100 -19
- package/dist/utils/oauth/google-antigravity.js.map +1 -1
- package/dist/utils/oauth/google-gemini-cli.d.ts +3 -1
- package/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -1
- package/dist/utils/oauth/google-gemini-cli.js +100 -19
- package/dist/utils/oauth/google-gemini-cli.js.map +1 -1
- package/dist/utils/oauth/index.d.ts +1 -0
- package/dist/utils/oauth/index.d.ts.map +1 -1
- package/dist/utils/oauth/index.js +11 -0
- package/dist/utils/oauth/index.js.map +1 -1
- package/dist/utils/oauth/openai-codex.d.ts +28 -0
- package/dist/utils/oauth/openai-codex.d.ts.map +1 -0
- package/dist/utils/oauth/openai-codex.js +342 -0
- package/dist/utils/oauth/openai-codex.js.map +1 -0
- package/dist/utils/oauth/types.d.ts +2 -1
- package/dist/utils/oauth/types.d.ts.map +1 -1
- package/dist/utils/oauth/types.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"","sourcesContent":["#!/usr/bin/env node\n\nimport { existsSync, readFileSync, writeFileSync } from \"fs\";\nimport { createInterface } from \"readline\";\nimport { loginAnthropic } from \"./utils/oauth/anthropic.js\";\nimport { loginGitHubCopilot } from \"./utils/oauth/github-copilot.js\";\nimport { loginAntigravity } from \"./utils/oauth/google-antigravity.js\";\nimport { loginGeminiCli } from \"./utils/oauth/google-gemini-cli.js\";\nimport { getOAuthProviders } from \"./utils/oauth/index.js\";\nimport type { OAuthCredentials, OAuthProvider } from \"./utils/oauth/types.js\";\n\nconst AUTH_FILE = \"auth.json\";\nconst PROVIDERS = getOAuthProviders();\n\nfunction prompt(rl: ReturnType<typeof createInterface>, question: string): Promise<string> {\n\treturn new Promise((resolve) => rl.question(question, resolve));\n}\n\nfunction loadAuth(): Record<string, { type: \"oauth\" } & OAuthCredentials> {\n\tif (!existsSync(AUTH_FILE)) return {};\n\ttry {\n\t\treturn JSON.parse(readFileSync(AUTH_FILE, \"utf-8\"));\n\t} catch {\n\t\treturn {};\n\t}\n}\n\nfunction saveAuth(auth: Record<string, { type: \"oauth\" } & OAuthCredentials>): void {\n\twriteFileSync(AUTH_FILE, JSON.stringify(auth, null, 2), \"utf-8\");\n}\n\nasync function login(provider: OAuthProvider): Promise<void> {\n\tconst rl = createInterface({ input: process.stdin, output: process.stdout });\n\n\tconst promptFn = (msg: string) => prompt(rl, `${msg} `);\n\n\ttry {\n\t\tlet credentials: OAuthCredentials;\n\n\t\tswitch (provider) {\n\t\t\tcase \"anthropic\":\n\t\t\t\tcredentials = await loginAnthropic(\n\t\t\t\t\t(url) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${url}\\n`);\n\t\t\t\t\t},\n\t\t\t\t\tasync () => {\n\t\t\t\t\t\treturn await promptFn(\"Paste the authorization code:\");\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase \"github-copilot\":\n\t\t\t\tcredentials = await loginGitHubCopilot({\n\t\t\t\t\tonAuth: (url, instructions) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${url}`);\n\t\t\t\t\t\tif (instructions) console.log(instructions);\n\t\t\t\t\t\tconsole.log();\n\t\t\t\t\t},\n\t\t\t\t\tonPrompt: async (p) => {\n\t\t\t\t\t\treturn await promptFn(`${p.message}${p.placeholder ? ` (${p.placeholder})` : \"\"}:`);\n\t\t\t\t\t},\n\t\t\t\t\tonProgress: (msg) => console.log(msg),\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\tcase \"google-gemini-cli\":\n\t\t\t\tcredentials = await loginGeminiCli(\n\t\t\t\t\t(info) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${info.url}`);\n\t\t\t\t\t\tif (info.instructions) console.log(info.instructions);\n\t\t\t\t\t\tconsole.log();\n\t\t\t\t\t},\n\t\t\t\t\t(msg) => console.log(msg),\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase \"google-antigravity\":\n\t\t\t\tcredentials = await loginAntigravity(\n\t\t\t\t\t(info) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${info.url}`);\n\t\t\t\t\t\tif (info.instructions) console.log(info.instructions);\n\t\t\t\t\t\tconsole.log();\n\t\t\t\t\t},\n\t\t\t\t\t(msg) => console.log(msg),\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tconst auth = loadAuth();\n\t\tauth[provider] = { type: \"oauth\", ...credentials };\n\t\tsaveAuth(auth);\n\n\t\tconsole.log(`\\nCredentials saved to ${AUTH_FILE}`);\n\t} finally {\n\t\trl.close();\n\t}\n}\n\nasync function main(): Promise<void> {\n\tconst args = process.argv.slice(2);\n\tconst command = args[0];\n\n\tif (!command || command === \"help\" || command === \"--help\" || command === \"-h\") {\n\t\tconsole.log(`Usage: npx @mariozechner/pi-ai <command> [provider]\n\nCommands:\n login [provider] Login to an OAuth provider\n list List available providers\n\nProviders:\n anthropic Anthropic (Claude Pro/Max)\n github-copilot GitHub Copilot\n google-gemini-cli Google Gemini CLI\n google-antigravity Antigravity (Gemini 3, Claude, GPT-OSS)\n\nExamples:\n npx @mariozechner/pi-ai login # interactive provider selection\n npx @mariozechner/pi-ai login anthropic # login to specific provider\n npx @mariozechner/pi-ai list # list providers\n`);\n\t\treturn;\n\t}\n\n\tif (command === \"list\") {\n\t\tconsole.log(\"Available OAuth providers:\\n\");\n\t\tfor (const p of PROVIDERS) {\n\t\t\tconsole.log(` ${p.id.padEnd(20)} ${p.name}`);\n\t\t}\n\t\treturn;\n\t}\n\n\tif (command === \"login\") {\n\t\tlet provider = args[1] as OAuthProvider | undefined;\n\n\t\tif (!provider) {\n\t\t\tconst rl = createInterface({ input: process.stdin, output: process.stdout });\n\t\t\tconsole.log(\"Select a provider:\\n\");\n\t\t\tfor (let i = 0; i < PROVIDERS.length; i++) {\n\t\t\t\tconsole.log(` ${i + 1}. ${PROVIDERS[i].name}`);\n\t\t\t}\n\t\t\tconsole.log();\n\n\t\t\tconst choice = await prompt(rl,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"","sourcesContent":["#!/usr/bin/env node\n\nimport { existsSync, readFileSync, writeFileSync } from \"fs\";\nimport { createInterface } from \"readline\";\nimport { loginAnthropic } from \"./utils/oauth/anthropic.js\";\nimport { loginGitHubCopilot } from \"./utils/oauth/github-copilot.js\";\nimport { loginAntigravity } from \"./utils/oauth/google-antigravity.js\";\nimport { loginGeminiCli } from \"./utils/oauth/google-gemini-cli.js\";\nimport { getOAuthProviders } from \"./utils/oauth/index.js\";\nimport { loginOpenAICodex } from \"./utils/oauth/openai-codex.js\";\nimport type { OAuthCredentials, OAuthProvider } from \"./utils/oauth/types.js\";\n\nconst AUTH_FILE = \"auth.json\";\nconst PROVIDERS = getOAuthProviders();\n\nfunction prompt(rl: ReturnType<typeof createInterface>, question: string): Promise<string> {\n\treturn new Promise((resolve) => rl.question(question, resolve));\n}\n\nfunction loadAuth(): Record<string, { type: \"oauth\" } & OAuthCredentials> {\n\tif (!existsSync(AUTH_FILE)) return {};\n\ttry {\n\t\treturn JSON.parse(readFileSync(AUTH_FILE, \"utf-8\"));\n\t} catch {\n\t\treturn {};\n\t}\n}\n\nfunction saveAuth(auth: Record<string, { type: \"oauth\" } & OAuthCredentials>): void {\n\twriteFileSync(AUTH_FILE, JSON.stringify(auth, null, 2), \"utf-8\");\n}\n\nasync function login(provider: OAuthProvider): Promise<void> {\n\tconst rl = createInterface({ input: process.stdin, output: process.stdout });\n\n\tconst promptFn = (msg: string) => prompt(rl, `${msg} `);\n\n\ttry {\n\t\tlet credentials: OAuthCredentials;\n\n\t\tswitch (provider) {\n\t\t\tcase \"anthropic\":\n\t\t\t\tcredentials = await loginAnthropic(\n\t\t\t\t\t(url) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${url}\\n`);\n\t\t\t\t\t},\n\t\t\t\t\tasync () => {\n\t\t\t\t\t\treturn await promptFn(\"Paste the authorization code:\");\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase \"github-copilot\":\n\t\t\t\tcredentials = await loginGitHubCopilot({\n\t\t\t\t\tonAuth: (url, instructions) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${url}`);\n\t\t\t\t\t\tif (instructions) console.log(instructions);\n\t\t\t\t\t\tconsole.log();\n\t\t\t\t\t},\n\t\t\t\t\tonPrompt: async (p) => {\n\t\t\t\t\t\treturn await promptFn(`${p.message}${p.placeholder ? ` (${p.placeholder})` : \"\"}:`);\n\t\t\t\t\t},\n\t\t\t\t\tonProgress: (msg) => console.log(msg),\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\tcase \"google-gemini-cli\":\n\t\t\t\tcredentials = await loginGeminiCli(\n\t\t\t\t\t(info) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${info.url}`);\n\t\t\t\t\t\tif (info.instructions) console.log(info.instructions);\n\t\t\t\t\t\tconsole.log();\n\t\t\t\t\t},\n\t\t\t\t\t(msg) => console.log(msg),\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase \"google-antigravity\":\n\t\t\t\tcredentials = await loginAntigravity(\n\t\t\t\t\t(info) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${info.url}`);\n\t\t\t\t\t\tif (info.instructions) console.log(info.instructions);\n\t\t\t\t\t\tconsole.log();\n\t\t\t\t\t},\n\t\t\t\t\t(msg) => console.log(msg),\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase \"openai-codex\":\n\t\t\t\tcredentials = await loginOpenAICodex({\n\t\t\t\t\tonAuth: (info) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${info.url}`);\n\t\t\t\t\t\tif (info.instructions) console.log(info.instructions);\n\t\t\t\t\t\tconsole.log();\n\t\t\t\t\t},\n\t\t\t\t\tonPrompt: async (p) => {\n\t\t\t\t\t\treturn await promptFn(`${p.message}${p.placeholder ? ` (${p.placeholder})` : \"\"}:`);\n\t\t\t\t\t},\n\t\t\t\t\tonProgress: (msg) => console.log(msg),\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t}\n\n\t\tconst auth = loadAuth();\n\t\tauth[provider] = { type: \"oauth\", ...credentials };\n\t\tsaveAuth(auth);\n\n\t\tconsole.log(`\\nCredentials saved to ${AUTH_FILE}`);\n\t} finally {\n\t\trl.close();\n\t}\n}\n\nasync function main(): Promise<void> {\n\tconst args = process.argv.slice(2);\n\tconst command = args[0];\n\n\tif (!command || command === \"help\" || command === \"--help\" || command === \"-h\") {\n\t\tconsole.log(`Usage: npx @mariozechner/pi-ai <command> [provider]\n\nCommands:\n login [provider] Login to an OAuth provider\n list List available providers\n\nProviders:\n anthropic Anthropic (Claude Pro/Max)\n github-copilot GitHub Copilot\n google-gemini-cli Google Gemini CLI\n google-antigravity Antigravity (Gemini 3, Claude, GPT-OSS)\n openai-codex OpenAI Codex (ChatGPT Plus/Pro)\n\nExamples:\n npx @mariozechner/pi-ai login # interactive provider selection\n npx @mariozechner/pi-ai login anthropic # login to specific provider\n npx @mariozechner/pi-ai list # list providers\n`);\n\t\treturn;\n\t}\n\n\tif (command === \"list\") {\n\t\tconsole.log(\"Available OAuth providers:\\n\");\n\t\tfor (const p of PROVIDERS) {\n\t\t\tconsole.log(` ${p.id.padEnd(20)} ${p.name}`);\n\t\t}\n\t\treturn;\n\t}\n\n\tif (command === \"login\") {\n\t\tlet provider = args[1] as OAuthProvider | undefined;\n\n\t\tif (!provider) {\n\t\t\tconst rl = createInterface({ input: process.stdin, output: process.stdout });\n\t\t\tconsole.log(\"Select a provider:\\n\");\n\t\t\tfor (let i = 0; i < PROVIDERS.length; i++) {\n\t\t\t\tconsole.log(` ${i + 1}. ${PROVIDERS[i].name}`);\n\t\t\t}\n\t\t\tconsole.log();\n\n\t\t\tconst choice = await prompt(rl, `Enter number (1-${PROVIDERS.length}): `);\n\t\t\trl.close();\n\n\t\t\tconst index = parseInt(choice, 10) - 1;\n\t\t\tif (index < 0 || index >= PROVIDERS.length) {\n\t\t\t\tconsole.error(\"Invalid selection\");\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tprovider = PROVIDERS[index].id;\n\t\t}\n\n\t\tif (!PROVIDERS.some((p) => p.id === provider)) {\n\t\t\tconsole.error(`Unknown provider: ${provider}`);\n\t\t\tconsole.error(`Use 'npx @mariozechner/pi-ai list' to see available providers`);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tconsole.log(`Logging in to ${provider}...`);\n\t\tawait login(provider);\n\t\treturn;\n\t}\n\n\tconsole.error(`Unknown command: ${command}`);\n\tconsole.error(`Use 'npx @mariozechner/pi-ai --help' for usage`);\n\tprocess.exit(1);\n}\n\nmain().catch((err) => {\n\tconsole.error(\"Error:\", err.message);\n\tprocess.exit(1);\n});\n"]}
|
package/dist/cli.js
CHANGED
|
@@ -6,6 +6,7 @@ import { loginGitHubCopilot } from "./utils/oauth/github-copilot.js";
|
|
|
6
6
|
import { loginAntigravity } from "./utils/oauth/google-antigravity.js";
|
|
7
7
|
import { loginGeminiCli } from "./utils/oauth/google-gemini-cli.js";
|
|
8
8
|
import { getOAuthProviders } from "./utils/oauth/index.js";
|
|
9
|
+
import { loginOpenAICodex } from "./utils/oauth/openai-codex.js";
|
|
9
10
|
const AUTH_FILE = "auth.json";
|
|
10
11
|
const PROVIDERS = getOAuthProviders();
|
|
11
12
|
function prompt(rl, question) {
|
|
@@ -67,6 +68,20 @@ async function login(provider) {
|
|
|
67
68
|
console.log();
|
|
68
69
|
}, (msg) => console.log(msg));
|
|
69
70
|
break;
|
|
71
|
+
case "openai-codex":
|
|
72
|
+
credentials = await loginOpenAICodex({
|
|
73
|
+
onAuth: (info) => {
|
|
74
|
+
console.log(`\nOpen this URL in your browser:\n${info.url}`);
|
|
75
|
+
if (info.instructions)
|
|
76
|
+
console.log(info.instructions);
|
|
77
|
+
console.log();
|
|
78
|
+
},
|
|
79
|
+
onPrompt: async (p) => {
|
|
80
|
+
return await promptFn(`${p.message}${p.placeholder ? ` (${p.placeholder})` : ""}:`);
|
|
81
|
+
},
|
|
82
|
+
onProgress: (msg) => console.log(msg),
|
|
83
|
+
});
|
|
84
|
+
break;
|
|
70
85
|
}
|
|
71
86
|
const auth = loadAuth();
|
|
72
87
|
auth[provider] = { type: "oauth", ...credentials };
|
|
@@ -92,6 +107,7 @@ Providers:
|
|
|
92
107
|
github-copilot GitHub Copilot
|
|
93
108
|
google-gemini-cli Google Gemini CLI
|
|
94
109
|
google-antigravity Antigravity (Gemini 3, Claude, GPT-OSS)
|
|
110
|
+
openai-codex OpenAI Codex (ChatGPT Plus/Pro)
|
|
95
111
|
|
|
96
112
|
Examples:
|
|
97
113
|
npx @mariozechner/pi-ai login # interactive provider selection
|
|
@@ -116,7 +132,7 @@ Examples:
|
|
|
116
132
|
console.log(` ${i + 1}. ${PROVIDERS[i].name}`);
|
|
117
133
|
}
|
|
118
134
|
console.log();
|
|
119
|
-
const choice = await prompt(rl,
|
|
135
|
+
const choice = await prompt(rl, `Enter number (1-${PROVIDERS.length}): `);
|
|
120
136
|
rl.close();
|
|
121
137
|
const index = parseInt(choice, 10) - 1;
|
|
122
138
|
if (index < 0 || index >= PROVIDERS.length) {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,MAAM,SAAS,GAAG,WAAW,CAAC;AAC9B,MAAM,SAAS,GAAG,iBAAiB,EAAE,CAAC;AAEtC,SAAS,MAAM,CAAC,EAAsC,EAAE,QAAgB,EAAmB;IAC1F,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAAA,CAChE;AAED,SAAS,QAAQ,GAAyD;IACzE,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,EAAE,CAAC;IACtC,IAAI,CAAC;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IACrD,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,EAAE,CAAC;IACX,CAAC;AAAA,CACD;AAED,SAAS,QAAQ,CAAC,IAA0D,EAAQ;IACnF,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAA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AC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAAA,CAChB,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport { existsSync, readFileSync, writeFileSync } from \"fs\";\nimport { createInterface } from \"readline\";\nimport { loginAnthropic } from \"./utils/oauth/anthropic.js\";\nimport { loginGitHubCopilot } from \"./utils/oauth/github-copilot.js\";\nimport { loginAntigravity } from \"./utils/oauth/google-antigravity.js\";\nimport { loginGeminiCli } from \"./utils/oauth/google-gemini-cli.js\";\nimport { getOAuthProviders } from \"./utils/oauth/index.js\";\nimport type { OAuthCredentials, OAuthProvider } from \"./utils/oauth/types.js\";\n\nconst AUTH_FILE = \"auth.json\";\nconst PROVIDERS = getOAuthProviders();\n\nfunction prompt(rl: ReturnType<typeof createInterface>, question: string): Promise<string> {\n\treturn new Promise((resolve) => rl.question(question, resolve));\n}\n\nfunction loadAuth(): Record<string, { type: \"oauth\" } & OAuthCredentials> {\n\tif (!existsSync(AUTH_FILE)) return {};\n\ttry {\n\t\treturn JSON.parse(readFileSync(AUTH_FILE, \"utf-8\"));\n\t} catch {\n\t\treturn {};\n\t}\n}\n\nfunction saveAuth(auth: Record<string, { type: \"oauth\" } & OAuthCredentials>): void {\n\twriteFileSync(AUTH_FILE, JSON.stringify(auth, null, 2), \"utf-8\");\n}\n\nasync function login(provider: OAuthProvider): Promise<void> {\n\tconst rl = createInterface({ input: process.stdin, output: process.stdout });\n\n\tconst promptFn = (msg: string) => prompt(rl, `${msg} `);\n\n\ttry {\n\t\tlet credentials: OAuthCredentials;\n\n\t\tswitch (provider) {\n\t\t\tcase \"anthropic\":\n\t\t\t\tcredentials = await loginAnthropic(\n\t\t\t\t\t(url) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${url}\\n`);\n\t\t\t\t\t},\n\t\t\t\t\tasync () => {\n\t\t\t\t\t\treturn await promptFn(\"Paste the authorization code:\");\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase \"github-copilot\":\n\t\t\t\tcredentials = await loginGitHubCopilot({\n\t\t\t\t\tonAuth: (url, instructions) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${url}`);\n\t\t\t\t\t\tif (instructions) console.log(instructions);\n\t\t\t\t\t\tconsole.log();\n\t\t\t\t\t},\n\t\t\t\t\tonPrompt: async (p) => {\n\t\t\t\t\t\treturn await promptFn(`${p.message}${p.placeholder ? ` (${p.placeholder})` : \"\"}:`);\n\t\t\t\t\t},\n\t\t\t\t\tonProgress: (msg) => console.log(msg),\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\tcase \"google-gemini-cli\":\n\t\t\t\tcredentials = await loginGeminiCli(\n\t\t\t\t\t(info) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${info.url}`);\n\t\t\t\t\t\tif (info.instructions) console.log(info.instructions);\n\t\t\t\t\t\tconsole.log();\n\t\t\t\t\t},\n\t\t\t\t\t(msg) => console.log(msg),\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase \"google-antigravity\":\n\t\t\t\tcredentials = await loginAntigravity(\n\t\t\t\t\t(info) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${info.url}`);\n\t\t\t\t\t\tif (info.instructions) console.log(info.instructions);\n\t\t\t\t\t\tconsole.log();\n\t\t\t\t\t},\n\t\t\t\t\t(msg) => console.log(msg),\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tconst auth = loadAuth();\n\t\tauth[provider] = { type: \"oauth\", ...credentials };\n\t\tsaveAuth(auth);\n\n\t\tconsole.log(`\\nCredentials saved to ${AUTH_FILE}`);\n\t} finally {\n\t\trl.close();\n\t}\n}\n\nasync function main(): Promise<void> {\n\tconst args = process.argv.slice(2);\n\tconst command = args[0];\n\n\tif (!command || command === \"help\" || command === \"--help\" || command === \"-h\") {\n\t\tconsole.log(`Usage: npx @mariozechner/pi-ai <command> [provider]\n\nCommands:\n login [provider] Login to an OAuth provider\n list List available providers\n\nProviders:\n anthropic Anthropic (Claude Pro/Max)\n github-copilot GitHub Copilot\n google-gemini-cli Google Gemini CLI\n google-antigravity Antigravity (Gemini 3, Claude, GPT-OSS)\n\nExamples:\n npx @mariozechner/pi-ai login # interactive provider selection\n npx @mariozechner/pi-ai login anthropic # login to specific provider\n npx @mariozechner/pi-ai list # list providers\n`);\n\t\treturn;\n\t}\n\n\tif (command === \"list\") {\n\t\tconsole.log(\"Available OAuth providers:\\n\");\n\t\tfor (const p of PROVIDERS) {\n\t\t\tconsole.log(` ${p.id.padEnd(20)} ${p.name}`);\n\t\t}\n\t\treturn;\n\t}\n\n\tif (command === \"login\") {\n\t\tlet provider = args[1] as OAuthProvider | undefined;\n\n\t\tif (!provider) {\n\t\t\tconst rl = createInterface({ input: process.stdin, output: process.stdout });\n\t\t\tconsole.log(\"Select a provider:\\n\");\n\t\t\tfor (let i = 0; i < PROVIDERS.length; i++) {\n\t\t\t\tconsole.log(` ${i + 1}. ${PROVIDERS[i].name}`);\n\t\t\t}\n\t\t\tconsole.log();\n\n\t\t\tconst choice = await prompt(rl, \"Enter number (1-4): \");\n\t\t\trl.close();\n\n\t\t\tconst index = parseInt(choice, 10) - 1;\n\t\t\tif (index < 0 || index >= PROVIDERS.length) {\n\t\t\t\tconsole.error(\"Invalid selection\");\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tprovider = PROVIDERS[index].id;\n\t\t}\n\n\t\tif (!PROVIDERS.some((p) => p.id === provider)) {\n\t\t\tconsole.error(`Unknown provider: ${provider}`);\n\t\t\tconsole.error(`Use 'npx @mariozechner/pi-ai list' to see available providers`);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tconsole.log(`Logging in to ${provider}...`);\n\t\tawait login(provider);\n\t\treturn;\n\t}\n\n\tconsole.error(`Unknown command: ${command}`);\n\tconsole.error(`Use 'npx @mariozechner/pi-ai --help' for usage`);\n\tprocess.exit(1);\n}\n\nmain().catch((err) => {\n\tconsole.error(\"Error:\", err.message);\n\tprocess.exit(1);\n});\n"]}
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,MAAM,SAAS,GAAG,WAAW,CAAC;AAC9B,MAAM,SAAS,GAAG,iBAAiB,EAAE,CAAC;AAEtC,SAAS,MAAM,CAAC,EAAsC,EAAE,QAAgB,EAAmB;IAC1F,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAAA,CAChE;AAED,SAAS,QAAQ,GAAyD;IACzE,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,EAAE,CAAC;IACtC,IAAI,CAAC;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IACrD,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,EAAE,CAAC;IACX,CAAC;AAAA,CACD;AAED,SAAS,QAAQ,CAAC,IAA0D,EAAQ;IACnF,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,IA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IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,EAAE,CAAC;YAC/C,OAAO,CAAC,KAAK,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAC;YAC/C,OAAO,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;YAC/E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,iBAAiB,QAAQ,KAAK,CAAC,CAAC;QAC5C,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC;QACtB,OAAO;IACR,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;IAC7C,OAAO,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;IAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAAA,CAChB;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;IACrB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAAA,CAChB,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport { existsSync, readFileSync, writeFileSync } from \"fs\";\nimport { createInterface } from \"readline\";\nimport { loginAnthropic } from \"./utils/oauth/anthropic.js\";\nimport { loginGitHubCopilot } from \"./utils/oauth/github-copilot.js\";\nimport { loginAntigravity } from \"./utils/oauth/google-antigravity.js\";\nimport { loginGeminiCli } from \"./utils/oauth/google-gemini-cli.js\";\nimport { getOAuthProviders } from \"./utils/oauth/index.js\";\nimport { loginOpenAICodex } from \"./utils/oauth/openai-codex.js\";\nimport type { OAuthCredentials, OAuthProvider } from \"./utils/oauth/types.js\";\n\nconst AUTH_FILE = \"auth.json\";\nconst PROVIDERS = getOAuthProviders();\n\nfunction prompt(rl: ReturnType<typeof createInterface>, question: string): Promise<string> {\n\treturn new Promise((resolve) => rl.question(question, resolve));\n}\n\nfunction loadAuth(): Record<string, { type: \"oauth\" } & OAuthCredentials> {\n\tif (!existsSync(AUTH_FILE)) return {};\n\ttry {\n\t\treturn JSON.parse(readFileSync(AUTH_FILE, \"utf-8\"));\n\t} catch {\n\t\treturn {};\n\t}\n}\n\nfunction saveAuth(auth: Record<string, { type: \"oauth\" } & OAuthCredentials>): void {\n\twriteFileSync(AUTH_FILE, JSON.stringify(auth, null, 2), \"utf-8\");\n}\n\nasync function login(provider: OAuthProvider): Promise<void> {\n\tconst rl = createInterface({ input: process.stdin, output: process.stdout });\n\n\tconst promptFn = (msg: string) => prompt(rl, `${msg} `);\n\n\ttry {\n\t\tlet credentials: OAuthCredentials;\n\n\t\tswitch (provider) {\n\t\t\tcase \"anthropic\":\n\t\t\t\tcredentials = await loginAnthropic(\n\t\t\t\t\t(url) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${url}\\n`);\n\t\t\t\t\t},\n\t\t\t\t\tasync () => {\n\t\t\t\t\t\treturn await promptFn(\"Paste the authorization code:\");\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase \"github-copilot\":\n\t\t\t\tcredentials = await loginGitHubCopilot({\n\t\t\t\t\tonAuth: (url, instructions) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${url}`);\n\t\t\t\t\t\tif (instructions) console.log(instructions);\n\t\t\t\t\t\tconsole.log();\n\t\t\t\t\t},\n\t\t\t\t\tonPrompt: async (p) => {\n\t\t\t\t\t\treturn await promptFn(`${p.message}${p.placeholder ? ` (${p.placeholder})` : \"\"}:`);\n\t\t\t\t\t},\n\t\t\t\t\tonProgress: (msg) => console.log(msg),\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\tcase \"google-gemini-cli\":\n\t\t\t\tcredentials = await loginGeminiCli(\n\t\t\t\t\t(info) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${info.url}`);\n\t\t\t\t\t\tif (info.instructions) console.log(info.instructions);\n\t\t\t\t\t\tconsole.log();\n\t\t\t\t\t},\n\t\t\t\t\t(msg) => console.log(msg),\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase \"google-antigravity\":\n\t\t\t\tcredentials = await loginAntigravity(\n\t\t\t\t\t(info) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${info.url}`);\n\t\t\t\t\t\tif (info.instructions) console.log(info.instructions);\n\t\t\t\t\t\tconsole.log();\n\t\t\t\t\t},\n\t\t\t\t\t(msg) => console.log(msg),\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase \"openai-codex\":\n\t\t\t\tcredentials = await loginOpenAICodex({\n\t\t\t\t\tonAuth: (info) => {\n\t\t\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${info.url}`);\n\t\t\t\t\t\tif (info.instructions) console.log(info.instructions);\n\t\t\t\t\t\tconsole.log();\n\t\t\t\t\t},\n\t\t\t\t\tonPrompt: async (p) => {\n\t\t\t\t\t\treturn await promptFn(`${p.message}${p.placeholder ? ` (${p.placeholder})` : \"\"}:`);\n\t\t\t\t\t},\n\t\t\t\t\tonProgress: (msg) => console.log(msg),\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t}\n\n\t\tconst auth = loadAuth();\n\t\tauth[provider] = { type: \"oauth\", ...credentials };\n\t\tsaveAuth(auth);\n\n\t\tconsole.log(`\\nCredentials saved to ${AUTH_FILE}`);\n\t} finally {\n\t\trl.close();\n\t}\n}\n\nasync function main(): Promise<void> {\n\tconst args = process.argv.slice(2);\n\tconst command = args[0];\n\n\tif (!command || command === \"help\" || command === \"--help\" || command === \"-h\") {\n\t\tconsole.log(`Usage: npx @mariozechner/pi-ai <command> [provider]\n\nCommands:\n login [provider] Login to an OAuth provider\n list List available providers\n\nProviders:\n anthropic Anthropic (Claude Pro/Max)\n github-copilot GitHub Copilot\n google-gemini-cli Google Gemini CLI\n google-antigravity Antigravity (Gemini 3, Claude, GPT-OSS)\n openai-codex OpenAI Codex (ChatGPT Plus/Pro)\n\nExamples:\n npx @mariozechner/pi-ai login # interactive provider selection\n npx @mariozechner/pi-ai login anthropic # login to specific provider\n npx @mariozechner/pi-ai list # list providers\n`);\n\t\treturn;\n\t}\n\n\tif (command === \"list\") {\n\t\tconsole.log(\"Available OAuth providers:\\n\");\n\t\tfor (const p of PROVIDERS) {\n\t\t\tconsole.log(` ${p.id.padEnd(20)} ${p.name}`);\n\t\t}\n\t\treturn;\n\t}\n\n\tif (command === \"login\") {\n\t\tlet provider = args[1] as OAuthProvider | undefined;\n\n\t\tif (!provider) {\n\t\t\tconst rl = createInterface({ input: process.stdin, output: process.stdout });\n\t\t\tconsole.log(\"Select a provider:\\n\");\n\t\t\tfor (let i = 0; i < PROVIDERS.length; i++) {\n\t\t\t\tconsole.log(` ${i + 1}. ${PROVIDERS[i].name}`);\n\t\t\t}\n\t\t\tconsole.log();\n\n\t\t\tconst choice = await prompt(rl, `Enter number (1-${PROVIDERS.length}): `);\n\t\t\trl.close();\n\n\t\t\tconst index = parseInt(choice, 10) - 1;\n\t\t\tif (index < 0 || index >= PROVIDERS.length) {\n\t\t\t\tconsole.error(\"Invalid selection\");\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tprovider = PROVIDERS[index].id;\n\t\t}\n\n\t\tif (!PROVIDERS.some((p) => p.id === provider)) {\n\t\t\tconsole.error(`Unknown provider: ${provider}`);\n\t\t\tconsole.error(`Use 'npx @mariozechner/pi-ai list' to see available providers`);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tconsole.log(`Logging in to ${provider}...`);\n\t\tawait login(provider);\n\t\treturn;\n\t}\n\n\tconsole.error(`Unknown command: ${command}`);\n\tconsole.error(`Use 'npx @mariozechner/pi-ai --help' for usage`);\n\tprocess.exit(1);\n}\n\nmain().catch((err) => {\n\tconsole.error(\"Error:\", err.message);\n\tprocess.exit(1);\n});\n"]}
|
package/dist/models.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare function getModels<TProvider extends KnownProvider>(provider: TPr
|
|
|
9
9
|
export declare function calculateCost<TApi extends Api>(model: Model<TApi>, usage: Usage): Usage["cost"];
|
|
10
10
|
/**
|
|
11
11
|
* Check if a model supports xhigh thinking level.
|
|
12
|
-
* Currently only certain OpenAI models support this.
|
|
12
|
+
* Currently only certain OpenAI Codex models support this.
|
|
13
13
|
*/
|
|
14
14
|
export declare function supportsXhigh<TApi extends Api>(model: Model<TApi>): boolean;
|
|
15
15
|
/**
|
package/dist/models.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAanE,KAAK,QAAQ,CACZ,SAAS,SAAS,aAAa,EAC/B,QAAQ,SAAS,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,IAC9C,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,SAAS;IAAE,GAAG,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG,CAAC,IAAI,SAAS,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAEjH,wBAAgB,QAAQ,CAAC,SAAS,SAAS,aAAa,EAAE,QAAQ,SAAS,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,EAC1G,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,QAAQ,GACf,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","s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,cAAc,CAAC,IAAI,SAAS,GAAG,EAC9C,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,EACjC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,GAC/B,OAAO,CAGT","sourcesContent":["import { MODELS } from \"./models.generated.js\";\nimport type { Api, KnownProvider, Model, Usage } from \"./types.js\";\n\nconst modelRegistry: Map<string, Map<string, Model<Api>>> = new Map();\n\n// Initialize registry from MODELS on module load\nfor (const [provider, models] of Object.entries(MODELS)) {\n\tconst providerModels = new Map<string, Model<Api>>();\n\tfor (const [id, model] of Object.entries(models)) {\n\t\tproviderModels.set(id, model as Model<Api>);\n\t}\n\tmodelRegistry.set(provider, providerModels);\n}\n\ntype ModelApi<\n\tTProvider extends KnownProvider,\n\tTModelId extends keyof (typeof MODELS)[TProvider],\n> = (typeof MODELS)[TProvider][TModelId] extends { api: infer TApi } ? (TApi extends Api ? TApi : never) : never;\n\nexport function getModel<TProvider extends KnownProvider, TModelId extends keyof (typeof MODELS)[TProvider]>(\n\tprovider: TProvider,\n\tmodelId: TModelId,\n): Model<ModelApi<TProvider, TModelId>> {\n\tconst providerModels = modelRegistry.get(provider);\n\treturn providerModels?.get(modelId as string) as Model<ModelApi<TProvider, TModelId>>;\n}\n\nexport function getProviders(): KnownProvider[] {\n\treturn Array.from(modelRegistry.keys()) as KnownProvider[];\n}\n\nexport function getModels<TProvider extends KnownProvider>(\n\tprovider: TProvider,\n): Model<ModelApi<TProvider, keyof (typeof MODELS)[TProvider]>>[] {\n\tconst models = modelRegistry.get(provider);\n\treturn models ? (Array.from(models.values()) as Model<ModelApi<TProvider, keyof (typeof MODELS)[TProvider]>>[]) : [];\n}\n\nexport function calculateCost<TApi extends Api>(model: Model<TApi>, usage: Usage): Usage[\"cost\"] {\n\tusage.cost.input = (model.cost.input / 1000000) * usage.input;\n\tusage.cost.output = (model.cost.output / 1000000) * usage.output;\n\tusage.cost.cacheRead = (model.cost.cacheRead / 1000000) * usage.cacheRead;\n\tusage.cost.cacheWrite = (model.cost.cacheWrite / 1000000) * usage.cacheWrite;\n\tusage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;\n\treturn usage.cost;\n}\n\n/** Models that support xhigh thinking level */\nconst XHIGH_MODELS = new Set([\"gpt-5.1-codex-max\", \"gpt-5.2\", \"gpt-5.2-codex\"]);\n\n/**\n * Check if a model supports xhigh thinking level.\n * Currently only certain OpenAI Codex models support this.\n */\nexport function supportsXhigh<TApi extends Api>(model: Model<TApi>): boolean {\n\treturn XHIGH_MODELS.has(model.id);\n}\n\n/**\n * Check if two models are equal by comparing both their id and provider.\n * Returns false if either model is null or undefined.\n */\nexport function modelsAreEqual<TApi extends Api>(\n\ta: Model<TApi> | null | undefined,\n\tb: Model<TApi> | null | undefined,\n): boolean {\n\tif (!a || !b) return false;\n\treturn a.id === b.id && a.provider === b.provider;\n}\n"]}
|
|
@@ -2903,15 +2903,15 @@ export declare const MODELS: {
|
|
|
2903
2903
|
maxTokens: number;
|
|
2904
2904
|
};
|
|
2905
2905
|
};
|
|
2906
|
-
readonly
|
|
2907
|
-
readonly "
|
|
2906
|
+
readonly "openai-codex": {
|
|
2907
|
+
readonly "codex-mini-latest": {
|
|
2908
2908
|
id: string;
|
|
2909
2909
|
name: string;
|
|
2910
|
-
api: "openai-
|
|
2910
|
+
api: "openai-codex-responses";
|
|
2911
2911
|
provider: string;
|
|
2912
2912
|
baseUrl: string;
|
|
2913
|
-
reasoning:
|
|
2914
|
-
input: "text"[];
|
|
2913
|
+
reasoning: true;
|
|
2914
|
+
input: ("image" | "text")[];
|
|
2915
2915
|
cost: {
|
|
2916
2916
|
input: number;
|
|
2917
2917
|
output: number;
|
|
@@ -2921,14 +2921,14 @@ export declare const MODELS: {
|
|
|
2921
2921
|
contextWindow: number;
|
|
2922
2922
|
maxTokens: number;
|
|
2923
2923
|
};
|
|
2924
|
-
readonly "
|
|
2924
|
+
readonly "gpt-5": {
|
|
2925
2925
|
id: string;
|
|
2926
2926
|
name: string;
|
|
2927
|
-
api: "openai-
|
|
2927
|
+
api: "openai-codex-responses";
|
|
2928
2928
|
provider: string;
|
|
2929
2929
|
baseUrl: string;
|
|
2930
|
-
reasoning:
|
|
2931
|
-
input: "text"[];
|
|
2930
|
+
reasoning: true;
|
|
2931
|
+
input: ("image" | "text")[];
|
|
2932
2932
|
cost: {
|
|
2933
2933
|
input: number;
|
|
2934
2934
|
output: number;
|
|
@@ -2938,14 +2938,14 @@ export declare const MODELS: {
|
|
|
2938
2938
|
contextWindow: number;
|
|
2939
2939
|
maxTokens: number;
|
|
2940
2940
|
};
|
|
2941
|
-
readonly "
|
|
2941
|
+
readonly "gpt-5-codex": {
|
|
2942
2942
|
id: string;
|
|
2943
2943
|
name: string;
|
|
2944
|
-
api: "openai-
|
|
2944
|
+
api: "openai-codex-responses";
|
|
2945
2945
|
provider: string;
|
|
2946
2946
|
baseUrl: string;
|
|
2947
2947
|
reasoning: true;
|
|
2948
|
-
input: "text"[];
|
|
2948
|
+
input: ("image" | "text")[];
|
|
2949
2949
|
cost: {
|
|
2950
2950
|
input: number;
|
|
2951
2951
|
output: number;
|
|
@@ -2955,13 +2955,185 @@ export declare const MODELS: {
|
|
|
2955
2955
|
contextWindow: number;
|
|
2956
2956
|
maxTokens: number;
|
|
2957
2957
|
};
|
|
2958
|
-
readonly "
|
|
2958
|
+
readonly "gpt-5-codex-mini": {
|
|
2959
2959
|
id: string;
|
|
2960
2960
|
name: string;
|
|
2961
|
-
api: "openai-
|
|
2961
|
+
api: "openai-codex-responses";
|
|
2962
|
+
provider: string;
|
|
2963
|
+
baseUrl: string;
|
|
2964
|
+
reasoning: true;
|
|
2965
|
+
input: ("image" | "text")[];
|
|
2966
|
+
cost: {
|
|
2967
|
+
input: number;
|
|
2968
|
+
output: number;
|
|
2969
|
+
cacheRead: number;
|
|
2970
|
+
cacheWrite: number;
|
|
2971
|
+
};
|
|
2972
|
+
contextWindow: number;
|
|
2973
|
+
maxTokens: number;
|
|
2974
|
+
};
|
|
2975
|
+
readonly "gpt-5-mini": {
|
|
2976
|
+
id: string;
|
|
2977
|
+
name: string;
|
|
2978
|
+
api: "openai-codex-responses";
|
|
2979
|
+
provider: string;
|
|
2980
|
+
baseUrl: string;
|
|
2981
|
+
reasoning: true;
|
|
2982
|
+
input: ("image" | "text")[];
|
|
2983
|
+
cost: {
|
|
2984
|
+
input: number;
|
|
2985
|
+
output: number;
|
|
2986
|
+
cacheRead: number;
|
|
2987
|
+
cacheWrite: number;
|
|
2988
|
+
};
|
|
2989
|
+
contextWindow: number;
|
|
2990
|
+
maxTokens: number;
|
|
2991
|
+
};
|
|
2992
|
+
readonly "gpt-5-nano": {
|
|
2993
|
+
id: string;
|
|
2994
|
+
name: string;
|
|
2995
|
+
api: "openai-codex-responses";
|
|
2962
2996
|
provider: string;
|
|
2963
2997
|
baseUrl: string;
|
|
2964
2998
|
reasoning: true;
|
|
2999
|
+
input: ("image" | "text")[];
|
|
3000
|
+
cost: {
|
|
3001
|
+
input: number;
|
|
3002
|
+
output: number;
|
|
3003
|
+
cacheRead: number;
|
|
3004
|
+
cacheWrite: number;
|
|
3005
|
+
};
|
|
3006
|
+
contextWindow: number;
|
|
3007
|
+
maxTokens: number;
|
|
3008
|
+
};
|
|
3009
|
+
readonly "gpt-5.1": {
|
|
3010
|
+
id: string;
|
|
3011
|
+
name: string;
|
|
3012
|
+
api: "openai-codex-responses";
|
|
3013
|
+
provider: string;
|
|
3014
|
+
baseUrl: string;
|
|
3015
|
+
reasoning: true;
|
|
3016
|
+
input: ("image" | "text")[];
|
|
3017
|
+
cost: {
|
|
3018
|
+
input: number;
|
|
3019
|
+
output: number;
|
|
3020
|
+
cacheRead: number;
|
|
3021
|
+
cacheWrite: number;
|
|
3022
|
+
};
|
|
3023
|
+
contextWindow: number;
|
|
3024
|
+
maxTokens: number;
|
|
3025
|
+
};
|
|
3026
|
+
readonly "gpt-5.1-chat-latest": {
|
|
3027
|
+
id: string;
|
|
3028
|
+
name: string;
|
|
3029
|
+
api: "openai-codex-responses";
|
|
3030
|
+
provider: string;
|
|
3031
|
+
baseUrl: string;
|
|
3032
|
+
reasoning: true;
|
|
3033
|
+
input: ("image" | "text")[];
|
|
3034
|
+
cost: {
|
|
3035
|
+
input: number;
|
|
3036
|
+
output: number;
|
|
3037
|
+
cacheRead: number;
|
|
3038
|
+
cacheWrite: number;
|
|
3039
|
+
};
|
|
3040
|
+
contextWindow: number;
|
|
3041
|
+
maxTokens: number;
|
|
3042
|
+
};
|
|
3043
|
+
readonly "gpt-5.1-codex": {
|
|
3044
|
+
id: string;
|
|
3045
|
+
name: string;
|
|
3046
|
+
api: "openai-codex-responses";
|
|
3047
|
+
provider: string;
|
|
3048
|
+
baseUrl: string;
|
|
3049
|
+
reasoning: true;
|
|
3050
|
+
input: ("image" | "text")[];
|
|
3051
|
+
cost: {
|
|
3052
|
+
input: number;
|
|
3053
|
+
output: number;
|
|
3054
|
+
cacheRead: number;
|
|
3055
|
+
cacheWrite: number;
|
|
3056
|
+
};
|
|
3057
|
+
contextWindow: number;
|
|
3058
|
+
maxTokens: number;
|
|
3059
|
+
};
|
|
3060
|
+
readonly "gpt-5.1-codex-max": {
|
|
3061
|
+
id: string;
|
|
3062
|
+
name: string;
|
|
3063
|
+
api: "openai-codex-responses";
|
|
3064
|
+
provider: string;
|
|
3065
|
+
baseUrl: string;
|
|
3066
|
+
reasoning: true;
|
|
3067
|
+
input: ("image" | "text")[];
|
|
3068
|
+
cost: {
|
|
3069
|
+
input: number;
|
|
3070
|
+
output: number;
|
|
3071
|
+
cacheRead: number;
|
|
3072
|
+
cacheWrite: number;
|
|
3073
|
+
};
|
|
3074
|
+
contextWindow: number;
|
|
3075
|
+
maxTokens: number;
|
|
3076
|
+
};
|
|
3077
|
+
readonly "gpt-5.1-codex-mini": {
|
|
3078
|
+
id: string;
|
|
3079
|
+
name: string;
|
|
3080
|
+
api: "openai-codex-responses";
|
|
3081
|
+
provider: string;
|
|
3082
|
+
baseUrl: string;
|
|
3083
|
+
reasoning: true;
|
|
3084
|
+
input: ("image" | "text")[];
|
|
3085
|
+
cost: {
|
|
3086
|
+
input: number;
|
|
3087
|
+
output: number;
|
|
3088
|
+
cacheRead: number;
|
|
3089
|
+
cacheWrite: number;
|
|
3090
|
+
};
|
|
3091
|
+
contextWindow: number;
|
|
3092
|
+
maxTokens: number;
|
|
3093
|
+
};
|
|
3094
|
+
readonly "gpt-5.2": {
|
|
3095
|
+
id: string;
|
|
3096
|
+
name: string;
|
|
3097
|
+
api: "openai-codex-responses";
|
|
3098
|
+
provider: string;
|
|
3099
|
+
baseUrl: string;
|
|
3100
|
+
reasoning: true;
|
|
3101
|
+
input: ("image" | "text")[];
|
|
3102
|
+
cost: {
|
|
3103
|
+
input: number;
|
|
3104
|
+
output: number;
|
|
3105
|
+
cacheRead: number;
|
|
3106
|
+
cacheWrite: number;
|
|
3107
|
+
};
|
|
3108
|
+
contextWindow: number;
|
|
3109
|
+
maxTokens: number;
|
|
3110
|
+
};
|
|
3111
|
+
readonly "gpt-5.2-codex": {
|
|
3112
|
+
id: string;
|
|
3113
|
+
name: string;
|
|
3114
|
+
api: "openai-codex-responses";
|
|
3115
|
+
provider: string;
|
|
3116
|
+
baseUrl: string;
|
|
3117
|
+
reasoning: true;
|
|
3118
|
+
input: ("image" | "text")[];
|
|
3119
|
+
cost: {
|
|
3120
|
+
input: number;
|
|
3121
|
+
output: number;
|
|
3122
|
+
cacheRead: number;
|
|
3123
|
+
cacheWrite: number;
|
|
3124
|
+
};
|
|
3125
|
+
contextWindow: number;
|
|
3126
|
+
maxTokens: number;
|
|
3127
|
+
};
|
|
3128
|
+
};
|
|
3129
|
+
readonly openrouter: {
|
|
3130
|
+
readonly "ai21/jamba-large-1.7": {
|
|
3131
|
+
id: string;
|
|
3132
|
+
name: string;
|
|
3133
|
+
api: "openai-completions";
|
|
3134
|
+
provider: string;
|
|
3135
|
+
baseUrl: string;
|
|
3136
|
+
reasoning: false;
|
|
2965
3137
|
input: "text"[];
|
|
2966
3138
|
cost: {
|
|
2967
3139
|
input: number;
|
|
@@ -2972,7 +3144,7 @@ export declare const MODELS: {
|
|
|
2972
3144
|
contextWindow: number;
|
|
2973
3145
|
maxTokens: number;
|
|
2974
3146
|
};
|
|
2975
|
-
readonly "
|
|
3147
|
+
readonly "ai21/jamba-mini-1.7": {
|
|
2976
3148
|
id: string;
|
|
2977
3149
|
name: string;
|
|
2978
3150
|
api: "openai-completions";
|
|
@@ -2989,14 +3161,14 @@ export declare const MODELS: {
|
|
|
2989
3161
|
contextWindow: number;
|
|
2990
3162
|
maxTokens: number;
|
|
2991
3163
|
};
|
|
2992
|
-
readonly "
|
|
3164
|
+
readonly "alibaba/tongyi-deepresearch-30b-a3b": {
|
|
2993
3165
|
id: string;
|
|
2994
3166
|
name: string;
|
|
2995
3167
|
api: "openai-completions";
|
|
2996
3168
|
provider: string;
|
|
2997
3169
|
baseUrl: string;
|
|
2998
3170
|
reasoning: true;
|
|
2999
|
-
input:
|
|
3171
|
+
input: "text"[];
|
|
3000
3172
|
cost: {
|
|
3001
3173
|
input: number;
|
|
3002
3174
|
output: number;
|
|
@@ -3006,13 +3178,30 @@ export declare const MODELS: {
|
|
|
3006
3178
|
contextWindow: number;
|
|
3007
3179
|
maxTokens: number;
|
|
3008
3180
|
};
|
|
3009
|
-
readonly "
|
|
3181
|
+
readonly "allenai/olmo-3-7b-instruct": {
|
|
3010
3182
|
id: string;
|
|
3011
3183
|
name: string;
|
|
3012
3184
|
api: "openai-completions";
|
|
3013
3185
|
provider: string;
|
|
3014
3186
|
baseUrl: string;
|
|
3015
3187
|
reasoning: false;
|
|
3188
|
+
input: "text"[];
|
|
3189
|
+
cost: {
|
|
3190
|
+
input: number;
|
|
3191
|
+
output: number;
|
|
3192
|
+
cacheRead: number;
|
|
3193
|
+
cacheWrite: number;
|
|
3194
|
+
};
|
|
3195
|
+
contextWindow: number;
|
|
3196
|
+
maxTokens: number;
|
|
3197
|
+
};
|
|
3198
|
+
readonly "amazon/nova-2-lite-v1": {
|
|
3199
|
+
id: string;
|
|
3200
|
+
name: string;
|
|
3201
|
+
api: "openai-completions";
|
|
3202
|
+
provider: string;
|
|
3203
|
+
baseUrl: string;
|
|
3204
|
+
reasoning: true;
|
|
3016
3205
|
input: ("image" | "text")[];
|
|
3017
3206
|
cost: {
|
|
3018
3207
|
input: number;
|
|
@@ -3023,14 +3212,14 @@ export declare const MODELS: {
|
|
|
3023
3212
|
contextWindow: number;
|
|
3024
3213
|
maxTokens: number;
|
|
3025
3214
|
};
|
|
3026
|
-
readonly "amazon/nova-
|
|
3215
|
+
readonly "amazon/nova-lite-v1": {
|
|
3027
3216
|
id: string;
|
|
3028
3217
|
name: string;
|
|
3029
3218
|
api: "openai-completions";
|
|
3030
3219
|
provider: string;
|
|
3031
3220
|
baseUrl: string;
|
|
3032
3221
|
reasoning: false;
|
|
3033
|
-
input: "text"[];
|
|
3222
|
+
input: ("image" | "text")[];
|
|
3034
3223
|
cost: {
|
|
3035
3224
|
input: number;
|
|
3036
3225
|
output: number;
|
|
@@ -3040,14 +3229,14 @@ export declare const MODELS: {
|
|
|
3040
3229
|
contextWindow: number;
|
|
3041
3230
|
maxTokens: number;
|
|
3042
3231
|
};
|
|
3043
|
-
readonly "amazon/nova-
|
|
3232
|
+
readonly "amazon/nova-micro-v1": {
|
|
3044
3233
|
id: string;
|
|
3045
3234
|
name: string;
|
|
3046
3235
|
api: "openai-completions";
|
|
3047
3236
|
provider: string;
|
|
3048
3237
|
baseUrl: string;
|
|
3049
3238
|
reasoning: false;
|
|
3050
|
-
input:
|
|
3239
|
+
input: "text"[];
|
|
3051
3240
|
cost: {
|
|
3052
3241
|
input: number;
|
|
3053
3242
|
output: number;
|
|
@@ -3057,7 +3246,7 @@ export declare const MODELS: {
|
|
|
3057
3246
|
contextWindow: number;
|
|
3058
3247
|
maxTokens: number;
|
|
3059
3248
|
};
|
|
3060
|
-
readonly "amazon/nova-
|
|
3249
|
+
readonly "amazon/nova-premier-v1": {
|
|
3061
3250
|
id: string;
|
|
3062
3251
|
name: string;
|
|
3063
3252
|
api: "openai-completions";
|
|
@@ -3074,7 +3263,7 @@ export declare const MODELS: {
|
|
|
3074
3263
|
contextWindow: number;
|
|
3075
3264
|
maxTokens: number;
|
|
3076
3265
|
};
|
|
3077
|
-
readonly "
|
|
3266
|
+
readonly "amazon/nova-pro-v1": {
|
|
3078
3267
|
id: string;
|
|
3079
3268
|
name: string;
|
|
3080
3269
|
api: "openai-completions";
|
|
@@ -3091,7 +3280,7 @@ export declare const MODELS: {
|
|
|
3091
3280
|
contextWindow: number;
|
|
3092
3281
|
maxTokens: number;
|
|
3093
3282
|
};
|
|
3094
|
-
readonly "anthropic/claude-3-
|
|
3283
|
+
readonly "anthropic/claude-3-haiku": {
|
|
3095
3284
|
id: string;
|
|
3096
3285
|
name: string;
|
|
3097
3286
|
api: "openai-completions";
|
|
@@ -3941,6 +4130,23 @@ export declare const MODELS: {
|
|
|
3941
4130
|
contextWindow: number;
|
|
3942
4131
|
maxTokens: number;
|
|
3943
4132
|
};
|
|
4133
|
+
readonly "kwaipilot/kat-coder-pro": {
|
|
4134
|
+
id: string;
|
|
4135
|
+
name: string;
|
|
4136
|
+
api: "openai-completions";
|
|
4137
|
+
provider: string;
|
|
4138
|
+
baseUrl: string;
|
|
4139
|
+
reasoning: false;
|
|
4140
|
+
input: "text"[];
|
|
4141
|
+
cost: {
|
|
4142
|
+
input: number;
|
|
4143
|
+
output: number;
|
|
4144
|
+
cacheRead: number;
|
|
4145
|
+
cacheWrite: number;
|
|
4146
|
+
};
|
|
4147
|
+
contextWindow: number;
|
|
4148
|
+
maxTokens: number;
|
|
4149
|
+
};
|
|
3944
4150
|
readonly "kwaipilot/kat-coder-pro:free": {
|
|
3945
4151
|
id: string;
|
|
3946
4152
|
name: string;
|
|
@@ -4859,23 +5065,6 @@ export declare const MODELS: {
|
|
|
4859
5065
|
contextWindow: number;
|
|
4860
5066
|
maxTokens: number;
|
|
4861
5067
|
};
|
|
4862
|
-
readonly "nousresearch/hermes-4-405b": {
|
|
4863
|
-
id: string;
|
|
4864
|
-
name: string;
|
|
4865
|
-
api: "openai-completions";
|
|
4866
|
-
provider: string;
|
|
4867
|
-
baseUrl: string;
|
|
4868
|
-
reasoning: true;
|
|
4869
|
-
input: "text"[];
|
|
4870
|
-
cost: {
|
|
4871
|
-
input: number;
|
|
4872
|
-
output: number;
|
|
4873
|
-
cacheRead: number;
|
|
4874
|
-
cacheWrite: number;
|
|
4875
|
-
};
|
|
4876
|
-
contextWindow: number;
|
|
4877
|
-
maxTokens: number;
|
|
4878
|
-
};
|
|
4879
5068
|
readonly "nousresearch/hermes-4-70b": {
|
|
4880
5069
|
id: string;
|
|
4881
5070
|
name: string;
|