| 22 | let providers: ProviderBundle | undefined; |
| 23 | |
| 24 | function resolveZenApiKey(): string { |
| 25 | for (const envName of API_KEY_ENV_VARS) { |
| 26 | const value = process.env[envName]?.trim(); |
| 27 | if (value) { |
| 28 | return value; |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | assert( |
| 33 | false, |
| 34 | [ |
| 35 | "Missing OpenCode Zen API key.", |
| 36 | "Set OPENCODE_API_KEY before running the CLI.", |
| 37 | "See https://opencode.ai/docs/zen/ for instructions.", |
| 38 | ].join(" "), |
| 39 | ); |
| 40 | } |
| 41 | |
| 42 | function resolveZenBaseUrl(): string { |
| 43 | const configured = process.env.OPENCODE_ZEN_BASE_URL?.trim(); |