Configuration
Constructor options
const lg = new LaunchGate(config: LaunchGateConfig);LaunchGateConfig
| Property | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | Your LaunchGate API key (starts with lg_live_ or lg_test_) |
baseUrl | string | "https://api.launchgate.ai" | API base URL |
timeout | number | 30000 | Request timeout in milliseconds |
Examples
Minimal
const lg = new LaunchGate({
apiKey: process.env.LAUNCHGATE_API_KEY!,
});Full configuration
const lg = new LaunchGate({
apiKey: process.env.LAUNCHGATE_API_KEY!,
baseUrl: "https://api.launchgate.ai",
timeout: 60_000, // 60 seconds for suites with many LLM judge cases
});Local development
const lg = new LaunchGate({
apiKey: "lg_test_local_dev_key",
baseUrl: "http://localhost:4001",
});Retry behaviour
The SDK automatically retries failed requests with exponential backoff:
- Max retries: 3
- Backoff: Exponential (1s, 2s, 4s)
- Retried: Network errors, 5xx server errors, 429 rate limit errors
- Not retried: 401 auth errors, 402 payment errors, 400 validation errors
Graceful degradation
If the LaunchGate API is unreachable after all retries, the SDK returns a result with status: "skipped" instead of throwing. This prevents eval failures from blocking your application:
const result = await lg.run("my-suite", { output: "..." });
if (result.status === "skipped") {
// LaunchGate was unreachable — proceed with caution
console.warn("Eval skipped — LaunchGate API unavailable");
}Last updated on