SDK Reference
The @launchgate/sdk is the official JavaScript/TypeScript SDK for LaunchGate.
Installation
npm
npm install @launchgate/sdkQuick example
import { LaunchGate } from "@launchgate/sdk";
const lg = new LaunchGate({
apiKey: process.env.LAUNCHGATE_API_KEY,
});
const result = await lg.run("my-suite", {
output: "The AI-generated text to evaluate",
input: { context: "Supporting context for scoring" },
});
if (result.passed) {
console.log("Cleared for launch ✓");
} else {
console.log("Launch aborted ✗");
console.log("Failures:", result.failures);
}Exports
The SDK exports the following:
import {
LaunchGate, // Main client class
LaunchGateError, // Base error class
NetworkError, // Network/connectivity errors
ValidationError, // Input validation errors
AuthError, // Authentication errors
PaymentError, // Usage limit errors
} from "@launchgate/sdk";Requirements
- Node.js 18+
- TypeScript 5.0+ (optional)
Runtime support
The SDK has no Node-specific APIs — it uses only globalThis.fetch and standard AbortController. It runs in any JavaScript runtime that supports the Fetch API.
| Runtime | Supported | Import |
|---|---|---|
| Node.js 18+ | ✓ | import { LaunchGate } from "@launchgate/sdk" |
| Bun | ✓ | import { LaunchGate } from "@launchgate/sdk" |
| Deno | ✓ | import { LaunchGate } from "npm:@launchgate/sdk" |
| Cloudflare Workers | ✓ | import { LaunchGate } from "@launchgate/sdk" |
| Supabase Edge Functions | ✓ | import { LaunchGate } from "npm:@launchgate/sdk" |
| Vercel Edge Runtime | ✓ | import { LaunchGate } from "@launchgate/sdk" |
| Browser | Not recommended | API keys must not be exposed client-side |
API base URL
By default, the SDK points to https://api.launchgate.ai. You can override this for testing or self-hosted deployments:
const lg = new LaunchGate({
apiKey: "...",
baseUrl: "http://localhost:4001",
});Last updated on