blob: 2e63a1c2fab479350a97639de814092027c5598f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import type { ApiKeyCredentials } from "@dispatch/kernel";
const DEFAULT_BASE_URL = "https://opencode.ai/zen/go/v1";
export function resolveApiKeyCredentials(
env: Readonly<Record<string, string | undefined>>,
): ApiKeyCredentials {
const apiKey = env.DISPATCH_API_KEY;
if (!apiKey) {
throw new Error("DISPATCH_API_KEY is not set. Set it in your environment or .env file.");
}
const baseURL = env.DISPATCH_BASE_URL ?? DEFAULT_BASE_URL;
return { type: "api-key", apiKey, baseURL };
}
|