Skip to Content
SDK ReferenceOverview

SDK Reference

The @launchgate/sdk is the official JavaScript/TypeScript SDK for LaunchGate.

Installation

npm install @launchgate/sdk

Quick 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.

RuntimeSupportedImport
Node.js 18+import { LaunchGate } from "@launchgate/sdk"
Bunimport { LaunchGate } from "@launchgate/sdk"
Denoimport { LaunchGate } from "npm:@launchgate/sdk"
Cloudflare Workersimport { LaunchGate } from "@launchgate/sdk"
Supabase Edge Functionsimport { LaunchGate } from "npm:@launchgate/sdk"
Vercel Edge Runtimeimport { LaunchGate } from "@launchgate/sdk"
BrowserNot recommendedAPI 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