Skip to content
Eight Effect-native API SDKs are live.Explore the catalog
Distilled
Esc
navigateopen⌘Jpreview
On this page

Announcing the Distilled Statsig SDK

Manage feature gates, experiments, metrics, and release workflows through Statsig's Console API from Effect.

Feature delivery becomes far more powerful when configuration is programmable: teams can create gates from infrastructure workflows, audit stale flags, coordinate staged rollouts, and keep experiment definitions synchronized. @kevinmichaelchen/distilled-statsig exposes Statsig’s Console API as 312 Effect-native operations.

Statsig, at a glance

Statsig provides feature gates, experimentation, product analytics, and release tooling. Its Console API is the CRUD surface behind actions offered in the Statsig console, enabling programmatic management of gates, experiments, metrics, segments, layers, reports, teams, and release pipelines. Statsig maintains its public documentation in statsig-io/docs.

Why Effect and Distilled?

Feature-management automation is policy automation. It deserves explicit failures, bounded retries, auditable inputs, and observable execution—especially when a script can enable a gate or start an experiment. Effect makes those controls composable. Distilled validates the API boundary, injects the Console API key as a redacted dependency, sends the pinned version header, decodes Statsig errors, and preserves retry guidance.

The type signature shows what an operation needs and how it can fail. That makes destructive or rollout-changing programs easier to review than a chain of loosely typed HTTP calls.

How we made the SDK

Pin Statsig's dated contract

The source mirror fetches the official 20240601 OpenAPI document, matching the API-version header sent at runtime.

Fix the shared seam

Statsig omits operationId on every route. The shared generator now derives stable names from tags and summaries and detects collisions.

Generate the full Console API

The result is 312 committed operations covering gates, experiments, metrics, segments, layers, releases, settings, and more.

Keep the vendor boundary small

Only credentials, base URL, version header, errors, and retry policy are handwritten.

Code Examples

Set STATSIG_API_KEY, then install:

npm install @kevinmichaelchen/distilled-statsig effect
pnpm add @kevinmichaelchen/distilled-statsig effect
bun add @kevinmichaelchen/distilled-statsig effect
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
import {
  CredentialsFromEnv,
  experimentsListExperiments,
  gatesCreateGate,
  gatesListGates,
} from "@kevinmichaelchen/distilled-statsig";

const StatsigLive = Layer.mergeAll(FetchHttpClient.layer, CredentialsFromEnv);

Audit temporary feature gates

List temporary gates for a cleanup report or ownership review.

const temporaryGates = gatesListGates({
  type: "TEMPORARY",
  includeArchived: "false",
  limit: 100,
});

const auditTemporaryGates = temporaryGates.pipe(Effect.provide(StatsigLive));

Create a feature gate

Provision a disabled temporary gate that can move through review and rollout policy before receiving traffic.

const createCheckoutGate = gatesCreateGate({
  id: "checkout-redesign",
  name: "Checkout redesign",
  description: "Controls the new checkout experience.",
  type: "TEMPORARY",
  isEnabled: false,
  tags: ["checkout", "web"],
  idType: "userID",
}).pipe(Effect.provide(StatsigLive));

List active experiments

Build an experiment inventory for dashboards, governance, or automated health checks.

const listActiveExperiments = experimentsListExperiments({
  status: "active",
  fields: ["id", "name", "status", "teamID", "createdTime"],
  limit: 100,
}).pipe(Effect.provide(StatsigLive));

The same package can manage rules and overrides, retrieve pulse results, and coordinate release pipelines—without changing runtime conventions.

Because Statsig omits operation IDs, Distilled derives these names from tags and summaries. The shared generator normalizes them to lower camelCase while retaining collision detection and deterministic output.

Available now

Read the Statsig SDK guide, inspect the implementation, or install @kevinmichaelchen/distilled-statsig.

Last updated on July 15, 2026

Was this page helpful?