@draht/ai 2026.3.2 → 2026.3.4

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.
Files changed (63) hide show
  1. package/README.md +31 -28
  2. package/bedrock-provider.d.ts +1 -0
  3. package/bedrock-provider.js +1 -0
  4. package/dist/bedrock-provider.d.ts +5 -0
  5. package/dist/bedrock-provider.d.ts.map +1 -0
  6. package/dist/bedrock-provider.js +6 -0
  7. package/dist/bedrock-provider.js.map +1 -0
  8. package/dist/cli.js +0 -0
  9. package/dist/env-api-keys.d.ts.map +1 -1
  10. package/dist/env-api-keys.js +8 -3
  11. package/dist/env-api-keys.js.map +1 -1
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +0 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/models.generated.d.ts +175 -3
  17. package/dist/models.generated.d.ts.map +1 -1
  18. package/dist/models.generated.js +230 -58
  19. package/dist/models.generated.js.map +1 -1
  20. package/dist/oauth.d.ts +2 -0
  21. package/dist/oauth.d.ts.map +1 -0
  22. package/dist/oauth.js +2 -0
  23. package/dist/oauth.js.map +1 -0
  24. package/dist/providers/amazon-bedrock.d.ts.map +1 -1
  25. package/dist/providers/amazon-bedrock.js +15 -3
  26. package/dist/providers/amazon-bedrock.js.map +1 -1
  27. package/dist/providers/google-gemini-cli.d.ts.map +1 -1
  28. package/dist/providers/google-gemini-cli.js +12 -3
  29. package/dist/providers/google-gemini-cli.js.map +1 -1
  30. package/dist/providers/google-vertex.d.ts.map +1 -1
  31. package/dist/providers/google-vertex.js +2 -2
  32. package/dist/providers/google-vertex.js.map +1 -1
  33. package/dist/providers/google.d.ts.map +1 -1
  34. package/dist/providers/google.js +2 -2
  35. package/dist/providers/google.js.map +1 -1
  36. package/dist/providers/openai-codex-responses.d.ts.map +1 -1
  37. package/dist/providers/openai-codex-responses.js +4 -2
  38. package/dist/providers/openai-codex-responses.js.map +1 -1
  39. package/dist/providers/openai-completions.d.ts.map +1 -1
  40. package/dist/providers/openai-completions.js +16 -1
  41. package/dist/providers/openai-completions.js.map +1 -1
  42. package/dist/providers/register-builtins.d.ts +7 -0
  43. package/dist/providers/register-builtins.d.ts.map +1 -1
  44. package/dist/providers/register-builtins.js +72 -3
  45. package/dist/providers/register-builtins.js.map +1 -1
  46. package/dist/stream.d.ts +0 -1
  47. package/dist/stream.d.ts.map +1 -1
  48. package/dist/stream.js +0 -1
  49. package/dist/stream.js.map +1 -1
  50. package/dist/types.d.ts +3 -1
  51. package/dist/types.d.ts.map +1 -1
  52. package/dist/types.js.map +1 -1
  53. package/dist/utils/oauth/index.d.ts +0 -1
  54. package/dist/utils/oauth/index.d.ts.map +1 -1
  55. package/dist/utils/oauth/index.js +0 -2
  56. package/dist/utils/oauth/index.js.map +1 -1
  57. package/oauth.d.ts +1 -0
  58. package/oauth.js +1 -0
  59. package/package.json +23 -5
  60. package/dist/utils/http-proxy.d.ts +0 -2
  61. package/dist/utils/http-proxy.d.ts.map +0 -1
  62. package/dist/utils/http-proxy.js +0 -15
  63. package/dist/utils/http-proxy.js.map +0 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @mariozechner/pi-ai
1
+ # @draht/ai
2
2
 
3
3
  Unified LLM API with automatic model discovery, provider configuration, token and cost tracking, and simple context persistence and hand-off to other models mid-session.
4
4
 
@@ -63,21 +63,23 @@ Unified LLM API with automatic model discovery, provider configuration, token an
63
63
  - **Google Gemini CLI** (requires OAuth, see below)
64
64
  - **Antigravity** (requires OAuth, see below)
65
65
  - **Amazon Bedrock**
66
+ - **OpenCode Zen**
67
+ - **OpenCode Go**
66
68
  - **Kimi For Coding** (Moonshot AI, uses Anthropic-compatible API)
67
69
  - **Any OpenAI-compatible API**: Ollama, vLLM, LM Studio, etc.
68
70
 
69
71
  ## Installation
70
72
 
71
73
  ```bash
72
- npm install @mariozechner/pi-ai
74
+ bun add @draht/ai
73
75
  ```
74
76
 
75
- TypeBox exports are re-exported from `@mariozechner/pi-ai`: `Type`, `Static`, and `TSchema`.
77
+ TypeBox exports are re-exported from `@draht/ai`: `Type`, `Static`, and `TSchema`.
76
78
 
77
79
  ## Quick Start
78
80
 
79
81
  ```typescript
80
- import { Type, getModel, stream, complete, Context, Tool, StringEnum } from '@mariozechner/pi-ai';
82
+ import { Type, getModel, stream, complete, Context, Tool, StringEnum } from '@draht/ai';
81
83
 
82
84
  // Fully typed with auto-complete support for both providers and models
83
85
  const model = getModel('openai', 'gpt-4o-mini');
@@ -203,7 +205,7 @@ Tools enable LLMs to interact with external systems. This library uses TypeBox s
203
205
  ### Defining Tools
204
206
 
205
207
  ```typescript
206
- import { Type, Tool, StringEnum } from '@mariozechner/pi-ai';
208
+ import { Type, Tool, StringEnum } from '@draht/ai';
207
209
 
208
210
  // Define tool parameters with TypeBox
