Enlitt

Introduction

Install the Enlitt SDK and route your application's AI calls through one account.

Enlitt lets an AI application charge its own users for the calls it makes on their behalf, and gives every user one account, one login, and one set of credit ceilings across every application that integrates Enlitt — instead of a separate subscription or API key per application.

This documentation is pinned to @enlitt/sdk@0.0.0, the version currently in this workspace. The SDK has not yet been published to a public registry under a release version past 0.0.0; when it is, this page will pin to that released version instead of the workspace's internal placeholder.

Install

npm install @enlitt/sdk

The package exports three subpaths, each with a different runtime boundary:

  • @enlitt/sdk — the isomorphic entry. It currently exports nothing on its own; it exists so a bundler resolves the package root without pulling in either the browser or the server code by accident.
  • @enlitt/sdk/server — server-only. This is where enlitt(), the language model factory, and every function that reads a business secret live. Importing this subpath in a browser bundle throws EnlittConfigurationError at module evaluation, before any secret is touched.
  • @enlitt/sdk/browser (referenced by the server-only guard's own error message as the browser-safe half of the package; consult its own documentation for personal-session client code you ship to consumers).

Everything on this page and the pages that follow describes the server-only half unless stated otherwise: application registration, enlitt(), idempotency, per-call premium limits, the typed error hierarchy, test/live separation, API keys, and business.info() are all server concerns. The one thing that is never server-only is the end user's own personal login with Enlitt, covered next.

What an application needs before its first call

  1. Register the application on the Enlitt business dashboard — see Application registration.
  2. Require personal login for every user before any managed call — see Personal login and business credentials.
  3. Call enlitt() to obtain a model, and pass it to the AI SDK exactly like any other LanguageModelV3 — see Models.

Read the pages in this section in order; each one assumes the concepts the previous one introduced.

On this page