@earendil-works/pi-ai 0.80.7 → 0.80.8
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 +76 -22
- package/dist/api/lazy.d.ts.map +1 -1
- package/dist/api/lazy.js +9 -10
- package/dist/api/lazy.js.map +1 -1
- package/dist/api/openai-codex-responses.d.ts.map +1 -1
- package/dist/api/openai-codex-responses.js +3 -2
- package/dist/api/openai-codex-responses.js.map +1 -1
- package/dist/api/openai-responses.d.ts.map +1 -1
- package/dist/api/openai-responses.js +2 -0
- package/dist/api/openai-responses.js.map +1 -1
- package/dist/auth/credential-store.d.ts +2 -1
- package/dist/auth/credential-store.d.ts.map +1 -1
- package/dist/auth/credential-store.js +3 -0
- package/dist/auth/credential-store.js.map +1 -1
- package/dist/auth/helpers.d.ts.map +1 -1
- package/dist/auth/helpers.js +3 -3
- package/dist/auth/helpers.js.map +1 -1
- package/dist/auth/oauth/anthropic.d.ts +9 -0
- package/dist/auth/oauth/anthropic.d.ts.map +1 -0
- package/dist/{utils → auth}/oauth/anthropic.js +51 -116
- package/dist/auth/oauth/anthropic.js.map +1 -0
- package/dist/auth/oauth/device-code.d.ts.map +1 -0
- package/dist/auth/oauth/device-code.js.map +1 -0
- package/dist/auth/oauth/github-copilot.d.ts +6 -0
- package/dist/auth/oauth/github-copilot.d.ts.map +1 -0
- package/dist/{utils → auth}/oauth/github-copilot.js +18 -77
- package/dist/auth/oauth/github-copilot.js.map +1 -0
- package/dist/auth/oauth/load.d.ts +23 -0
- package/dist/auth/oauth/load.d.ts.map +1 -0
- package/dist/auth/oauth/load.js +49 -0
- package/dist/auth/oauth/load.js.map +1 -0
- package/dist/auth/oauth/oauth-page.d.ts.map +1 -0
- package/dist/auth/oauth/oauth-page.js.map +1 -0
- package/dist/auth/oauth/openai-codex.d.ts +9 -0
- package/dist/auth/oauth/openai-codex.d.ts.map +1 -0
- package/dist/{utils → auth}/oauth/openai-codex.js +61 -155
- package/dist/auth/oauth/openai-codex.js.map +1 -0
- package/dist/auth/oauth/pkce.d.ts.map +1 -0
- package/dist/auth/oauth/pkce.js.map +1 -0
- package/dist/auth/oauth/radius.d.ts +16 -0
- package/dist/auth/oauth/radius.d.ts.map +1 -0
- package/dist/{utils → auth}/oauth/radius.js +31 -128
- package/dist/auth/oauth/radius.js.map +1 -0
- package/dist/auth/oauth/xai.d.ts +6 -0
- package/dist/auth/oauth/xai.d.ts.map +1 -0
- package/dist/auth/oauth/xai.js +184 -0
- package/dist/auth/oauth/xai.js.map +1 -0
- package/dist/auth/resolve.d.ts +2 -4
- package/dist/auth/resolve.d.ts.map +1 -1
- package/dist/auth/resolve.js +9 -7
- package/dist/auth/resolve.js.map +1 -1
- package/dist/auth/types.d.ts +47 -10
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js.map +1 -1
- package/dist/bun-oauth.d.ts +3 -0
- package/dist/bun-oauth.d.ts.map +1 -0
- package/dist/bun-oauth.js +17 -0
- package/dist/bun-oauth.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +58 -76
- package/dist/cli.js.map +1 -1
- package/dist/compat/extension-oauth-types.d.ts +39 -0
- package/dist/compat/extension-oauth-types.d.ts.map +1 -0
- package/dist/compat/extension-oauth-types.js +2 -0
- package/dist/compat/extension-oauth-types.js.map +1 -0
- package/dist/compat.d.ts.map +1 -1
- package/dist/compat.js +20 -7
- package/dist/compat.js.map +1 -1
- package/dist/env-api-keys.d.ts.map +1 -1
- package/dist/env-api-keys.js +1 -1
- package/dist/env-api-keys.js.map +1 -1
- package/dist/images-models.d.ts +4 -2
- package/dist/images-models.d.ts.map +1 -1
- package/dist/images-models.js +5 -4
- package/dist/images-models.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/models-store.d.ts +25 -0
- package/dist/models-store.d.ts.map +1 -0
- package/dist/models-store.js +14 -0
- package/dist/models-store.js.map +1 -0
- package/dist/models.d.ts +66 -30
- package/dist/models.d.ts.map +1 -1
- package/dist/models.generated.d.ts +93 -4
- package/dist/models.generated.d.ts.map +1 -1
- package/dist/models.js +214 -29
- package/dist/models.js.map +1 -1
- package/dist/oauth.d.ts +2 -1
- package/dist/oauth.d.ts.map +1 -1
- package/dist/oauth.js +1 -1
- package/dist/oauth.js.map +1 -1
- package/dist/providers/all.d.ts +2 -1
- package/dist/providers/all.d.ts.map +1 -1
- package/dist/providers/all.js +3 -0
- package/dist/providers/all.js.map +1 -1
- package/dist/providers/amazon-bedrock.d.ts.map +1 -1
- package/dist/providers/amazon-bedrock.js +51 -10
- package/dist/providers/amazon-bedrock.js.map +1 -1
- package/dist/providers/anthropic.d.ts.map +1 -1
- package/dist/providers/anthropic.js +1 -1
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/cloudflare-ai-gateway.d.ts.map +1 -1
- package/dist/providers/cloudflare-ai-gateway.js +4 -3
- package/dist/providers/cloudflare-ai-gateway.js.map +1 -1
- package/dist/providers/cloudflare-auth.d.ts.map +1 -1
- package/dist/providers/cloudflare-auth.js +13 -20
- package/dist/providers/cloudflare-auth.js.map +1 -1
- package/dist/providers/cloudflare-stream.d.ts +8 -0
- package/dist/providers/cloudflare-stream.d.ts.map +1 -0
- package/dist/providers/cloudflare-stream.js +21 -0
- package/dist/providers/cloudflare-stream.js.map +1 -0
- package/dist/providers/cloudflare-workers-ai.d.ts.map +1 -1
- package/dist/providers/cloudflare-workers-ai.js +2 -1
- package/dist/providers/cloudflare-workers-ai.js.map +1 -1
- package/dist/providers/github-copilot.d.ts.map +1 -1
- package/dist/providers/github-copilot.js +11 -1
- package/dist/providers/github-copilot.js.map +1 -1
- package/dist/providers/google-vertex.d.ts.map +1 -1
- package/dist/providers/google-vertex.js +56 -5
- package/dist/providers/google-vertex.js.map +1 -1
- package/dist/providers/kimi-coding.models.d.ts +20 -0
- package/dist/providers/kimi-coding.models.d.ts.map +1 -1
- package/dist/providers/kimi-coding.models.js +18 -0
- package/dist/providers/kimi-coding.models.js.map +1 -1
- package/dist/providers/openai-codex.d.ts.map +1 -1
- package/dist/providers/openai-codex.js +1 -1
- package/dist/providers/openai-codex.js.map +1 -1
- package/dist/providers/openrouter.models.d.ts.map +1 -1
- package/dist/providers/openrouter.models.js +135 -135
- package/dist/providers/openrouter.models.js.map +1 -1
- package/dist/providers/radius-config.d.ts +26 -0
- package/dist/providers/radius-config.d.ts.map +1 -0
- package/dist/providers/radius-config.js +59 -0
- package/dist/providers/radius-config.js.map +1 -0
- package/dist/providers/radius.d.ts +9 -0
- package/dist/providers/radius.d.ts.map +1 -0
- package/dist/providers/radius.js +54 -0
- package/dist/providers/radius.js.map +1 -0
- package/dist/providers/vercel-ai-gateway.models.d.ts +67 -0
- package/dist/providers/vercel-ai-gateway.models.d.ts.map +1 -1
- package/dist/providers/vercel-ai-gateway.models.js +57 -2
- package/dist/providers/vercel-ai-gateway.models.js.map +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.d.ts.map +1 -1
- package/dist/providers/xai.js +11 -3
- package/dist/providers/xai.js.map +1 -1
- package/dist/providers/xai.models.d.ts +6 -4
- package/dist/providers/xai.models.d.ts.map +1 -1
- package/dist/providers/xai.models.js +3 -2
- package/dist/providers/xai.models.js.map +1 -1
- package/package.json +6 -1
- package/dist/utils/oauth/anthropic.d.ts +0 -27
- package/dist/utils/oauth/anthropic.d.ts.map +0 -1
- package/dist/utils/oauth/anthropic.js.map +0 -1
- package/dist/utils/oauth/device-code.d.ts.map +0 -1
- package/dist/utils/oauth/device-code.js.map +0 -1
- package/dist/utils/oauth/github-copilot.d.ts +0 -32
- package/dist/utils/oauth/github-copilot.d.ts.map +0 -1
- package/dist/utils/oauth/github-copilot.js.map +0 -1
- package/dist/utils/oauth/index.d.ts +0 -59
- package/dist/utils/oauth/index.d.ts.map +0 -1
- package/dist/utils/oauth/index.js +0 -131
- package/dist/utils/oauth/index.js.map +0 -1
- package/dist/utils/oauth/load.d.ts +0 -5
- package/dist/utils/oauth/load.d.ts.map +0 -1
- package/dist/utils/oauth/load.js +0 -22
- package/dist/utils/oauth/load.js.map +0 -1
- package/dist/utils/oauth/oauth-page.d.ts.map +0 -1
- package/dist/utils/oauth/oauth-page.js.map +0 -1
- package/dist/utils/oauth/openai-codex.d.ts +0 -45
- package/dist/utils/oauth/openai-codex.d.ts.map +0 -1
- package/dist/utils/oauth/openai-codex.js.map +0 -1
- package/dist/utils/oauth/pkce.d.ts.map +0 -1
- package/dist/utils/oauth/pkce.js.map +0 -1
- package/dist/utils/oauth/radius.d.ts +0 -39
- package/dist/utils/oauth/radius.d.ts.map +0 -1
- package/dist/utils/oauth/radius.js.map +0 -1
- package/dist/utils/oauth/types.d.ts +0 -64
- package/dist/utils/oauth/types.d.ts.map +0 -1
- package/dist/utils/oauth/types.js +0 -2
- package/dist/utils/oauth/types.js.map +0 -1
- /package/dist/{utils → auth}/oauth/device-code.d.ts +0 -0
- /package/dist/{utils → auth}/oauth/device-code.js +0 -0
- /package/dist/{utils → auth}/oauth/oauth-page.d.ts +0 -0
- /package/dist/{utils → auth}/oauth/oauth-page.js +0 -0
- /package/dist/{utils → auth}/oauth/pkce.d.ts +0 -0
- /package/dist/{utils → auth}/oauth/pkce.js +0 -0
|
@@ -2,8 +2,8 @@ import { anthropicMessagesApi } from "../api/anthropic-messages.lazy.js";
|
|
|
2
2
|
import { openAICompletionsApi } from "../api/openai-completions.lazy.js";
|
|
3
3
|
import { openAIResponsesApi } from "../api/openai-responses.lazy.js";
|
|
4
4
|
import { envApiKeyAuth, lazyOAuth } from "../auth/helpers.js";
|
|
5
|
+
import { loadGitHubCopilotOAuth } from "../auth/oauth/load.js";
|
|
5
6
|
import { createProvider } from "../models.js";
|
|
6
|
-
import { loadGitHubCopilotOAuth } from "../utils/oauth/load.js";
|
|
7
7
|
import { GITHUB_COPILOT_MODELS } from "./github-copilot.models.js";
|
|
8
8
|
export function githubCopilotProvider() {
|
|
9
9
|
return createProvider({
|
|
@@ -15,6 +15,16 @@ export function githubCopilotProvider() {
|
|
|
15
15
|
oauth: lazyOAuth({ name: "GitHub Copilot", load: loadGitHubCopilotOAuth }),
|
|
16
16
|
},
|
|
17
17
|
models: Object.values(GITHUB_COPILOT_MODELS),
|
|
18
|
+
filterModels: (models, credential) => {
|
|
19
|
+
if (credential?.type !== "oauth")
|
|
20
|
+
return models;
|
|
21
|
+
const availableModelIds = credential.availableModelIds;
|
|
22
|
+
if (!Array.isArray(availableModelIds) || !availableModelIds.every((id) => typeof id === "string")) {
|
|
23
|
+
return models;
|
|
24
|
+
}
|
|
25
|
+
const available = new Set(availableModelIds);
|
|
26
|
+
return models.filter((model) => available.has(model.id));
|
|
27
|
+
},
|
|
18
28
|
api: {
|
|
19
29
|
"anthropic-messages": anthropicMessagesApi(),
|
|
20
30
|
"openai-completions": openAICompletionsApi(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-copilot.js","sourceRoot":"","sources":["../../src/providers/github-copilot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"github-copilot.js","sourceRoot":"","sources":["../../src/providers/github-copilot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,s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;SACxC;KACD,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { anthropicMessagesApi } from \"../api/anthropic-messages.lazy.ts\";\nimport { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { openAIResponsesApi } from \"../api/openai-responses.lazy.ts\";\nimport { envApiKeyAuth, lazyOAuth } from \"../auth/helpers.ts\";\nimport { loadGitHubCopilotOAuth } from \"../auth/oauth/load.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { GITHUB_COPILOT_MODELS } from \"./github-copilot.models.ts\";\n\nexport function githubCopilotProvider(): Provider<\"anthropic-messages\" | \"openai-completions\" | \"openai-responses\"> {\n\treturn createProvider({\n\t\tid: \"github-copilot\",\n\t\tname: \"GitHub Copilot\",\n\t\tbaseUrl: \"https://api.individual.githubcopilot.com\",\n\t\tauth: {\n\t\t\tapiKey: envApiKeyAuth(\"GitHub Copilot token\", [\"COPILOT_GITHUB_TOKEN\"]),\n\t\t\toauth: lazyOAuth({ name: \"GitHub Copilot\", load: loadGitHubCopilotOAuth }),\n\t\t},\n\t\tmodels: Object.values(GITHUB_COPILOT_MODELS),\n\t\tfilterModels: (models, credential) => {\n\t\t\tif (credential?.type !== \"oauth\") return models;\n\t\t\tconst availableModelIds = credential.availableModelIds;\n\t\t\tif (!Array.isArray(availableModelIds) || !availableModelIds.every((id) => typeof id === \"string\")) {\n\t\t\t\treturn models;\n\t\t\t}\n\t\t\tconst available = new Set(availableModelIds);\n\t\t\treturn models.filter((model) => available.has(model.id));\n\t\t},\n\t\tapi: {\n\t\t\t\"anthropic-messages\": anthropicMessagesApi(),\n\t\t\t\"openai-completions\": openAICompletionsApi(),\n\t\t\t\"openai-responses\": openAIResponsesApi(),\n\t\t},\n\t});\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-vertex.d.ts","sourceRoot":"","sources":["../../src/providers/google-vertex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"google-vertex.d.ts","sourceRoot":"","sources":["../../src/providers/google-vertex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAkF7D,wBAAgB,oBAAoB,IAAI,QAAQ,CAAC,eAAe,CAAC,CAQhE","sourcesContent":["import { googleVertexApi } from \"../api/google-vertex.lazy.ts\";\nimport type { ApiKeyAuth } from \"../auth/types.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { GOOGLE_VERTEX_MODELS } from \"./google-vertex.models.ts\";\n\nconst VERTEX_ADC_PATH = \"~/.config/gcloud/application_default_credentials.json\";\n\n/**\n * Vertex accepts an explicit API key or Application Default Credentials\n * (`gcloud auth application-default login`). ADC additionally requires\n * project and location env vars, which the implementation reads itself.\n */\nconst vertexAuth: ApiKeyAuth = {\n\tname: \"Google Cloud credentials\",\n\tlogin: async (interaction) => {\n\t\tconst method = await interaction.prompt({\n\t\t\ttype: \"select\",\n\t\t\tmessage: \"Select Google Vertex AI authentication method:\",\n\t\t\toptions: [\n\t\t\t\t{ id: \"api-key\", label: \"Google Cloud API key\" },\n\t\t\t\t{ id: \"adc\", label: \"Application Default Credentials\" },\n\t\t\t\t{ id: \"service-account\", label: \"Service account credentials file\" },\n\t\t\t],\n\t\t});\n\t\tif (method === \"api-key\") {\n\t\t\treturn {\n\t\t\t\ttype: \"api_key\",\n\t\t\t\tkey: await interaction.prompt({ type: \"secret\", message: \"Enter Google Cloud API key\" }),\n\t\t\t};\n\t\t}\n\t\tif (method !== \"adc\" && method !== \"service-account\") {\n\t\t\tthrow new Error(`Unknown Google Vertex AI auth method: ${method}`);\n\t\t}\n\t\tinteraction.notify({\n\t\t\ttype: \"info\",\n\t\t\tmessage:\n\t\t\t\tmethod === \"adc\"\n\t\t\t\t\t? \"Run `gcloud auth application-default login`, then provide the project and location.\"\n\t\t\t\t\t: \"Provide a service account credentials file, project, and location.\",\n\t\t\tlinks: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Application Default Credentials\",\n\t\t\t\t\turl: \"https://cloud.google.com/docs/authentication/provide-credentials-adc\",\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t\tconst project = await interaction.prompt({ type: \"text\", message: \"Enter Google Cloud project ID\" });\n\t\tconst location = await interaction.prompt({ type: \"text\", message: \"Enter Google Cloud location\" });\n\t\tconst credentialsPath =\n\t\t\tmethod === \"service-account\"\n\t\t\t\t? await interaction.prompt({ type: \"text\", message: \"Enter service account credentials file path\" })\n\t\t\t\t: undefined;\n\t\treturn {\n\t\t\ttype: \"api_key\",\n\t\t\tenv: {\n\t\t\t\tGOOGLE_CLOUD_PROJECT: project,\n\t\t\t\tGOOGLE_CLOUD_LOCATION: location,\n\t\t\t\t...(credentialsPath ? { GOOGLE_APPLICATION_CREDENTIALS: credentialsPath } : {}),\n\t\t\t},\n\t\t};\n\t},\n\tresolve: async ({ ctx, credential }) => {\n\t\tconst key = credential?.key ?? (await ctx.env(\"GOOGLE_CLOUD_API_KEY\"));\n\t\tif (key) return { auth: { apiKey: key }, source: credential?.key ? \"stored credential\" : \"GOOGLE_CLOUD_API_KEY\" };\n\n\t\tconst adcPath =\n\t\t\tcredential?.env?.GOOGLE_APPLICATION_CREDENTIALS ?? (await ctx.env(\"GOOGLE_APPLICATION_CREDENTIALS\"));\n\t\tconst hasCredentials = await ctx.fileExists(adcPath ?? VERTEX_ADC_PATH);\n\t\tconst project =\n\t\t\tcredential?.env?.GOOGLE_CLOUD_PROJECT ??\n\t\t\t(await ctx.env(\"GOOGLE_CLOUD_PROJECT\")) ??\n\t\t\t(await ctx.env(\"GCLOUD_PROJECT\"));\n\t\tconst location = credential?.env?.GOOGLE_CLOUD_LOCATION ?? (await ctx.env(\"GOOGLE_CLOUD_LOCATION\"));\n\t\tif (hasCredentials && project && location) {\n\t\t\treturn {\n\t\t\t\tauth: {},\n\t\t\t\tenv: credential?.env,\n\t\t\t\tsource: credential ? \"stored credential\" : \"gcloud application default credentials\",\n\t\t\t};\n\t\t}\n\t\treturn undefined;\n\t},\n};\n\nexport function googleVertexProvider(): Provider<\"google-vertex\"> {\n\treturn createProvider({\n\t\tid: \"google-vertex\",\n\t\tname: \"Google Vertex AI\",\n\t\tauth: { apiKey: vertexAuth },\n\t\tmodels: Object.values(GOOGLE_VERTEX_MODELS),\n\t\tapi: googleVertexApi(),\n\t});\n}\n"]}
|
|
@@ -9,16 +9,67 @@ const VERTEX_ADC_PATH = "~/.config/gcloud/application_default_credentials.json";
|
|
|
9
9
|
*/
|
|
10
10
|
const vertexAuth = {
|
|
11
11
|
name: "Google Cloud credentials",
|
|
12
|
+
login: async (interaction) => {
|
|
13
|
+
const method = await interaction.prompt({
|
|
14
|
+
type: "select",
|
|
15
|
+
message: "Select Google Vertex AI authentication method:",
|
|
16
|
+
options: [
|
|
17
|
+
{ id: "api-key", label: "Google Cloud API key" },
|
|
18
|
+
{ id: "adc", label: "Application Default Credentials" },
|
|
19
|
+
{ id: "service-account", label: "Service account credentials file" },
|
|
20
|
+
],
|
|
21
|
+
});
|
|
22
|
+
if (method === "api-key") {
|
|
23
|
+
return {
|
|
24
|
+
type: "api_key",
|
|
25
|
+
key: await interaction.prompt({ type: "secret", message: "Enter Google Cloud API key" }),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (method !== "adc" && method !== "service-account") {
|
|
29
|
+
throw new Error(`Unknown Google Vertex AI auth method: ${method}`);
|
|
30
|
+
}
|
|
31
|
+
interaction.notify({
|
|
32
|
+
type: "info",
|
|
33
|
+
message: method === "adc"
|
|
34
|
+
? "Run `gcloud auth application-default login`, then provide the project and location."
|
|
35
|
+
: "Provide a service account credentials file, project, and location.",
|
|
36
|
+
links: [
|
|
37
|
+
{
|
|
38
|
+
label: "Application Default Credentials",
|
|
39
|
+
url: "https://cloud.google.com/docs/authentication/provide-credentials-adc",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
});
|
|
43
|
+
const project = await interaction.prompt({ type: "text", message: "Enter Google Cloud project ID" });
|
|
44
|
+
const location = await interaction.prompt({ type: "text", message: "Enter Google Cloud location" });
|
|
45
|
+
const credentialsPath = method === "service-account"
|
|
46
|
+
? await interaction.prompt({ type: "text", message: "Enter service account credentials file path" })
|
|
47
|
+
: undefined;
|
|
48
|
+
return {
|
|
49
|
+
type: "api_key",
|
|
50
|
+
env: {
|
|
51
|
+
GOOGLE_CLOUD_PROJECT: project,
|
|
52
|
+
GOOGLE_CLOUD_LOCATION: location,
|
|
53
|
+
...(credentialsPath ? { GOOGLE_APPLICATION_CREDENTIALS: credentialsPath } : {}),
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
},
|
|
12
57
|
resolve: async ({ ctx, credential }) => {
|
|
13
58
|
const key = credential?.key ?? (await ctx.env("GOOGLE_CLOUD_API_KEY"));
|
|
14
59
|
if (key)
|
|
15
60
|
return { auth: { apiKey: key }, source: credential?.key ? "stored credential" : "GOOGLE_CLOUD_API_KEY" };
|
|
16
|
-
const adcPath = await ctx.env("GOOGLE_APPLICATION_CREDENTIALS");
|
|
61
|
+
const adcPath = credential?.env?.GOOGLE_APPLICATION_CREDENTIALS ?? (await ctx.env("GOOGLE_APPLICATION_CREDENTIALS"));
|
|
17
62
|
const hasCredentials = await ctx.fileExists(adcPath ?? VERTEX_ADC_PATH);
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
63
|
+
const project = credential?.env?.GOOGLE_CLOUD_PROJECT ??
|
|
64
|
+
(await ctx.env("GOOGLE_CLOUD_PROJECT")) ??
|
|
65
|
+
(await ctx.env("GCLOUD_PROJECT"));
|
|
66
|
+
const location = credential?.env?.GOOGLE_CLOUD_LOCATION ?? (await ctx.env("GOOGLE_CLOUD_LOCATION"));
|
|
67
|
+
if (hasCredentials && project && location) {
|
|
68
|
+
return {
|
|
69
|
+
auth: {},
|
|
70
|
+
env: credential?.env,
|
|
71
|
+
source: credential ? "stored credential" : "gcloud application default credentials",
|
|
72
|
+
};
|
|
22
73
|
}
|
|
23
74
|
return undefined;
|
|
24
75
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-vertex.js","sourceRoot":"","sources":["../../src/providers/google-vertex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,eAAe,GAAG,uDAAuD,CAAC;AAEhF;;;;GAIG;AACH,MAAM,UAAU,GAAe;IAC9B,IAAI,EAAE,0BAA0B;IAChC,OAAO,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;QACvC,MAAM,GAAG,GAAG,UAAU,EAAE,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC;QACvE,IAAI,GAAG;YAAE,OAAO,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,sBAAsB,EAAE,CAAC;QAElH,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"google-vertex.js","sourceRoot":"","sources":["../../src/providers/google-vertex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,eAAe,GAAG,uDAAuD,CAAC;AAEhF;;;;GAIG;AACH,MAAM,UAAU,GAAe;IAC9B,IAAI,EAAE,0BAA0B;IA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AU,EAAE,GAAG,EAAE,qBAAqB,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC;QACpG,IAAI,cAAc,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC3C,OAAO;gBACN,IAAI,EAAE,EAAE;gBACR,GAAG,EAAE,UAAU,EAAE,GAAG;gBACpB,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,wCAAwC;aACnF,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IAAA,CACjB;CACD,CAAC;AAEF,MAAM,UAAU,oBAAoB,GAA8B;IACjE,OAAO,cAAc,CAAC;QACrB,EAAE,EAAE,eAAe;QACnB,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;QAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC;QAC3C,GAAG,EAAE,eAAe,EAAE;KACtB,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { googleVertexApi } from \"../api/google-vertex.lazy.ts\";\nimport type { ApiKeyAuth } from \"../auth/types.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { GOOGLE_VERTEX_MODELS } from \"./google-vertex.models.ts\";\n\nconst VERTEX_ADC_PATH = \"~/.config/gcloud/application_default_credentials.json\";\n\n/**\n * Vertex accepts an explicit API key or Application Default Credentials\n * (`gcloud auth application-default login`). ADC additionally requires\n * project and location env vars, which the implementation reads itself.\n */\nconst vertexAuth: ApiKeyAuth = {\n\tname: \"Google Cloud credentials\",\n\tlogin: async (interaction) => {\n\t\tconst method = await interaction.prompt({\n\t\t\ttype: \"select\",\n\t\t\tmessage: \"Select Google Vertex AI authentication method:\",\n\t\t\toptions: [\n\t\t\t\t{ id: \"api-key\", label: \"Google Cloud API key\" },\n\t\t\t\t{ id: \"adc\", label: \"Application Default Credentials\" },\n\t\t\t\t{ id: \"service-account\", label: \"Service account credentials file\" },\n\t\t\t],\n\t\t});\n\t\tif (method === \"api-key\") {\n\t\t\treturn {\n\t\t\t\ttype: \"api_key\",\n\t\t\t\tkey: await interaction.prompt({ type: \"secret\", message: \"Enter Google Cloud API key\" }),\n\t\t\t};\n\t\t}\n\t\tif (method !== \"adc\" && method !== \"service-account\") {\n\t\t\tthrow new Error(`Unknown Google Vertex AI auth method: ${method}`);\n\t\t}\n\t\tinteraction.notify({\n\t\t\ttype: \"info\",\n\t\t\tmessage:\n\t\t\t\tmethod === \"adc\"\n\t\t\t\t\t? \"Run `gcloud auth application-default login`, then provide the project and location.\"\n\t\t\t\t\t: \"Provide a service account credentials file, project, and location.\",\n\t\t\tlinks: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Application Default Credentials\",\n\t\t\t\t\turl: \"https://cloud.google.com/docs/authentication/provide-credentials-adc\",\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t\tconst project = await interaction.prompt({ type: \"text\", message: \"Enter Google Cloud project ID\" });\n\t\tconst location = await interaction.prompt({ type: \"text\", message: \"Enter Google Cloud location\" });\n\t\tconst credentialsPath =\n\t\t\tmethod === \"service-account\"\n\t\t\t\t? await interaction.prompt({ type: \"text\", message: \"Enter service account credentials file path\" })\n\t\t\t\t: undefined;\n\t\treturn {\n\t\t\ttype: \"api_key\",\n\t\t\tenv: {\n\t\t\t\tGOOGLE_CLOUD_PROJECT: project,\n\t\t\t\tGOOGLE_CLOUD_LOCATION: location,\n\t\t\t\t...(credentialsPath ? { GOOGLE_APPLICATION_CREDENTIALS: credentialsPath } : {}),\n\t\t\t},\n\t\t};\n\t},\n\tresolve: async ({ ctx, credential }) => {\n\t\tconst key = credential?.key ?? (await ctx.env(\"GOOGLE_CLOUD_API_KEY\"));\n\t\tif (key) return { auth: { apiKey: key }, source: credential?.key ? \"stored credential\" : \"GOOGLE_CLOUD_API_KEY\" };\n\n\t\tconst adcPath =\n\t\t\tcredential?.env?.GOOGLE_APPLICATION_CREDENTIALS ?? (await ctx.env(\"GOOGLE_APPLICATION_CREDENTIALS\"));\n\t\tconst hasCredentials = await ctx.fileExists(adcPath ?? VERTEX_ADC_PATH);\n\t\tconst project =\n\t\t\tcredential?.env?.GOOGLE_CLOUD_PROJECT ??\n\t\t\t(await ctx.env(\"GOOGLE_CLOUD_PROJECT\")) ??\n\t\t\t(await ctx.env(\"GCLOUD_PROJECT\"));\n\t\tconst location = credential?.env?.GOOGLE_CLOUD_LOCATION ?? (await ctx.env(\"GOOGLE_CLOUD_LOCATION\"));\n\t\tif (hasCredentials && project && location) {\n\t\t\treturn {\n\t\t\t\tauth: {},\n\t\t\t\tenv: credential?.env,\n\t\t\t\tsource: credential ? \"stored credential\" : \"gcloud application default credentials\",\n\t\t\t};\n\t\t}\n\t\treturn undefined;\n\t},\n};\n\nexport function googleVertexProvider(): Provider<\"google-vertex\"> {\n\treturn createProvider({\n\t\tid: \"google-vertex\",\n\t\tname: \"Google Vertex AI\",\n\t\tauth: { apiKey: vertexAuth },\n\t\tmodels: Object.values(GOOGLE_VERTEX_MODELS),\n\t\tapi: googleVertexApi(),\n\t});\n}\n"]}
|
|
@@ -39,6 +39,26 @@ export declare const KIMI_CODING_MODELS: {
|
|
|
39
39
|
contextWindow: number;
|
|
40
40
|
maxTokens: number;
|
|
41
41
|
};
|
|
42
|
+
readonly "kimi-for-coding-highspeed": {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
api: "anthropic-messages";
|
|
46
|
+
provider: string;
|
|
47
|
+
baseUrl: string;
|
|
48
|
+
headers: {
|
|
49
|
+
"User-Agent": string;
|
|
50
|
+
};
|
|
51
|
+
reasoning: true;
|
|
52
|
+
input: ("image" | "text")[];
|
|
53
|
+
cost: {
|
|
54
|
+
input: number;
|
|
55
|
+
output: number;
|
|
56
|
+
cacheRead: number;
|
|
57
|
+
cacheWrite: number;
|
|
58
|
+
};
|
|
59
|
+
contextWindow: number;
|
|
60
|
+
maxTokens: number;
|
|
61
|
+
};
|
|
42
62
|
readonly "kimi-k2-thinking": {
|
|
43
63
|
id: string;
|
|
44
64
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kimi-coding.models.d.ts","sourceRoot":"","sources":["../../src/providers/kimi-coding.models.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"kimi-coding.models.d.ts","sourceRoot":"","sources":["../../src/providers/kimi-coding.models.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyErB,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport type { Model } from \"../types.ts\";\n\nexport const KIMI_CODING_MODELS = {\n\t\"k2p7\": {\n\t\tid: \"k2p7\",\n\t\tname: \"Kimi K2.7 Code\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-for-coding\": {\n\t\tid: \"kimi-for-coding\",\n\t\tname: \"Kimi For Coding\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-for-coding-highspeed\": {\n\t\tid: \"kimi-for-coding-highspeed\",\n\t\tname: \"Kimi For Coding HighSpeed\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-k2-thinking\": {\n\t\tid: \"kimi-k2-thinking\",\n\t\tname: \"Kimi K2 Thinking\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n} as const;\n"]}
|
|
@@ -37,6 +37,24 @@ export const KIMI_CODING_MODELS = {
|
|
|
37
37
|
contextWindow: 262144,
|
|
38
38
|
maxTokens: 32768,
|
|
39
39
|
},
|
|
40
|
+
"kimi-for-coding-highspeed": {
|
|
41
|
+
id: "kimi-for-coding-highspeed",
|
|
42
|
+
name: "Kimi For Coding HighSpeed",
|
|
43
|
+
api: "anthropic-messages",
|
|
44
|
+
provider: "kimi-coding",
|
|
45
|
+
baseUrl: "https://api.kimi.com/coding",
|
|
46
|
+
headers: { "User-Agent": "KimiCLI/1.5" },
|
|
47
|
+
reasoning: true,
|
|
48
|
+
input: ["text", "image"],
|
|
49
|
+
cost: {
|
|
50
|
+
input: 0,
|
|
51
|
+
output: 0,
|
|
52
|
+
cacheRead: 0,
|
|
53
|
+
cacheWrite: 0,
|
|
54
|
+
},
|
|
55
|
+
contextWindow: 262144,
|
|
56
|
+
maxTokens: 32768,
|
|
57
|
+
},
|
|
40
58
|
"kimi-k2-thinking": {
|
|
41
59
|
id: "kimi-k2-thinking",
|
|
42
60
|
name: "Kimi K2 Thinking",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kimi-coding.models.js","sourceRoot":"","sources":["../../src/providers/kimi-coding.models.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,iEAAiE;AAIjE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,MAAM,EAAE;QACP,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,gBAAgB;QACtB,GAAG,EAAE,oBAAoB;QACzB,QAAQ,EAAE,aAAa;QACvB,OAAO,EAAE,6BAA6B;QACtC,OAAO,EAAE,EAAC,YAAY,EAAC,aAAa,EAAC;QACrC,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;QACxB,IAAI,EAAE;YACL,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,SAAS,EAAE,CAAC;YACZ,UAAU,EAAE,CAAC;SACb;QACD,aAAa,EAAE,MAAM;QACrB,SAAS,EAAE,KAAK;KACsB;IACvC,iBAAiB,EAAE;QAClB,EAAE,EAAE,iBAAiB;QACrB,IAAI,EAAE,iBAAiB;QACvB,GAAG,EAAE,oBAAoB;QACzB,QAAQ,EAAE,aAAa;QACvB,OAAO,EAAE,6BAA6B;QACtC,OAAO,EAAE,EAAC,YAAY,EAAC,aAAa,EAAC;QACrC,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;QACxB,IAAI,EAAE;YACL,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,SAAS,EAAE,CAAC;YACZ,UAAU,EAAE,CAAC;SACb;QACD,aAAa,EAAE,MAAM;QACrB,SAAS,EAAE,KAAK;KACsB;IACvC,kBAAkB,EAAE;QACnB,EAAE,EAAE,kBAAkB;QACtB,IAAI,EAAE,kBAAkB;QACxB,GAAG,EAAE,oBAAoB;QACzB,QAAQ,EAAE,aAAa;QACvB,OAAO,EAAE,6BAA6B;QACtC,OAAO,EAAE,EAAC,YAAY,EAAC,aAAa,EAAC;QACrC,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,CAAC,MAAM,CAAC;QACf,IAAI,EAAE;YACL,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,SAAS,EAAE,CAAC;YACZ,UAAU,EAAE,CAAC;SACb;QACD,aAAa,EAAE,MAAM;QACrB,SAAS,EAAE,KAAK;KACsB;CAC9B,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport type { Model } from \"../types.ts\";\n\nexport const KIMI_CODING_MODELS = {\n\t\"k2p7\": {\n\t\tid: \"k2p7\",\n\t\tname: \"Kimi K2.7 Code\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-for-coding\": {\n\t\tid: \"kimi-for-coding\",\n\t\tname: \"Kimi For Coding\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-k2-thinking\": {\n\t\tid: \"kimi-k2-thinking\",\n\t\tname: \"Kimi K2 Thinking\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n} as const;\n"]}
|
|
1
|
+
{"version":3,"file":"kimi-coding.models.js","sourceRoot":"","sources":["../../src/providers/kimi-coding.models.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,iEAAiE;AAIjE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,MAAM,EAAE;QACP,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,gBAAgB;QACtB,GAAG,EAAE,oBAAoB;QACzB,QAAQ,EAAE,aAAa;QACvB,OAAO,EAAE,6BAA6B;QACtC,OAAO,EAAE,EAAC,YAAY,EAAC,aAAa,EAAC;QACrC,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;QACxB,IAAI,EAAE;YACL,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,SAAS,EAAE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,IAAI,EAAE;YACL,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,SAAS,EAAE,CAAC;YACZ,UAAU,EAAE,CAAC;SACb;QACD,aAAa,EAAE,MAAM;QACrB,SAAS,EAAE,KAAK;KACsB;CAC9B,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport type { Model } from \"../types.ts\";\n\nexport const KIMI_CODING_MODELS = {\n\t\"k2p7\": {\n\t\tid: \"k2p7\",\n\t\tname: \"Kimi K2.7 Code\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-for-coding\": {\n\t\tid: \"kimi-for-coding\",\n\t\tname: \"Kimi For Coding\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-for-coding-highspeed\": {\n\t\tid: \"kimi-for-coding-highspeed\",\n\t\tname: \"Kimi For Coding HighSpeed\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-k2-thinking\": {\n\t\tid: \"kimi-k2-thinking\",\n\t\tname: \"Kimi K2 Thinking\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n} as const;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-codex.d.ts","sourceRoot":"","sources":["../../src/providers/openai-codex.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"openai-codex.d.ts","sourceRoot":"","sources":["../../src/providers/openai-codex.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7D,wBAAgB,mBAAmB,IAAI,QAAQ,CAAC,wBAAwB,CAAC,CAWxE","sourcesContent":["import { openAICodexResponsesApi } from \"../api/openai-codex-responses.lazy.ts\";\nimport { lazyOAuth } from \"../auth/helpers.ts\";\nimport { loadOpenAICodexOAuth } from \"../auth/oauth/load.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { OPENAI_CODEX_MODELS } from \"./openai-codex.models.ts\";\n\nexport function openaiCodexProvider(): Provider<\"openai-codex-responses\"> {\n\treturn createProvider({\n\t\tid: \"openai-codex\",\n\t\tname: \"OpenAI Codex\",\n\t\tbaseUrl: \"https://chatgpt.com/backend-api\",\n\t\tauth: {\n\t\t\toauth: lazyOAuth({ name: \"OpenAI (ChatGPT Plus/Pro)\", load: loadOpenAICodexOAuth }),\n\t\t},\n\t\tmodels: Object.values(OPENAI_CODEX_MODELS),\n\t\tapi: openAICodexResponsesApi(),\n\t});\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { openAICodexResponsesApi } from "../api/openai-codex-responses.lazy.js";
|
|
2
2
|
import { lazyOAuth } from "../auth/helpers.js";
|
|
3
|
+
import { loadOpenAICodexOAuth } from "../auth/oauth/load.js";
|
|
3
4
|
import { createProvider } from "../models.js";
|
|
4
|
-
import { loadOpenAICodexOAuth } from "../utils/oauth/load.js";
|
|
5
5
|
import { OPENAI_CODEX_MODELS } from "./openai-codex.models.js";
|
|
6
6
|
export function openaiCodexProvider() {
|
|
7
7
|
return createProvider({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-codex.js","sourceRoot":"","sources":["../../src/providers/openai-codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"openai-codex.js","sourceRoot":"","sources":["../../src/providers/openai-codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,UAAU,mBAAmB,GAAuC;IACzE,OAAO,cAAc,CAAC;QACrB,EAAE,EAAE,cAAc;QAClB,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,iCAAiC;QAC1C,IAAI,EAAE;YACL,KAAK,EAAE,SAAS,CAAC,EAAE,IAAI,EAAE,2BAA2B,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;SACnF;QACD,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC;QAC1C,GAAG,EAAE,uBAAuB,EAAE;KAC9B,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { openAICodexResponsesApi } from \"../api/openai-codex-responses.lazy.ts\";\nimport { lazyOAuth } from \"../auth/helpers.ts\";\nimport { loadOpenAICodexOAuth } from \"../auth/oauth/load.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { OPENAI_CODEX_MODELS } from \"./openai-codex.models.ts\";\n\nexport function openaiCodexProvider(): Provider<\"openai-codex-responses\"> {\n\treturn createProvider({\n\t\tid: \"openai-codex\",\n\t\tname: \"OpenAI Codex\",\n\t\tbaseUrl: \"https://chatgpt.com/backend-api\",\n\t\tauth: {\n\t\t\toauth: lazyOAuth({ name: \"OpenAI (ChatGPT Plus/Pro)\", load: loadOpenAICodexOAuth }),\n\t\t},\n\t\tmodels: Object.values(OPENAI_CODEX_MODELS),\n\t\tapi: openAICodexResponsesApi(),\n\t});\n}\n"]}
|