209
211
  const weatherTool: Tool = {
@@ -329,7 +331,7 @@ When using `agentLoop`, tool arguments are automatically validated against your
329
331
  When implementing your own tool execution loop with `stream()` or `complete()`, use `validateToolCall` to validate arguments before passing them to your tools:
330
332
 
331
333
  ```typescript
332
- import { stream, validateToolCall, Tool } from '@mariozechner/pi-ai';
334
+ import { stream, validateToolCall, Tool } from '@draht/ai';
333
335
 
334
336
  const tools: Tool[] = [weatherTool, calculatorTool];
335
337
  const s = stream(model, { messages, tools });
@@ -383,7 +385,7 @@ Models with vision capabilities can process images. You can check if a model sup
383
385
 
384
386
  ```typescript
385
387
  import { readFileSync } from 'fs';
386
- import { getModel, complete } from '@mariozechner/pi-ai';
388
+ import { getModel, complete } from '@draht/ai';
387
389
 
388
390
  const model = getModel('openai', 'gpt-4o-mini');
389
391
 
@@ -420,7 +422,7 @@ Many models support thinking/reasoning capabilities where they can show their in
420
422
  ### Unified Interface (streamSimple/completeSimple)
421
423
 
422
424
  ```typescript
423
- import { getModel, streamSimple, completeSimple } from '@mariozechner/pi-ai';
425
+ import { getModel, streamSimple, completeSimple } from '@draht/ai';
424
426
 
425
427
  // Many models across providers support thinking/reasoning
426
428
  const model = getModel('anthropic', 'claude-sonnet-4-20250514');
@@ -458,7 +460,7 @@ for (const block of response.content) {
458
460
  For fine-grained control, use the provider-specific options:
459
461
 
460
462
  ```typescript
461
- import { getModel, complete } from '@mariozechner/pi-ai';
463
+ import { getModel, complete } from '@draht/ai';
462
464
 
463
465
  // OpenAI Reasoning (o1, o3, gpt-5)
464
466
  const openaiModel = getModel('openai', 'gpt-5-mini');
@@ -545,7 +547,7 @@ if (message.stopReason === 'error' || message.stopReason === 'aborted') {
545
547
  The abort signal allows you to cancel in-progress requests. Aborted requests have `stopReason === 'aborted'`:
546
548
 
547
549
  ```typescript
548
- import { getModel, stream } from '@mariozechner/pi-ai';
550
+ import { getModel, stream } from '@draht/ai';
549
551
 
550
552
  const model = getModel('openai', 'gpt-4o-mini');
551
553
  const controller = new AbortController();
@@ -641,7 +643,7 @@ A **provider** offers models through a specific API. For example:
641
643
  ### Querying Providers and Models
642
644
 
643
645
  ```typescript
644
- import { getProviders, getModels, getModel } from '@mariozechner/pi-ai';
646
+ import { getProviders, getModels, getModel } from '@draht/ai';
645
647
 
646
648
  // Get all available providers
647
649
  const providers = getProviders();
@@ -667,7 +669,7 @@ console.log(`Using ${model.name} via ${model.api} API`);
667
669
  You can create custom models for local inference servers or custom endpoints:
668
670
 
669
671
  ```typescript
670
- import { Model, stream } from '@mariozechner/pi-ai';
672
+ import { Model, stream } from '@draht/ai';
671
673
 
672
674
  // Example: Ollama using OpenAI-compatible API
673
675
  const ollamaModel: Model<'openai-completions'> = {
@@ -761,7 +763,7 @@ If `compat` is not set, the library falls back to URL-based detection. If `compa
761
763
  Models are typed by their API, which keeps the model metadata accurate. Provider-specific option types are enforced when you call the provider functions directly. The generic `stream` and `complete` functions accept `StreamOptions` with additional provider fields.
762
764
 
763
765
  ```typescript
764
- import { streamAnthropic, type AnthropicOptions } from '@mariozechner/pi-ai';
766
+ import { streamAnthropic, type AnthropicOptions } from '@draht/ai';
765
767
 
766
768
  // TypeScript knows this is an Anthropic model
767
769
  const claude = getModel('anthropic', 'claude-sonnet-4-20250514');
@@ -790,7 +792,7 @@ When messages from one provider are sent to a different provider, the library au
790
792
  ### Example: Multi-Provider Conversation
791
793
 
792
794
  ```typescript
793
- import { getModel, complete, Context } from '@mariozechner/pi-ai';
795
+ import { getModel, complete, Context } from '@draht/ai';
794
796
 
795
797
  // Start with Claude
796
798
  const claude = getModel('anthropic', 'claude-sonnet-4-20250514');
@@ -835,7 +837,7 @@ This enables flexible workflows where you can:
835
837
  The `Context` object can be easily serialized and deserialized using standard JSON methods, making it simple to persist conversations, implement chat history, or transfer contexts between services:
836
838
 
837
839
  ```typescript
838
- import { Context, getModel, complete } from '@mariozechner/pi-ai';
840
+ import { Context, getModel, complete } from '@draht/ai';
839
841
 
840
842
  // Create and use a context
841
843
  const context: Context = {
@@ -872,7 +874,7 @@ const continuation = await complete(newModel, restored);
872
874
  The library supports browser environments. You must pass the API key explicitly since environment variables are not available in browsers:
873
875
 
874
876
  ```typescript
875
- import { getModel, complete } from '@mariozechner/pi-ai';
877
+ import { getModel, complete } from '@draht/ai';
876
878
 
877
879
  // API key must be passed explicitly in browser
878
880
  const model = getModel('anthropic', 'claude-3-5-haiku-20241022');
@@ -905,6 +907,7 @@ In Node.js environments, you can set environment variables to avoid passing API
905
907
  | Vercel AI Gateway | `AI_GATEWAY_API_KEY` |
906
908
  | zAI | `ZAI_API_KEY` |
907
909
  | MiniMax | `MINIMAX_API_KEY` |
910
+ | OpenCode Zen / OpenCode Go | `OPENCODE_API_KEY` |
908
911
  | Kimi For Coding | `KIMI_API_KEY` |
909
912
  | GitHub Copilot | `COPILOT_GITHUB_TOKEN` or `GH_TOKEN` or `GITHUB_TOKEN` |
910
913
 
@@ -923,17 +926,17 @@ const response = await complete(model, context, {
923
926
 
924
927
  #### Antigravity Version Override
925
928
 
926
- Set `PI_AI_ANTIGRAVITY_VERSION` to override the Antigravity User-Agent version when Google updates their requirements:
929
+ Set `DRAHT_AI_ANTIGRAVITY_VERSION` to override the Antigravity User-Agent version when Google updates their requirements:
927
930
 
928
931
  ```bash
929
- export PI_AI_ANTIGRAVITY_VERSION="1.23.0"
932
+ export DRAHT_AI_ANTIGRAVITY_VERSION="1.23.0"
930
933
  ```
931
934
 
932
935
  #### Cache Retention
933
936
 
934
- Set `PI_CACHE_RETENTION=long` to extend prompt cache retention:
937
+ Set `DRAHT_CACHE_RETENTION=long` to extend prompt cache retention:
935
938
 
936
- | Provider | Default | With `PI_CACHE_RETENTION=long` |
939
+ | Provider | Default | With `DRAHT_CACHE_RETENTION=long` |
937
940
  |----------|---------|-------------------------------|
938
941
  | Anthropic | 5 minutes | 1 hour |
939
942
  | OpenAI | in-memory | 24 hours |
@@ -945,7 +948,7 @@ This only affects direct API calls to `api.anthropic.com` and `api.openai.com`.
945
948
  ### Checking Environment Variables
946
949
 
947
950
  ```typescript
948
- import { getEnvApiKey } from '@mariozechner/pi-ai';
951
+ import { getEnvApiKey } from '@draht/ai';
949
952
 
950
953
  // Check if an API key is set in environment variables
951
954
  const key = getEnvApiKey('openai'); // checks OPENAI_API_KEY
@@ -985,7 +988,7 @@ export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
985
988
  ```
986
989
 
987
990
  ```typescript
988
- import { getModel, complete } from '@mariozechner/pi-ai';
991
+ import { getModel, complete } from '@draht/ai';
989
992
 
990
993
  (async () => {
991
994
  const model = getModel('google-vertex', 'gemini-2.5-flash');
@@ -1006,9 +1009,9 @@ Official docs: [Application Default Credentials](https://cloud.google.com/docs/a
1006
1009
  The quickest way to authenticate:
1007
1010
 
1008
1011
  ```bash
1009
- npx @mariozechner/pi-ai login # interactive provider selection
1010
- npx @mariozechner/pi-ai login anthropic # login to specific provider
1011
- npx @mariozechner/pi-ai list # list available providers
1012
+ bunx @draht/ai login # interactive provider selection
1013
+ bunx @draht/ai login anthropic # login to specific provider
1014
+ bunx @draht/ai list # list available providers
1012
1015
  ```
1013
1016
 
1014
1017
  Credentials are saved to `auth.json` in the current directory.
@@ -1033,13 +1036,13 @@ import {
1033
1036
  // Types
1034
1037
  type OAuthProvider, // 'anthropic' | 'openai-codex' | 'github-copilot' | 'google-gemini-cli' | 'google-antigravity'
1035
1038
  type OAuthCredentials,
1036
- } from '@mariozechner/pi-ai';
1039
+ } from '@draht/ai';
1037
1040
  ```
1038
1041
 
1039
1042
  ### Login Flow Example
1040
1043
 
1041
1044
  ```typescript
1042
- import { loginGitHubCopilot } from '@mariozechner/pi-ai';
1045
+ import { loginGitHubCopilot } from '@draht/ai';
1043
1046
  import { writeFileSync } from 'fs';
1044
1047
 
1045
1048
  const credentials = await loginGitHubCopilot({
@@ -1063,7 +1066,7 @@ writeFileSync('auth.json', JSON.stringify(auth, null, 2));
1063
1066
  Use `getOAuthApiKey()` to get an API key, automatically refreshing if expired:
1064
1067
 
1065
1068
  ```typescript
1066
- import { getModel, complete, getOAuthApiKey } from '@mariozechner/pi-ai';
1069
+ import { getModel, complete, getOAuthApiKey } from '@draht/ai';
1067
1070
  import { readFileSync, writeFileSync } from 'fs';
1068
1071
 
1069
1072
  // Load your stored credentials
@@ -0,0 +1 @@
1
+ export * from "./dist/bedrock-provider.js";
@@ -0,0 +1 @@
1
+ export * from "./dist/bedrock-provider.js";
@@ -0,0 +1,5 @@
1
+ export declare const bedrockProviderModule: {
2
+ streamBedrock: import("./types.js").StreamFunction<"bedrock-converse-stream", import("./providers/amazon-bedrock.js").BedrockOptions>;
3
+ streamSimpleBedrock: import("./types.js").StreamFunction<"bedrock-converse-stream", import("./types.js").SimpleStreamOptions>;
4
+ };
5
+ //# sourceMappingURL=bedrock-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bedrock-provider.d.ts","sourceRoot":"","sources":["../src/bedrock-provider.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB;;;CAGjC,CAAC","sourcesContent":["import { streamBedrock, streamSimpleBedrock } from \"./providers/amazon-bedrock.js\";\n\nexport const bedrockProviderModule = {\n\tstreamBedrock,\n\tstreamSimpleBedrock,\n};\n"]}
@@ -0,0 +1,6 @@
1
+ import { streamBedrock, streamSimpleBedrock } from "./providers/amazon-bedrock.js";
2
+ export const bedrockProviderModule = {
3
+ streamBedrock,
4
+ streamSimpleBedrock,
5
+ };
6
+ //# sourceMappingURL=bedrock-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bedrock-provider.js","sourceRoot":"","sources":["../src/bedrock-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEnF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACpC,aAAa;IACb,mBAAmB;CACnB,CAAC","sourcesContent":["import { streamBedrock, streamSimpleBedrock } from \"./providers/amazon-bedrock.js\";\n\nexport const bedrockProviderModule = {\n\tstreamBedrock,\n\tstreamSimpleBedrock,\n};\n"]}
package/dist/cli.js CHANGED
File without changes
@@ -1 +1 @@
1
- {"version":3,"file":"env-api-keys.d.ts","sourceRoot":"","sources":["../src/env-api-keys.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAgChD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;AAC1E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC","sourcesContent":["// NEVER convert to top-level imports - breaks browser/Vite builds (web-ui)\nlet _existsSync: typeof import(\"node:fs\").existsSync | null = null;\nlet _homedir: typeof import(\"node:os\").homedir | null = null;\nlet _join: typeof import(\"node:path\").join | null = null;\n\n// Eagerly load in Node.js/Bun environment only\nif (typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun)) {\n\timport(\"node:fs\").then((m) => {\n\t\t_existsSync = m.existsSync;\n\t});\n\timport(\"node:os\").then((m) => {\n\t\t_homedir = m.homedir;\n\t});\n\timport(\"node:path\").then((m) => {\n\t\t_join = m.join;\n\t});\n}\n\nimport type { KnownProvider } from \"./types.js\";\n\nlet cachedVertexAdcCredentialsExists: boolean | null = null;\n\nfunction hasVertexAdcCredentials(): boolean {\n\tif (cachedVertexAdcCredentialsExists === null) {\n\t\t// If node modules haven't loaded yet (async import race at startup),\n\t\t// return false WITHOUT caching so the next call retries once they're ready.\n\t\t// Only cache false permanently in a browser environment where fs is never available.\n\t\tif (!_existsSync || !_homedir || !_join) {\n\t\t\tconst isNode = typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun);\n\t\t\tif (!isNode) {\n\t\t\t\t// Definitively in a browser — safe to cache false permanently\n\t\t\t\tcachedVertexAdcCredentialsExists = false;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check GOOGLE_APPLICATION_CREDENTIALS env var first (standard way)\n\t\tconst gacPath = process.env.GOOGLE_APPLICATION_CREDENTIALS;\n\t\tif (gacPath) {\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(gacPath);\n\t\t} else {\n\t\t\t// Fall back to default ADC path (lazy evaluation)\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(\n\t\t\t\t_join(_homedir(), \".config\", \"gcloud\", \"application_default_credentials.json\"),\n\t\t\t);\n\t\t}\n\t}\n\treturn cachedVertexAdcCredentialsExists;\n}\n\n/**\n * Get API key for provider from known environment variables, e.g. OPENAI_API_KEY.\n *\n * Will not return API keys for providers that require OAuth tokens.\n */\nexport function getEnvApiKey(provider: KnownProvider): string | undefined;\nexport function getEnvApiKey(provider: string): string | undefined;\nexport function getEnvApiKey(provider: any): string | undefined {\n\t// Fall back to environment variables\n\tif (provider === \"github-copilot\") {\n\t\treturn process.env.COPILOT_GITHUB_TOKEN || process.env.GH_TOKEN || process.env.GITHUB_TOKEN;\n\t}\n\n\t// ANTHROPIC_OAUTH_TOKEN takes precedence over ANTHROPIC_API_KEY\n\tif (provider === \"anthropic\") {\n\t\treturn process.env.ANTHROPIC_OAUTH_TOKEN || process.env.ANTHROPIC_API_KEY;\n\t}\n\n\t// Vertex AI uses Application Default Credentials, not API keys.\n\t// Auth is configured via `gcloud auth application-default login`.\n\tif (provider === \"google-vertex\") {\n\t\tconst hasCredentials = hasVertexAdcCredentials();\n\t\tconst hasProject = !!(process.env.GOOGLE_CLOUD_PROJECT || process.env.GCLOUD_PROJECT);\n\t\tconst hasLocation = !!process.env.GOOGLE_CLOUD_LOCATION;\n\n\t\tif (hasCredentials && hasProject && hasLocation) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\tif (provider === \"amazon-bedrock\") {\n\t\t// Amazon Bedrock supports multiple credential sources:\n\t\t// 1. AWS_PROFILE - named profile from ~/.aws/credentials\n\t\t// 2. AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY - standard IAM keys\n\t\t// 3. AWS_BEARER_TOKEN_BEDROCK - Bedrock API keys (bearer token)\n\t\t// 4. AWS_CONTAINER_CREDENTIALS_RELATIVE_URI - ECS task roles\n\t\t// 5. AWS_CONTAINER_CREDENTIALS_FULL_URI - ECS task roles (full URI)\n\t\t// 6. AWS_WEB_IDENTITY_TOKEN_FILE - IRSA (IAM Roles for Service Accounts)\n\t\tif (\n\t\t\tprocess.env.AWS_PROFILE ||\n\t\t\t(process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY) ||\n\t\t\tprocess.env.AWS_BEARER_TOKEN_BEDROCK ||\n\t\t\tprocess.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI ||\n\t\t\tprocess.env.AWS_CONTAINER_CREDENTIALS_FULL_URI ||\n\t\t\tprocess.env.AWS_WEB_IDENTITY_TOKEN_FILE\n\t\t) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\tconst envMap: Record<string, string> = {\n\t\topenai: \"OPENAI_API_KEY\",\n\t\t\"azure-openai-responses\": \"AZURE_OPENAI_API_KEY\",\n\t\tgoogle: \"GEMINI_API_KEY\",\n\t\tgroq: \"GROQ_API_KEY\",\n\t\tcerebras: \"CEREBRAS_API_KEY\",\n\t\txai: \"XAI_API_KEY\",\n\t\topenrouter: \"OPENROUTER_API_KEY\",\n\t\t\"vercel-ai-gateway\": \"AI_GATEWAY_API_KEY\",\n\t\tzai: \"ZAI_API_KEY\",\n\t\tmistral: \"MISTRAL_API_KEY\",\n\t\tminimax: \"MINIMAX_API_KEY\",\n\t\t\"minimax-cn\": \"MINIMAX_CN_API_KEY\",\n\t\thuggingface: \"HF_TOKEN\",\n\t\topencode: \"OPENCODE_API_KEY\",\n\t\t\"kimi-coding\": \"KIMI_API_KEY\",\n\t};\n\n\tconst envVar = envMap[provider];\n\treturn envVar ? process.env[envVar] : undefined;\n}\n"]}
1
+ {"version":3,"file":"env-api-keys.d.ts","sourceRoot":"","sources":["../src/env-api-keys.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAgChD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;AAC1E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC","sourcesContent":["// NEVER convert to top-level imports - breaks browser/Vite builds (web-ui)\nlet _existsSync: typeof import(\"node:fs\").existsSync | null = null;\nlet _homedir: typeof import(\"node:os\").homedir | null = null;\nlet _join: typeof import(\"node:path\").join | null = null;\n\ntype DynamicImport = (specifier: string) => Promise<unknown>;\n\nconst dynamicImport: DynamicImport = (specifier) => import(specifier);\nconst NODE_FS_SPECIFIER = \"node:\" + \"fs\";\nconst NODE_OS_SPECIFIER = \"node:\" + \"os\";\nconst NODE_PATH_SPECIFIER = \"node:\" + \"path\";\n\n// Eagerly load in Node.js/Bun environment only\nif (typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun)) {\n\tdynamicImport(NODE_FS_SPECIFIER).then((m) => {\n\t\t_existsSync = (m as typeof import(\"node:fs\")).existsSync;\n\t});\n\tdynamicImport(NODE_OS_SPECIFIER).then((m) => {\n\t\t_homedir = (m as typeof import(\"node:os\")).homedir;\n\t});\n\tdynamicImport(NODE_PATH_SPECIFIER).then((m) => {\n\t\t_join = (m as typeof import(\"node:path\")).join;\n\t});\n}\n\nimport type { KnownProvider } from \"./types.js\";\n\nlet cachedVertexAdcCredentialsExists: boolean | null = null;\n\nfunction hasVertexAdcCredentials(): boolean {\n\tif (cachedVertexAdcCredentialsExists === null) {\n\t\t// If node modules haven't loaded yet (async import race at startup),\n\t\t// return false WITHOUT caching so the next call retries once they're ready.\n\t\t// Only cache false permanently in a browser environment where fs is never available.\n\t\tif (!_existsSync || !_homedir || !_join) {\n\t\t\tconst isNode = typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun);\n\t\t\tif (!isNode) {\n\t\t\t\t// Definitively in a browser — safe to cache false permanently\n\t\t\t\tcachedVertexAdcCredentialsExists = false;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check GOOGLE_APPLICATION_CREDENTIALS env var first (standard way)\n\t\tconst gacPath = process.env.GOOGLE_APPLICATION_CREDENTIALS;\n\t\tif (gacPath) {\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(gacPath);\n\t\t} else {\n\t\t\t// Fall back to default ADC path (lazy evaluation)\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(\n\t\t\t\t_join(_homedir(), \".config\", \"gcloud\", \"application_default_credentials.json\"),\n\t\t\t);\n\t\t}\n\t}\n\treturn cachedVertexAdcCredentialsExists;\n}\n\n/**\n * Get API key for provider from known environment variables, e.g. OPENAI_API_KEY.\n *\n * Will not return API keys for providers that require OAuth tokens.\n */\nexport function getEnvApiKey(provider: KnownProvider): string | undefined;\nexport function getEnvApiKey(provider: string): string | undefined;\nexport function getEnvApiKey(provider: any): string | undefined {\n\t// Fall back to environment variables\n\tif (provider === \"github-copilot\") {\n\t\treturn process.env.COPILOT_GITHUB_TOKEN || process.env.GH_TOKEN || process.env.GITHUB_TOKEN;\n\t}\n\n\t// ANTHROPIC_OAUTH_TOKEN takes precedence over ANTHROPIC_API_KEY\n\tif (provider === \"anthropic\") {\n\t\treturn process.env.ANTHROPIC_OAUTH_TOKEN || process.env.ANTHROPIC_API_KEY;\n\t}\n\n\t// Vertex AI uses Application Default Credentials, not API keys.\n\t// Auth is configured via `gcloud auth application-default login`.\n\tif (provider === \"google-vertex\") {\n\t\tconst hasCredentials = hasVertexAdcCredentials();\n\t\tconst hasProject = !!(process.env.GOOGLE_CLOUD_PROJECT || process.env.GCLOUD_PROJECT);\n\t\tconst hasLocation = !!process.env.GOOGLE_CLOUD_LOCATION;\n\n\t\tif (hasCredentials && hasProject && hasLocation) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\tif (provider === \"amazon-bedrock\") {\n\t\t// Amazon Bedrock supports multiple credential sources:\n\t\t// 1. AWS_PROFILE - named profile from ~/.aws/credentials\n\t\t// 2. AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY - standard IAM keys\n\t\t// 3. AWS_BEARER_TOKEN_BEDROCK - Bedrock API keys (bearer token)\n\t\t// 4. AWS_CONTAINER_CREDENTIALS_RELATIVE_URI - ECS task roles\n\t\t// 5. AWS_CONTAINER_CREDENTIALS_FULL_URI - ECS task roles (full URI)\n\t\t// 6. AWS_WEB_IDENTITY_TOKEN_FILE - IRSA (IAM Roles for Service Accounts)\n\t\tif (\n\t\t\tprocess.env.AWS_PROFILE ||\n\t\t\t(process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY) ||\n\t\t\tprocess.env.AWS_BEARER_TOKEN_BEDROCK ||\n\t\t\tprocess.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI ||\n\t\t\tprocess.env.AWS_CONTAINER_CREDENTIALS_FULL_URI ||\n\t\t\tprocess.env.AWS_WEB_IDENTITY_TOKEN_FILE\n\t\t) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\tconst envMap: Record<string, string> = {\n\t\topenai: \"OPENAI_API_KEY\",\n\t\t\"azure-openai-responses\": \"AZURE_OPENAI_API_KEY\",\n\t\tgoogle: \"GEMINI_API_KEY\",\n\t\tgroq: \"GROQ_API_KEY\",\n\t\tcerebras: \"CEREBRAS_API_KEY\",\n\t\txai: \"XAI_API_KEY\",\n\t\topenrouter: \"OPENROUTER_API_KEY\",\n\t\t\"vercel-ai-gateway\": \"AI_GATEWAY_API_KEY\",\n\t\tzai: \"ZAI_API_KEY\",\n\t\tmistral: \"MISTRAL_API_KEY\",\n\t\tminimax: \"MINIMAX_API_KEY\",\n\t\t\"minimax-cn\": \"MINIMAX_CN_API_KEY\",\n\t\thuggingface: \"HF_TOKEN\",\n\t\topencode: \"OPENCODE_API_KEY\",\n\t\t\"opencode-go\": \"OPENCODE_API_KEY\",\n\t\t\"kimi-coding\": \"KIMI_API_KEY\",\n\t};\n\n\tconst envVar = envMap[provider];\n\treturn envVar ? process.env[envVar] : undefined;\n}\n"]}
@@ -2,15 +2,19 @@
2
2
  let _existsSync = null;
3
3
  let _homedir = null;
4
4
  let _join = null;
5
+ const dynamicImport = (specifier) => import(specifier);
6
+ const NODE_FS_SPECIFIER = "node:" + "fs";
7
+ const NODE_OS_SPECIFIER = "node:" + "os";
8
+ const NODE_PATH_SPECIFIER = "node:" + "path";
5
9
  // Eagerly load in Node.js/Bun environment only
6
10
  if (typeof process !== "undefined" && (process.versions?.node || process.versions?.bun)) {
7
- import("node:fs").then((m) => {
11
+ dynamicImport(NODE_FS_SPECIFIER).then((m) => {
8
12
  _existsSync = m.existsSync;
9
13
  });
10
- import("node:os").then((m) => {
14
+ dynamicImport(NODE_OS_SPECIFIER).then((m) => {
11
15
  _homedir = m.homedir;
12
16
  });
13
- import("node:path").then((m) => {
17
+ dynamicImport(NODE_PATH_SPECIFIER).then((m) => {
14
18
  _join = m.join;
15
19
  });
16
20
  }
@@ -91,6 +95,7 @@ export function getEnvApiKey(provider) {
91
95
  "minimax-cn": "MINIMAX_CN_API_KEY",
92
96
  huggingface: "HF_TOKEN",
93
97
  opencode: "OPENCODE_API_KEY",
98
+ "opencode-go": "OPENCODE_API_KEY",
94
99
  "kimi-coding": "KIMI_API_KEY",
95
100
  };
96
101
  const envVar = envMap[provider];
@@ -1 +1 @@
1
- {"version":3,"file":"env-api-keys.js","sourceRoot":"","sources":["../src/env-api-keys.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,IAAI,WAAW,GAA+C,IAAI,CAAC;AACnE,IAAI,QAAQ,GAA4C,IAAI,CAAC;AAC7D,IAAI,KAAK,GAA2C,IAAI,CAAC;AAEzD,+CAA+C;AAC/C,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;IACzF,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QAC7B,WAAW,GAAG,CAAC,CAAC,UAAU,CAAC;IAAA,CAC3B,CAAC,CAAC;IACH,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QAC7B,QAAQ,GAAG,CAAC,CAAC,OAAO,CAAC;IAAA,CACrB,CAAC,CAAC;IACH,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QAC/B,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC;IAAA,CACf,CAAC,CAAC;AACJ,CAAC;AAID,IAAI,gCAAgC,GAAmB,IAAI,CAAC;AAE5D,SAAS,uBAAuB,GAAY;IAC3C,IAAI,gCAAgC,KAAK,IAAI,EAAE,CAAC;QAC/C,qEAAqE;QACrE,4EAA4E;QAC5E,qFAAqF;QACrF,IAAI,CAAC,WAAW,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,EAAE,CAAC;Y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AC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAAA,CAChD","sourcesContent":["// NEVER convert to top-level imports - breaks browser/Vite builds (web-ui)\nlet _existsSync: typeof import(\"node:fs\").existsSync | null = null;\nlet _homedir: typeof import(\"node:os\").homedir | null = null;\nlet _join: typeof import(\"node:path\").join | null = null;\n\n// Eagerly load in Node.js/Bun environment only\nif (typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun)) {\n\timport(\"node:fs\").then((m) => {\n\t\t_existsSync = m.existsSync;\n\t});\n\timport(\"node:os\").then((m) => {\n\t\t_homedir = m.homedir;\n\t});\n\timport(\"node:path\").then((m) => {\n\t\t_join = m.join;\n\t});\n}\n\nimport type { KnownProvider } from \"./types.js\";\n\nlet cachedVertexAdcCredentialsExists: boolean | null = null;\n\nfunction hasVertexAdcCredentials(): boolean {\n\tif (cachedVertexAdcCredentialsExists === null) {\n\t\t// If node modules haven't loaded yet (async import race at startup),\n\t\t// return false WITHOUT caching so the next call retries once they're ready.\n\t\t// Only cache false permanently in a browser environment where fs is never available.\n\t\tif (!_existsSync || !_homedir || !_join) {\n\t\t\tconst isNode = typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun);\n\t\t\tif (!isNode) {\n\t\t\t\t// Definitively in a browser — safe to cache false permanently\n\t\t\t\tcachedVertexAdcCredentialsExists = false;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check GOOGLE_APPLICATION_CREDENTIALS env var first (standard way)\n\t\tconst gacPath = process.env.GOOGLE_APPLICATION_CREDENTIALS;\n\t\tif (gacPath) {\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(gacPath);\n\t\t} else {\n\t\t\t// Fall back to default ADC path (lazy evaluation)\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(\n\t\t\t\t_join(_homedir(), \".config\", \"gcloud\", \"application_default_credentials.json\"),\n\t\t\t);\n\t\t}\n\t}\n\treturn cachedVertexAdcCredentialsExists;\n}\n\n/**\n * Get API key for provider from known environment variables, e.g. OPENAI_API_KEY.\n *\n * Will not return API keys for providers that require OAuth tokens.\n */\nexport function getEnvApiKey(provider: KnownProvider): string | undefined;\nexport function getEnvApiKey(provider: string): string | undefined;\nexport function getEnvApiKey(provider: any): string | undefined {\n\t// Fall back to environment variables\n\tif (provider === \"github-copilot\") {\n\t\treturn process.env.COPILOT_GITHUB_TOKEN || process.env.GH_TOKEN || process.env.GITHUB_TOKEN;\n\t}\n\n\t// ANTHROPIC_OAUTH_TOKEN takes precedence over ANTHROPIC_API_KEY\n\tif (provider === \"anthropic\") {\n\t\treturn process.env.ANTHROPIC_OAUTH_TOKEN || process.env.ANTHROPIC_API_KEY;\n\t}\n\n\t// Vertex AI uses Application Default Credentials, not API keys.\n\t// Auth is configured via `gcloud auth application-default login`.\n\tif (provider === \"google-vertex\") {\n\t\tconst hasCredentials = hasVertexAdcCredentials();\n\t\tconst hasProject = !!(process.env.GOOGLE_CLOUD_PROJECT || process.env.GCLOUD_PROJECT);\n\t\tconst hasLocation = !!process.env.GOOGLE_CLOUD_LOCATION;\n\n\t\tif (hasCredentials && hasProject && hasLocation) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\tif (provider === \"amazon-bedrock\") {\n\t\t// Amazon Bedrock supports multiple credential sources:\n\t\t// 1. AWS_PROFILE - named profile from ~/.aws/credentials\n\t\t// 2. AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY - standard IAM keys\n\t\t// 3. AWS_BEARER_TOKEN_BEDROCK - Bedrock API keys (bearer token)\n\t\t// 4. AWS_CONTAINER_CREDENTIALS_RELATIVE_URI - ECS task roles\n\t\t// 5. AWS_CONTAINER_CREDENTIALS_FULL_URI - ECS task roles (full URI)\n\t\t// 6. AWS_WEB_IDENTITY_TOKEN_FILE - IRSA (IAM Roles for Service Accounts)\n\t\tif (\n\t\t\tprocess.env.AWS_PROFILE ||\n\t\t\t(process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY) ||\n\t\t\tprocess.env.AWS_BEARER_TOKEN_BEDROCK ||\n\t\t\tprocess.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI ||\n\t\t\tprocess.env.AWS_CONTAINER_CREDENTIALS_FULL_URI ||\n\t\t\tprocess.env.AWS_WEB_IDENTITY_TOKEN_FILE\n\t\t) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\tconst envMap: Record<string, string> = {\n\t\topenai: \"OPENAI_API_KEY\",\n\t\t\"azure-openai-responses\": \"AZURE_OPENAI_API_KEY\",\n\t\tgoogle: \"GEMINI_API_KEY\",\n\t\tgroq: \"GROQ_API_KEY\",\n\t\tcerebras: \"CEREBRAS_API_KEY\",\n\t\txai: \"XAI_API_KEY\",\n\t\topenrouter: \"OPENROUTER_API_KEY\",\n\t\t\"vercel-ai-gateway\": \"AI_GATEWAY_API_KEY\",\n\t\tzai: \"ZAI_API_KEY\",\n\t\tmistral: \"MISTRAL_API_KEY\",\n\t\tminimax: \"MINIMAX_API_KEY\",\n\t\t\"minimax-cn\": \"MINIMAX_CN_API_KEY\",\n\t\thuggingface: \"HF_TOKEN\",\n\t\topencode: \"OPENCODE_API_KEY\",\n\t\t\"kimi-coding\": \"KIMI_API_KEY\",\n\t};\n\n\tconst envVar = envMap[provider];\n\treturn envVar ? process.env[envVar] : undefined;\n}\n"]}
1
+ {"version":3,"file":"env-api-keys.js","sourceRoot":"","sources":["../src/env-api-keys.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,IAAI,WAAW,GAA+C,IAAI,CAAC;AACnE,IAAI,QAAQ,GAA4C,IAAI,CAAC;AAC7D,IAAI,KAAK,GAA2C,IAAI,CAAC;AAIzD,MAAM,aAAa,GAAkB,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACtE,MAAM,iBAAiB,GAAG,OAAO,GAAG,IAAI,CAAC;AACzC,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yDAAyD;QACzD,mEAAmE;QACnE,gEAAgE;QAChE,6DAA6D;QAC7D,oEAAoE;QACpE,yEAAyE;QACzE,IACC,OAAO,CAAC,GAAG,CAAC,WAAW;YACvB,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;YACpE,OAAO,CAAC,GAAG,CAAC,wBAAwB;YACpC,OAAO,CAAC,GAAG,CAAC,sCAAsC;YAClD,OAAO,CAAC,GAAG,CAAC,kCAAkC;YAC9C,OAAO,CAAC,GAAG,CAAC,2BAA2B,EACtC,CAAC;YACF,OAAO,iBAAiB,CAAC;QAC1B,CAAC;IACF,CAAC;IAED,MAAM,MAAM,GAA2B;QACtC,MAAM,EAAE,gBAAgB;QACxB,wBAAwB,EAAE,sBAAsB;QAChD,MAAM,EAAE,gBAAgB;QACxB,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE,kBAAkB;QAC5B,GAAG,EAAE,aAAa;QAClB,UAAU,EAAE,oBAAoB;QAChC,mBAAmB,EAAE,oBAAoB;QACzC,GAAG,EAAE,aAAa;QAClB,OAAO,EAAE,iBAAiB;QAC1B,OAAO,EAAE,iBAAiB;QAC1B,YAAY,EAAE,oBAAoB;QAClC,WAAW,EAAE,UAAU;QACvB,QAAQ,EAAE,kBAAkB;QAC5B,aAAa,EAAE,kBAAkB;QACjC,aAAa,EAAE,cAAc;KAC7B,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAAA,CAChD","sourcesContent":["// NEVER convert to top-level imports - breaks browser/Vite builds (web-ui)\nlet _existsSync: typeof import(\"node:fs\").existsSync | null = null;\nlet _homedir: typeof import(\"node:os\").homedir | null = null;\nlet _join: typeof import(\"node:path\").join | null = null;\n\ntype DynamicImport = (specifier: string) => Promise<unknown>;\n\nconst dynamicImport: DynamicImport = (specifier) => import(specifier);\nconst NODE_FS_SPECIFIER = \"node:\" + \"fs\";\nconst NODE_OS_SPECIFIER = \"node:\" + \"os\";\nconst NODE_PATH_SPECIFIER = \"node:\" + \"path\";\n\n// Eagerly load in Node.js/Bun environment only\nif (typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun)) {\n\tdynamicImport(NODE_FS_SPECIFIER).then((m) => {\n\t\t_existsSync = (m as typeof import(\"node:fs\")).existsSync;\n\t});\n\tdynamicImport(NODE_OS_SPECIFIER).then((m) => {\n\t\t_homedir = (m as typeof import(\"node:os\")).homedir;\n\t});\n\tdynamicImport(NODE_PATH_SPECIFIER).then((m) => {\n\t\t_join = (m as typeof import(\"node:path\")).join;\n\t});\n}\n\nimport type { KnownProvider } from \"./types.js\";\n\nlet cachedVertexAdcCredentialsExists: boolean | null = null;\n\nfunction hasVertexAdcCredentials(): boolean {\n\tif (cachedVertexAdcCredentialsExists === null) {\n\t\t// If node modules haven't loaded yet (async import race at startup),\n\t\t// return false WITHOUT caching so the next call retries once they're ready.\n\t\t// Only cache false permanently in a browser environment where fs is never available.\n\t\tif (!_existsSync || !_homedir || !_join) {\n\t\t\tconst isNode = typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun);\n\t\t\tif (!isNode) {\n\t\t\t\t// Definitively in a browser — safe to cache false permanently\n\t\t\t\tcachedVertexAdcCredentialsExists = false;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check GOOGLE_APPLICATION_CREDENTIALS env var first (standard way)\n\t\tconst gacPath = process.env.GOOGLE_APPLICATION_CREDENTIALS;\n\t\tif (gacPath) {\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(gacPath);\n\t\t} else {\n\t\t\t// Fall back to default ADC path (lazy evaluation)\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(\n\t\t\t\t_join(_homedir(), \".config\", \"gcloud\", \"application_default_credentials.json\"),\n\t\t\t);\n\t\t}\n\t}\n\treturn cachedVertexAdcCredentialsExists;\n}\n\n/**\n * Get API key for provider from known environment variables, e.g. OPENAI_API_KEY.\n *\n * Will not return API keys for providers that require OAuth tokens.\n */\nexport function getEnvApiKey(provider: KnownProvider): string | undefined;\nexport function getEnvApiKey(provider: string): string | undefined;\nexport function getEnvApiKey(provider: any): string | undefined {\n\t// Fall back to environment variables\n\tif (provider === \"github-copilot\") {\n\t\treturn process.env.COPILOT_GITHUB_TOKEN || process.env.GH_TOKEN || process.env.GITHUB_TOKEN;\n\t}\n\n\t// ANTHROPIC_OAUTH_TOKEN takes precedence over ANTHROPIC_API_KEY\n\tif (provider === \"anthropic\") {\n\t\treturn process.env.ANTHROPIC_OAUTH_TOKEN || process.env.ANTHROPIC_API_KEY;\n\t}\n\n\t// Vertex AI uses Application Default Credentials, not API keys.\n\t// Auth is configured via `gcloud auth application-default login`.\n\tif (provider === \"google-vertex\") {\n\t\tconst hasCredentials = hasVertexAdcCredentials();\n\t\tconst hasProject = !!(process.env.GOOGLE_CLOUD_PROJECT || process.env.GCLOUD_PROJECT);\n\t\tconst hasLocation = !!process.env.GOOGLE_CLOUD_LOCATION;\n\n\t\tif (hasCredentials && hasProject && hasLocation) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\tif (provider === \"amazon-bedrock\") {\n\t\t// Amazon Bedrock supports multiple credential sources:\n\t\t// 1. AWS_PROFILE - named profile from ~/.aws/credentials\n\t\t// 2. AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY - standard IAM keys\n\t\t// 3. AWS_BEARER_TOKEN_BEDROCK - Bedrock API keys (bearer token)\n\t\t// 4. AWS_CONTAINER_CREDENTIALS_RELATIVE_URI - ECS task roles\n\t\t// 5. AWS_CONTAINER_CREDENTIALS_FULL_URI - ECS task roles (full URI)\n\t\t// 6. AWS_WEB_IDENTITY_TOKEN_FILE - IRSA (IAM Roles for Service Accounts)\n\t\tif (\n\t\t\tprocess.env.AWS_PROFILE ||\n\t\t\t(process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY) ||\n\t\t\tprocess.env.AWS_BEARER_TOKEN_BEDROCK ||\n\t\t\tprocess.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI ||\n\t\t\tprocess.env.AWS_CONTAINER_CREDENTIALS_FULL_URI ||\n\t\t\tprocess.env.AWS_WEB_IDENTITY_TOKEN_FILE\n\t\t) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\tconst envMap: Record<string, string> = {\n\t\topenai: \"OPENAI_API_KEY\",\n\t\t\"azure-openai-responses\": \"AZURE_OPENAI_API_KEY\",\n\t\tgoogle: \"GEMINI_API_KEY\",\n\t\tgroq: \"GROQ_API_KEY\",\n\t\tcerebras: \"CEREBRAS_API_KEY\",\n\t\txai: \"XAI_API_KEY\",\n\t\topenrouter: \"OPENROUTER_API_KEY\",\n\t\t\"vercel-ai-gateway\": \"AI_GATEWAY_API_KEY\",\n\t\tzai: \"ZAI_API_KEY\",\n\t\tmistral: \"MISTRAL_API_KEY\",\n\t\tminimax: \"MINIMAX_API_KEY\",\n\t\t\"minimax-cn\": \"MINIMAX_CN_API_KEY\",\n\t\thuggingface: \"HF_TOKEN\",\n\t\topencode: \"OPENCODE_API_KEY\",\n\t\t\"opencode-go\": \"OPENCODE_API_KEY\",\n\t\t\"kimi-coding\": \"KIMI_API_KEY\",\n\t};\n\n\tconst envVar = envMap[provider];\n\treturn envVar ? process.env[envVar] : undefined;\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ export * from "./stream.js";
15
15
  export * from "./types.js";
16
16
  export * from "./utils/event-stream.js";
17
17
  export * from "./utils/json-parse.js";
18
- export * from "./utils/oauth/index.js";
18
+ export type { OAuthAuthInfo, OAuthCredentials, OAuthLoginCallbacks, OAuthPrompt, OAuthProvider, OAuthProviderId, OAuthProviderInfo, OAuthProviderInterface, } from "./utils/oauth/types.js";
19
19
  export * from "./utils/overflow.js";
20
20
  export * from "./utils/typebox-helpers.js";
21
21
  export * from "./utils/validation.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uCAAuC,CAAC;AACtD,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC","sourcesContent":["export type { Static, TSchema } from \"@sinclair/typebox\";\nexport { Type } from \"@sinclair/typebox\";\n\nexport * from \"./api-registry.js\";\nexport * from \"./env-api-keys.js\";\nexport * from \"./models.js\";\nexport * from \"./providers/anthropic.js\";\nexport * from \"./providers/azure-openai-responses.js\";\nexport * from \"./providers/google.js\";\nexport * from \"./providers/google-gemini-cli.js\";\nexport * from \"./providers/google-vertex.js\";\nexport * from \"./providers/openai-completions.js\";\nexport * from \"./providers/openai-responses.js\";\nexport * from \"./providers/register-builtins.js\";\nexport * from \"./stream.js\";\nexport * from \"./types.js\";\nexport * from \"./utils/event-stream.js\";\nexport * from \"./utils/json-parse.js\";\nexport * from \"./utils/oauth/index.js\";\nexport * from \"./utils/overflow.js\";\nexport * from \"./utils/typebox-helpers.js\";\nexport * from \"./utils/validation.js\";\n"]}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uCAAuC,CAAC;AACtD,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,YAAY,EACX,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,sBAAsB,GACtB,MAAM,wBAAwB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC","sourcesContent":["export type { Static, TSchema } from \"@sinclair/typebox\";\nexport { Type } from \"@sinclair/typebox\";\n\nexport * from \"./api-registry.js\";\nexport * from \"./env-api-keys.js\";\nexport * from \"./models.js\";\nexport * from \"./providers/anthropic.js\";\nexport * from \"./providers/azure-openai-responses.js\";\nexport * from \"./providers/google.js\";\nexport * from \"./providers/google-gemini-cli.js\";\nexport * from \"./providers/google-vertex.js\";\nexport * from \"./providers/openai-completions.js\";\nexport * from \"./providers/openai-responses.js\";\nexport * from \"./providers/register-builtins.js\";\nexport * from \"./stream.js\";\nexport * from \"./types.js\";\nexport * from \"./utils/event-stream.js\";\nexport * from \"./utils/json-parse.js\";\nexport type {\n\tOAuthAuthInfo,\n\tOAuthCredentials,\n\tOAuthLoginCallbacks,\n\tOAuthPrompt,\n\tOAuthProvider,\n\tOAuthProviderId,\n\tOAuthProviderInfo,\n\tOAuthProviderInterface,\n} from \"./utils/oauth/types.js\";\nexport * from \"./utils/overflow.js\";\nexport * from \"./utils/typebox-helpers.js\";\nexport * from \"./utils/validation.js\";\n"]}
package/dist/index.js CHANGED
@@ -14,7 +14,6 @@ export * from "./stream.js";
14
14
  export * from "./types.js";
15
15
  export * from "./utils/event-stream.js";
16
16
  export * from "./utils/json-parse.js";
17
- export * from "./utils/oauth/index.js";
18
17
  export * from "./utils/overflow.js";
19
18
  export * from "./utils/typebox-helpers.js";
20
19
  export * from "./utils/validation.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uCAAuC,CAAC;AACtD,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC","sourcesContent":["export type { Static, TSchema } from \"@sinclair/typebox\";\nexport { Type } from \"@sinclair/typebox\";\n\nexport * from \"./api-registry.js\";\nexport * from \"./env-api-keys.js\";\nexport * from \"./models.js\";\nexport * from \"./providers/anthropic.js\";\nexport * from \"./providers/azure-openai-responses.js\";\nexport * from \"./providers/google.js\";\nexport * from \"./providers/google-gemini-cli.js\";\nexport * from \"./providers/google-vertex.js\";\nexport * from \"./providers/openai-completions.js\";\nexport * from \"./providers/openai-responses.js\";\nexport * from \"./providers/register-builtins.js\";\nexport * from \"./stream.js\";\nexport * from \"./types.js\";\nexport * from \"./utils/event-stream.js\";\nexport * from \"./utils/json-parse.js\";\nexport * from \"./utils/oauth/index.js\";\nexport * from \"./utils/overflow.js\";\nexport * from \"./utils/typebox-helpers.js\";\nexport * from \"./utils/validation.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uCAAuC,CAAC;AACtD,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AAWtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC","sourcesContent":["export type { Static, TSchema } from \"@sinclair/typebox\";\nexport { Type } from \"@sinclair/typebox\";\n\nexport * from \"./api-registry.js\";\nexport * from \"./env-api-keys.js\";\nexport * from \"./models.js\";\nexport * from \"./providers/anthropic.js\";\nexport * from \"./providers/azure-openai-responses.js\";\nexport * from \"./providers/google.js\";\nexport * from \"./providers/google-gemini-cli.js\";\nexport * from \"./providers/google-vertex.js\";\nexport * from \"./providers/openai-completions.js\";\nexport * from \"./providers/openai-responses.js\";\nexport * from \"./providers/register-builtins.js\";\nexport * from \"./stream.js\";\nexport * from \"./types.js\";\nexport * from \"./utils/event-stream.js\";\nexport * from \"./utils/json-parse.js\";\nexport type {\n\tOAuthAuthInfo,\n\tOAuthCredentials,\n\tOAuthLoginCallbacks,\n\tOAuthPrompt,\n\tOAuthProvider,\n\tOAuthProviderId,\n\tOAuthProviderInfo,\n\tOAuthProviderInterface,\n} from \"./utils/oauth/types.js\";\nexport * from \"./utils/overflow.js\";\nexport * from \"./utils/typebox-helpers.js\";\nexport * from \"./utils/validation.js\";\n"]}
@@ -3299,6 +3299,23 @@ export declare const MODELS: {
3299
3299
  contextWindow: number;
3300
3300
  maxTokens: number;
3301
3301
  };
3302
+ readonly "gemini-3.1-flash-lite-preview": {
3303
+ id: string;
3304
+ name: string;
3305
+ api: "google-generative-ai";
3306
+ provider: string;
3307
+ baseUrl: string;
3308
+ reasoning: true;
3309
+ input: ("image" | "text")[];
3310
+ cost: {
3311
+ input: number;
3312
+ output: number;
3313
+ cacheRead: number;
3314
+ cacheWrite: number;
3315
+ };
3316
+ contextWindow: number;
3317
+ maxTokens: number;
3318
+ };
3302
3319
  readonly "gemini-3.1-pro-preview": {
3303
3320
  id: string;
3304
3321
  name: string;
@@ -3488,7 +3505,7 @@ export declare const MODELS: {
3488
3505
  contextWindow: number;
3489
3506
  maxTokens: number;
3490
3507
  };
3491
- readonly "gemini-3-pro-high": {
3508
+ readonly "gemini-3.1-pro-high": {
3492
3509
  id: string;
3493
3510
  name: string;
3494
3511
  api: "google-gemini-cli";
@@ -3505,7 +3522,7 @@ export declare const MODELS: {
3505
3522
  contextWindow: number;
3506
3523
  maxTokens: number;
3507
3524
  };
3508
- readonly "gemini-3-pro-low": {
3525
+ readonly "gemini-3.1-pro-low": {
3509
3526
  id: string;
3510
3527
  name: string;
3511
3528
  api: "google-gemini-cli";
@@ -6319,6 +6336,59 @@ export declare const MODELS: {
6319
6336
  maxTokens: number;
6320
6337
  };
6321
6338
  };
6339
+ readonly "opencode-go": {
6340
+ readonly "glm-5": {
6341
+ id: string;
6342
+ name: string;
6343
+ api: "openai-completions";
6344
+ provider: string;
6345
+ baseUrl: string;
6346
+ reasoning: true;
6347
+ input: "text"[];
6348
+ cost: {
6349
+ input: number;
6350
+ output: number;
6351
+ cacheRead: number;
6352
+ cacheWrite: number;
6353
+ };
6354
+ contextWindow: number;
6355
+ maxTokens: number;
6356
+ };
6357
+ readonly "kimi-k2.5": {
6358
+ id: string;
6359
+ name: string;
6360
+ api: "openai-completions";
6361
+ provider: string;
6362
+ baseUrl: string;
6363
+ reasoning: true;
6364
+ input: ("image" | "text")[];
6365
+ cost: {
6366
+ input: number;
6367
+ output: number;
6368
+ cacheRead: number;
6369
+ cacheWrite: number;
6370
+ };
6371
+ contextWindow: number;
6372
+ maxTokens: number;
6373
+ };
6374
+ readonly "minimax-m2.5": {
6375
+ id: string;
6376
+ name: string;
6377
+ api: "anthropic-messages";
6378
+ provider: string;
6379
+ baseUrl: string;
6380
+ reasoning: true;
6381
+ input: "text"[];
6382
+ cost: {
6383
+ input: number;
6384
+ output: number;
6385
+ cacheRead: number;
6386
+ cacheWrite: number;
6387
+ };
6388
+ contextWindow: number;
6389
+ maxTokens: number;
6390
+ };
6391
+ };
6322
6392
  readonly openrouter: {
6323
6393
  readonly "ai21/jamba-large-1.7": {
6324
6394
  id: string;
@@ -7034,6 +7104,23 @@ export declare const MODELS: {
7034
7104
  contextWindow: number;
7035
7105
  maxTokens: number;
7036
7106
  };
7107
+ readonly "essentialai/rnj-1-instruct": {
7108
+ id: string;
7109
+ name: string;
7110
+ api: "openai-completions";
7111
+ provider: string;
7112
+ baseUrl: string;
7113
+ reasoning: false;
7114
+ input: "text"[];
7115
+ cost: {
7116
+ input: number;
7117
+ output: number;
7118
+ cacheRead: number;
7119
+ cacheWrite: number;
7120
+ };
7121
+ contextWindow: number;
7122
+ maxTokens: number;
7123
+ };
7037
7124
  readonly "google/gemini-2.0-flash-001": {
7038
7125
  id: string;
7039
7126
  name: string;
@@ -7204,6 +7291,23 @@ export declare const MODELS: {
7204
7291
  contextWindow: number;
7205
7292
  maxTokens: number;
7206
7293
  };
7294
+ readonly "google/gemini-3.1-flash-lite-preview": {
7295
+ id: string;
7296
+ name: string;
7297
+ api: "openai-completions";
7298
+ provider: string;
7299
+ baseUrl: string;
7300
+ reasoning: true;
7301
+ input: ("image" | "text")[];
7302
+ cost: {
7303
+ input: number;
7304
+ output: number;
7305
+ cacheRead: number;
7306
+ cacheWrite: number;
7307
+ };
7308
+ contextWindow: number;
7309
+ maxTokens: number;
7310
+ };
7207
7311
  readonly "google/gemini-3.1-pro-preview": {
7208
7312
  id: string;
7209
7313
  name: string;
@@ -8751,6 +8855,23 @@ export declare const MODELS: {
8751
8855
  contextWindow: number;
8752
8856
  maxTokens: number;
8753
8857
  };
8858
+ readonly "openai/gpt-5.3-chat": {
8859
+ id: string;
8860
+ name: string;
8861
+ api: "openai-completions";
8862
+ provider: string;
8863
+ baseUrl: string;
8864
+ reasoning: false;
8865
+ input: ("image" | "text")[];
8866
+ cost: {
8867
+ input: number;
8868
+ output: number;
8869
+ cacheRead: number;
8870
+ cacheWrite: number;
8871
+ };
8872
+ contextWindow: number;
8873
+ maxTokens: number;
8874
+ };
8754
8875
  readonly "openai/gpt-5.3-codex": {
8755
8876
  id: string;
8756
8877
  name: string;
@@ -9958,7 +10079,7 @@ export declare const MODELS: {
9958
10079
  contextWindow: number;
9959
10080
  maxTokens: number;
9960
10081
  };
9961
- readonly "upstage/solar-pro-3:free": {
10082
+ readonly "upstage/solar-pro-3": {
9962
10083
  id: string;
9963
10084
  name: string;
9964
10085
  api: "openai-completions";
@@ -11031,6 +11152,23 @@ export declare const MODELS: {
11031
11152
  contextWindow: number;
11032
11153
  maxTokens: number;
11033
11154
  };
11155
+ readonly "google/gemini-3.1-flash-lite-preview": {
11156
+ id: string;
11157
+ name: string;
11158
+ api: "anthropic-messages";
11159
+ provider: string;
11160
+ baseUrl: string;
11161
+ reasoning: true;
11162
+ input: ("image" | "text")[];
11163
+ cost: {
11164
+ input: number;
11165
+ output: number;
11166
+ cacheRead: number;
11167
+ cacheWrite: number;
11168
+ };
11169
+ contextWindow: number;
11170
+ maxTokens: number;
11171
+ };
11034
11172
  readonly "google/gemini-3.1-pro-preview": {
11035
11173
  id: string;
11036
11174
  name: string;
@@ -11048,6 +11186,23 @@ export declare const MODELS: {
11048
11186
  contextWindow: number;
11049
11187
  maxTokens: number;
11050
11188
  };
11189
+ readonly "inception/mercury-2": {
11190
+ id: string;
11191
+ name: string;
11192
+ api: "anthropic-messages";
11193
+ provider: string;
11194
+ baseUrl: string;
11195
+ reasoning: true;
11196
+ input: "text"[];
11197
+ cost: {
11198
+ input: number;
11199
+ output: number;
11200
+ cacheRead: number;
11201
+ cacheWrite: number;
11202
+ };
11203
+ contextWindow: number;
11204
+ maxTokens: number;
11205
+ };
11051
11206
  readonly "inception/mercury-coder-small": {
11052
11207
  id: string;
11053
11208
  name: string;
@@ -11949,6 +12104,23 @@ export declare const MODELS: {
11949
12104
  contextWindow: number;
11950
12105
  maxTokens: number;
11951
12106
  };
12107
+ readonly "openai/gpt-5.3-chat": {
12108
+ id: string;
12109
+ name: string;
12110
+ api: "anthropic-messages";
12111
+ provider: string;
12112
+ baseUrl: string;
12113
+ reasoning: true;
12114
+ input: ("image" | "text")[];
12115
+ cost: {
12116
+ input: number;
12117
+ output: number;
12118
+ cacheRead: number;
12119
+ cacheWrite: number;
12120
+ };
12121
+ contextWindow: number;
12122
+ maxTokens: number;
12123
+ };
11952
12124
  readonly "openai/gpt-5.3-codex": {
11953
12125
  id: string;
11954
12126
  name: string;