@mariozechner/pi-ai 0.40.1 → 0.42.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 +9 -0
- package/dist/cli.js.map +1 -1
- package/dist/models.generated.d.ts +444 -0
- package/dist/models.generated.d.ts.map +1 -1
- package/dist/models.generated.js +444 -0
- package/dist/models.generated.js.map +1 -1
- package/dist/providers/anthropic.d.ts.map +1 -1
- package/dist/providers/anthropic.js +6 -3
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +1 -0
- package/dist/stream.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/oauth/anthropic.d.ts +16 -0
- package/dist/utils/oauth/anthropic.d.ts.map +1 -0
- package/dist/utils/oauth/anthropic.js +91 -0
- package/dist/utils/oauth/anthropic.js.map +1 -0
- 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/types.d.ts +1 -1
- package/dist/utils/oauth/types.d.ts.map +1 -1
- package/dist/utils/oauth/types.js.map +1 -1
- package/package.json +1 -1
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 { 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 \"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 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"]}
|
|
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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
3
3
|
import { createInterface } from "readline";
|
|
4
|
+
import { loginAnthropic } from "./utils/oauth/anthropic.js";
|
|
4
5
|
import { loginGitHubCopilot } from "./utils/oauth/github-copilot.js";
|
|
5
6
|
import { loginAntigravity } from "./utils/oauth/google-antigravity.js";
|
|
6
7
|
import { loginGeminiCli } from "./utils/oauth/google-gemini-cli.js";
|
|
@@ -30,6 +31,13 @@ async function login(provider) {
|
|
|
30
31
|
try {
|
|
31
32
|
let credentials;
|
|
32
33
|
switch (provider) {
|
|
34
|
+
case "anthropic":
|
|
35
|
+
credentials = await loginAnthropic((url) => {
|
|
36
|
+
console.log(`\nOpen this URL in your browser:\n${url}\n`);
|
|
37
|
+
}, async () => {
|
|
38
|
+
return await promptFn("Paste the authorization code:");
|
|
39
|
+
});
|
|
40
|
+
break;
|
|
33
41
|
case "github-copilot":
|
|
34
42
|
credentials = await loginGitHubCopilot({
|
|
35
43
|
onAuth: (url, instructions) => {
|
|
@@ -95,6 +103,7 @@ Commands:
|
|
|
95
103
|
list List available providers
|
|
96
104
|
|
|
97
105
|
Providers:
|
|
106
|
+
anthropic Anthropic (Claude Pro/Max)
|
|
98
107
|
github-copilot GitHub Copilot
|
|
99
108
|
google-gemini-cli Google Gemini CLI
|
|
100
109
|
google-antigravity Antigravity (Gemini 3, Claude, GPT-OSS)
|
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,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,QA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AAC,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 { 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 \"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 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"]}
|
|
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,gB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A,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"]}
|
|
@@ -3007,6 +3007,450 @@ export declare const MODELS: {
|
|
|
3007
3007
|
maxTokens: number;
|
|
3008
3008
|
};
|
|
3009
3009
|
};
|
|
3010
|
+
readonly opencode: {
|
|
3011
|
+
readonly "alpha-gd4": {
|
|
3012
|
+
id: string;
|
|
3013
|
+
name: string;
|
|
3014
|
+
api: "anthropic-messages";
|
|
3015
|
+
provider: string;
|
|
3016
|
+
baseUrl: string;
|
|
3017
|
+
reasoning: true;
|
|
3018
|
+
input: "text"[];
|
|
3019
|
+
cost: {
|
|
3020
|
+
input: number;
|
|
3021
|
+
output: number;
|
|
3022
|
+
cacheRead: number;
|
|
3023
|
+
cacheWrite: number;
|
|
3024
|
+
};
|
|
3025
|
+
contextWindow: number;
|
|
3026
|
+
maxTokens: number;
|
|
3027
|
+
};
|
|
3028
|
+
readonly "alpha-glm-4.7": {
|
|
3029
|
+
id: string;
|
|
3030
|
+
name: string;
|
|
3031
|
+
api: "openai-completions";
|
|
3032
|
+
provider: string;
|
|
3033
|
+
baseUrl: string;
|
|
3034
|
+
reasoning: true;
|
|
3035
|
+
input: "text"[];
|
|
3036
|
+
cost: {
|
|
3037
|
+
input: number;
|
|
3038
|
+
output: number;
|
|
3039
|
+
cacheRead: number;
|
|
3040
|
+
cacheWrite: number;
|
|
3041
|
+
};
|
|
3042
|
+
contextWindow: number;
|
|
3043
|
+
maxTokens: number;
|
|
3044
|
+
};
|
|
3045
|
+
readonly "big-pickle": {
|
|
3046
|
+
id: string;
|
|
3047
|
+
name: string;
|
|
3048
|
+
api: "openai-completions";
|
|
3049
|
+
provider: string;
|
|
3050
|
+
baseUrl: string;
|
|
3051
|
+
reasoning: true;
|
|
3052
|
+
input: "text"[];
|
|
3053
|
+
cost: {
|
|
3054
|
+
input: number;
|
|
3055
|
+
output: number;
|
|
3056
|
+
cacheRead: number;
|
|
3057
|
+
cacheWrite: number;
|
|
3058
|
+
};
|
|
3059
|
+
contextWindow: number;
|
|
3060
|
+
maxTokens: number;
|
|
3061
|
+
};
|
|
3062
|
+
readonly "claude-3-5-haiku": {
|
|
3063
|
+
id: string;
|
|
3064
|
+
name: string;
|
|
3065
|
+
api: "anthropic-messages";
|
|
3066
|
+
provider: string;
|
|
3067
|
+
baseUrl: string;
|
|
3068
|
+
reasoning: false;
|
|
3069
|
+
input: ("image" | "text")[];
|
|
3070
|
+
cost: {
|
|
3071
|
+
input: number;
|
|
3072
|
+
output: number;
|
|
3073
|
+
cacheRead: number;
|
|
3074
|
+
cacheWrite: number;
|
|
3075
|
+
};
|
|
3076
|
+
contextWindow: number;
|
|
3077
|
+
maxTokens: number;
|
|
3078
|
+
};
|
|
3079
|
+
readonly "claude-haiku-4-5": {
|
|
3080
|
+
id: string;
|
|
3081
|
+
name: string;
|
|
3082
|
+
api: "anthropic-messages";
|
|
3083
|
+
provider: string;
|
|
3084
|
+
baseUrl: string;
|
|
3085
|
+
reasoning: true;
|
|
3086
|
+
input: ("image" | "text")[];
|
|
3087
|
+
cost: {
|
|
3088
|
+
input: number;
|
|
3089
|
+
output: number;
|
|
3090
|
+
cacheRead: number;
|
|
3091
|
+
cacheWrite: number;
|
|
3092
|
+
};
|
|
3093
|
+
contextWindow: number;
|
|
3094
|
+
maxTokens: number;
|
|
3095
|
+
};
|
|
3096
|
+
readonly "claude-opus-4-1": {
|
|
3097
|
+
id: string;
|
|
3098
|
+
name: string;
|
|
3099
|
+
api: "anthropic-messages";
|
|
3100
|
+
provider: string;
|
|
3101
|
+
baseUrl: string;
|
|
3102
|
+
reasoning: true;
|
|
3103
|
+
input: ("image" | "text")[];
|
|
3104
|
+
cost: {
|
|
3105
|
+
input: number;
|
|
3106
|
+
output: number;
|
|
3107
|
+
cacheRead: number;
|
|
3108
|
+
cacheWrite: number;
|
|
3109
|
+
};
|
|
3110
|
+
contextWindow: number;
|
|
3111
|
+
maxTokens: number;
|
|
3112
|
+
};
|
|
3113
|
+
readonly "claude-opus-4-5": {
|
|
3114
|
+
id: string;
|
|
3115
|
+
name: string;
|
|
3116
|
+
api: "anthropic-messages";
|
|
3117
|
+
provider: string;
|
|
3118
|
+
baseUrl: string;
|
|
3119
|
+
reasoning: true;
|
|
3120
|
+
input: ("image" | "text")[];
|
|
3121
|
+
cost: {
|
|
3122
|
+
input: number;
|
|
3123
|
+
output: number;
|
|
3124
|
+
cacheRead: number;
|
|
3125
|
+
cacheWrite: number;
|
|
3126
|
+
};
|
|
3127
|
+
contextWindow: number;
|
|
3128
|
+
maxTokens: number;
|
|
3129
|
+
};
|
|
3130
|
+
readonly "claude-sonnet-4": {
|
|
3131
|
+
id: string;
|
|
3132
|
+
name: string;
|
|
3133
|
+
api: "anthropic-messages";
|
|
3134
|
+
provider: string;
|
|
3135
|
+
baseUrl: string;
|
|
3136
|
+
reasoning: true;
|
|
3137
|
+
input: ("image" | "text")[];
|
|
3138
|
+
cost: {
|
|
3139
|
+
input: number;
|
|
3140
|
+
output: number;
|
|
3141
|
+
cacheRead: number;
|
|
3142
|
+
cacheWrite: number;
|
|
3143
|
+
};
|
|
3144
|
+
contextWindow: number;
|
|
3145
|
+
maxTokens: number;
|
|
3146
|
+
};
|
|
3147
|
+
readonly "claude-sonnet-4-5": {
|
|
3148
|
+
id: string;
|
|
3149
|
+
name: string;
|
|
3150
|
+
api: "anthropic-messages";
|
|
3151
|
+
provider: string;
|
|
3152
|
+
baseUrl: string;
|
|
3153
|
+
reasoning: true;
|
|
3154
|
+
input: ("image" | "text")[];
|
|
3155
|
+
cost: {
|
|
3156
|
+
input: number;
|
|
3157
|
+
output: number;
|
|
3158
|
+
cacheRead: number;
|
|
3159
|
+
cacheWrite: number;
|
|
3160
|
+
};
|
|
3161
|
+
contextWindow: number;
|
|
3162
|
+
maxTokens: number;
|
|
3163
|
+
};
|
|
3164
|
+
readonly "gemini-3-flash": {
|
|
3165
|
+
id: string;
|
|
3166
|
+
name: string;
|
|
3167
|
+
api: "google-generative-ai";
|
|
3168
|
+
provider: string;
|
|
3169
|
+
baseUrl: string;
|
|
3170
|
+
reasoning: true;
|
|
3171
|
+
input: ("image" | "text")[];
|
|
3172
|
+
cost: {
|
|
3173
|
+
input: number;
|
|
3174
|
+
output: number;
|
|
3175
|
+
cacheRead: number;
|
|
3176
|
+
cacheWrite: number;
|
|
3177
|
+
};
|
|
3178
|
+
contextWindow: number;
|
|
3179
|
+
maxTokens: number;
|
|
3180
|
+
};
|
|
3181
|
+
readonly "gemini-3-pro": {
|
|
3182
|
+
id: string;
|
|
3183
|
+
name: string;
|
|
3184
|
+
api: "google-generative-ai";
|
|
3185
|
+
provider: string;
|
|
3186
|
+
baseUrl: string;
|
|
3187
|
+
reasoning: true;
|
|
3188
|
+
input: ("image" | "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 "glm-4.6": {
|
|
3199
|
+
id: string;
|
|
3200
|
+
name: string;
|
|
3201
|
+
api: "openai-completions";
|
|
3202
|
+
provider: string;
|
|
3203
|
+
baseUrl: string;
|
|
3204
|
+
reasoning: true;
|
|
3205
|
+
input: "text"[];
|
|
3206
|
+
cost: {
|
|
3207
|
+
input: number;
|
|
3208
|
+
output: number;
|
|
3209
|
+
cacheRead: number;
|
|
3210
|
+
cacheWrite: number;
|
|
3211
|
+
};
|
|
3212
|
+
contextWindow: number;
|
|
3213
|
+
maxTokens: number;
|
|
3214
|
+
};
|
|
3215
|
+
readonly "glm-4.7-free": {
|
|
3216
|
+
id: string;
|
|
3217
|
+
name: string;
|
|
3218
|
+
api: "openai-completions";
|
|
3219
|
+
provider: string;
|
|
3220
|
+
baseUrl: string;
|
|
3221
|
+
reasoning: true;
|
|
3222
|
+
input: "text"[];
|
|
3223
|
+
cost: {
|
|
3224
|
+
input: number;
|
|
3225
|
+
output: number;
|
|
3226
|
+
cacheRead: number;
|
|
3227
|
+
cacheWrite: number;
|
|
3228
|
+
};
|
|
3229
|
+
contextWindow: number;
|
|
3230
|
+
maxTokens: number;
|
|
3231
|
+
};
|
|
3232
|
+
readonly "gpt-5": {
|
|
3233
|
+
id: string;
|
|
3234
|
+
name: string;
|
|
3235
|
+
api: "openai-responses";
|
|
3236
|
+
provider: string;
|
|
3237
|
+
baseUrl: string;
|
|
3238
|
+
reasoning: true;
|
|
3239
|
+
input: ("image" | "text")[];
|
|
3240
|
+
cost: {
|
|
3241
|
+
input: number;
|
|
3242
|
+
output: number;
|
|
3243
|
+
cacheRead: number;
|
|
3244
|
+
cacheWrite: number;
|
|
3245
|
+
};
|
|
3246
|
+
contextWindow: number;
|
|
3247
|
+
maxTokens: number;
|
|
3248
|
+
};
|
|
3249
|
+
readonly "gpt-5-codex": {
|
|
3250
|
+
id: string;
|
|
3251
|
+
name: string;
|
|
3252
|
+
api: "openai-responses";
|
|
3253
|
+
provider: string;
|
|
3254
|
+
baseUrl: string;
|
|
3255
|
+
reasoning: true;
|
|
3256
|
+
input: ("image" | "text")[];
|
|
3257
|
+
cost: {
|
|
3258
|
+
input: number;
|
|
3259
|
+
output: number;
|
|
3260
|
+
cacheRead: number;
|
|
3261
|
+
cacheWrite: number;
|
|
3262
|
+
};
|
|
3263
|
+
contextWindow: number;
|
|
3264
|
+
maxTokens: number;
|
|
3265
|
+
};
|
|
3266
|
+
readonly "gpt-5-nano": {
|
|
3267
|
+
id: string;
|
|
3268
|
+
name: string;
|
|
3269
|
+
api: "openai-responses";
|
|
3270
|
+
provider: string;
|
|
3271
|
+
baseUrl: string;
|
|
3272
|
+
reasoning: true;
|
|
3273
|
+
input: ("image" | "text")[];
|
|
3274
|
+
cost: {
|
|
3275
|
+
input: number;
|
|
3276
|
+
output: number;
|
|
3277
|
+
cacheRead: number;
|
|
3278
|
+
cacheWrite: number;
|
|
3279
|
+
};
|
|
3280
|
+
contextWindow: number;
|
|
3281
|
+
maxTokens: number;
|
|
3282
|
+
};
|
|
3283
|
+
readonly "gpt-5.1": {
|
|
3284
|
+
id: string;
|
|
3285
|
+
name: string;
|
|
3286
|
+
api: "openai-responses";
|
|
3287
|
+
provider: string;
|
|
3288
|
+
baseUrl: string;
|
|
3289
|
+
reasoning: true;
|
|
3290
|
+
input: ("image" | "text")[];
|
|
3291
|
+
cost: {
|
|
3292
|
+
input: number;
|
|
3293
|
+
output: number;
|
|
3294
|
+
cacheRead: number;
|
|
3295
|
+
cacheWrite: number;
|
|
3296
|
+
};
|
|
3297
|
+
contextWindow: number;
|
|
3298
|
+
maxTokens: number;
|
|
3299
|
+
};
|
|
3300
|
+
readonly "gpt-5.1-codex": {
|
|
3301
|
+
id: string;
|
|
3302
|
+
name: string;
|
|
3303
|
+
api: "openai-responses";
|
|
3304
|
+
provider: string;
|
|
3305
|
+
baseUrl: string;
|
|
3306
|
+
reasoning: true;
|
|
3307
|
+
input: ("image" | "text")[];
|
|
3308
|
+
cost: {
|
|
3309
|
+
input: number;
|
|
3310
|
+
output: number;
|
|
3311
|
+
cacheRead: number;
|
|
3312
|
+
cacheWrite: number;
|
|
3313
|
+
};
|
|
3314
|
+
contextWindow: number;
|
|
3315
|
+
maxTokens: number;
|
|
3316
|
+
};
|
|
3317
|
+
readonly "gpt-5.1-codex-max": {
|
|
3318
|
+
id: string;
|
|
3319
|
+
name: string;
|
|
3320
|
+
api: "openai-responses";
|
|
3321
|
+
provider: string;
|
|
3322
|
+
baseUrl: string;
|
|
3323
|
+
reasoning: true;
|
|
3324
|
+
input: ("image" | "text")[];
|
|
3325
|
+
cost: {
|
|
3326
|
+
input: number;
|
|
3327
|
+
output: number;
|
|
3328
|
+
cacheRead: number;
|
|
3329
|
+
cacheWrite: number;
|
|
3330
|
+
};
|
|
3331
|
+
contextWindow: number;
|
|
3332
|
+
maxTokens: number;
|
|
3333
|
+
};
|
|
3334
|
+
readonly "gpt-5.1-codex-mini": {
|
|
3335
|
+
id: string;
|
|
3336
|
+
name: string;
|
|
3337
|
+
api: "openai-responses";
|
|
3338
|
+
provider: string;
|
|
3339
|
+
baseUrl: string;
|
|
3340
|
+
reasoning: true;
|
|
3341
|
+
input: ("image" | "text")[];
|
|
3342
|
+
cost: {
|
|
3343
|
+
input: number;
|
|
3344
|
+
output: number;
|
|
3345
|
+
cacheRead: number;
|
|
3346
|
+
cacheWrite: number;
|
|
3347
|
+
};
|
|
3348
|
+
contextWindow: number;
|
|
3349
|
+
maxTokens: number;
|
|
3350
|
+
};
|
|
3351
|
+
readonly "gpt-5.2": {
|
|
3352
|
+
id: string;
|
|
3353
|
+
name: string;
|
|
3354
|
+
api: "openai-responses";
|
|
3355
|
+
provider: string;
|
|
3356
|
+
baseUrl: string;
|
|
3357
|
+
reasoning: true;
|
|
3358
|
+
input: ("image" | "text")[];
|
|
3359
|
+
cost: {
|
|
3360
|
+
input: number;
|
|
3361
|
+
output: number;
|
|
3362
|
+
cacheRead: number;
|
|
3363
|
+
cacheWrite: number;
|
|
3364
|
+
};
|
|
3365
|
+
contextWindow: number;
|
|
3366
|
+
maxTokens: number;
|
|
3367
|
+
};
|
|
3368
|
+
readonly "grok-code": {
|
|
3369
|
+
id: string;
|
|
3370
|
+
name: string;
|
|
3371
|
+
api: "openai-completions";
|
|
3372
|
+
provider: string;
|
|
3373
|
+
baseUrl: string;
|
|
3374
|
+
reasoning: true;
|
|
3375
|
+
input: "text"[];
|
|
3376
|
+
cost: {
|
|
3377
|
+
input: number;
|
|
3378
|
+
output: number;
|
|
3379
|
+
cacheRead: number;
|
|
3380
|
+
cacheWrite: number;
|
|
3381
|
+
};
|
|
3382
|
+
contextWindow: number;
|
|
3383
|
+
maxTokens: number;
|
|
3384
|
+
};
|
|
3385
|
+
readonly "kimi-k2": {
|
|
3386
|
+
id: string;
|
|
3387
|
+
name: string;
|
|
3388
|
+
api: "openai-completions";
|
|
3389
|
+
provider: string;
|
|
3390
|
+
baseUrl: string;
|
|
3391
|
+
reasoning: false;
|
|
3392
|
+
input: "text"[];
|
|
3393
|
+
cost: {
|
|
3394
|
+
input: number;
|
|
3395
|
+
output: number;
|
|
3396
|
+
cacheRead: number;
|
|
3397
|
+
cacheWrite: number;
|
|
3398
|
+
};
|
|
3399
|
+
contextWindow: number;
|
|
3400
|
+
maxTokens: number;
|
|
3401
|
+
};
|
|
3402
|
+
readonly "kimi-k2-thinking": {
|
|
3403
|
+
id: string;
|
|
3404
|
+
name: string;
|
|
3405
|
+
api: "openai-completions";
|
|
3406
|
+
provider: string;
|
|
3407
|
+
baseUrl: string;
|
|
3408
|
+
reasoning: true;
|
|
3409
|
+
input: "text"[];
|
|
3410
|
+
cost: {
|
|
3411
|
+
input: number;
|
|
3412
|
+
output: number;
|
|
3413
|
+
cacheRead: number;
|
|
3414
|
+
cacheWrite: number;
|
|
3415
|
+
};
|
|
3416
|
+
contextWindow: number;
|
|
3417
|
+
maxTokens: number;
|
|
3418
|
+
};
|
|
3419
|
+
readonly "minimax-m2.1-free": {
|
|
3420
|
+
id: string;
|
|
3421
|
+
name: string;
|
|
3422
|
+
api: "anthropic-messages";
|
|
3423
|
+
provider: string;
|
|
3424
|
+
baseUrl: string;
|
|
3425
|
+
reasoning: true;
|
|
3426
|
+
input: "text"[];
|
|
3427
|
+
cost: {
|
|
3428
|
+
input: number;
|
|
3429
|
+
output: number;
|
|
3430
|
+
cacheRead: number;
|
|
3431
|
+
cacheWrite: number;
|
|
3432
|
+
};
|
|
3433
|
+
contextWindow: number;
|
|
3434
|
+
maxTokens: number;
|
|
3435
|
+
};
|
|
3436
|
+
readonly "qwen3-coder": {
|
|
3437
|
+
id: string;
|
|
3438
|
+
name: string;
|
|
3439
|
+
api: "openai-completions";
|
|
3440
|
+
provider: string;
|
|
3441
|
+
baseUrl: string;
|
|
3442
|
+
reasoning: false;
|
|
3443
|
+
input: "text"[];
|
|
3444
|
+
cost: {
|
|
3445
|
+
input: number;
|
|
3446
|
+
output: number;
|
|
3447
|
+
cacheRead: number;
|
|
3448
|
+
cacheWrite: number;
|
|
3449
|
+
};
|
|
3450
|
+
contextWindow: number;
|
|
3451
|
+
maxTokens: number;
|
|
3452
|
+
};
|
|
3453
|
+
};
|
|
3010
3454
|
readonly openrouter: {
|
|
3011
3455
|
readonly "ai21/jamba-large-1.7": {
|
|
3012
3456
|
id: string;
|