Getting started
Connect your application to Enlitt and make your first authenticated AI call.
Using a coding agent
A coding agent can read these docs as Markdown and run the Enlitt CLI for your account without ever seeing a secret. Copy this prompt into your agent:
You are helping me build with Enlitt.
Read https://enlitt.com/docs/agents.md first; it lists every Enlitt doc and when to read it. Fetch only the docs you need for the current task, as Markdown.
For anything about my Enlitt business account, use the Enlitt CLI (npx enlitt --help) instead of guessing; I will approve its sign-in in my browser.
Never print, read, or ask me to paste an Enlitt secret key, and never pass --confirm without asking me first./docs/agents.md lists every page and when to read it. Every
docs page is also available as plain Markdown at its URL plus .md.
Enlitt gives your users one account for AI spending across participating applications. Your application can offer two kinds of calls:
| Route | Who runs the model? | Who sets the charge? |
|---|---|---|
| Standard | Enlitt runs its standard model and covers the provider cost. | Enlitt meters standard credits. |
| Premium | Your server calls your provider using your provider credentials. | You set a maximum and an actual price; Enlitt settles the user's premium spending. |
Both routes require a logged-in personal user and your application's App key. Premium prompts and outputs stay between your application and the provider; Enlitt receives the billing lifecycle, not that content.
Version and installation
These docs describe @enlitt/sdk@0.0.0, the current workspace version.
It is a development placeholder, not a confirmed public release. Registry
installation requires an available published release; use the workspace package
when developing in this repository.
# Once a release is available, install the SDK with your chosen adapter's dependencies.
# Vercel AI SDK integration:
npm install @enlitt/sdk ai
# OpenAI Responses integration:
npm install @enlitt/sdk openaiThe SDK package requires Node.js 22 or later. Your chosen framework or provider package may require a newer runtime. All model calls run on your server.
Set up your application
- Create a business account in your browser (the CLI cannot create one; see business accounts), then register an application.
- Copy its public client ID and register your callback URL.
- Create a model key for that application under Keys. Store it on
your server as
ENLITT_SECRET_KEY. - Mount the login handlers and session middleware. A business key identifies the application; a personal session identifies the user.
- Make a standard call using one of the adapters below.
Test applications consume real credits. Start with standard calls; premium calls also need available premium credits and a nonzero user spending limit.
Make a standard call
After login and inside the request's session middleware:
import { enlitt, ENLITT_STANDARD_MODEL } from "@enlitt/sdk/vercel";
import { generateText } from "ai";
const result = await generateText({
model: enlitt(ENLITT_STANDARD_MODEL),
prompt: "Summarize this support ticket."
});
console.log(result.text);Using OpenAI Responses instead:
import { enlitt, ENLITT_STANDARD_MODEL } from "@enlitt/sdk/openai";
const client = enlitt();
const response = await client.responses.create({
model: ENLITT_STANDARD_MODEL,
input: "Summarize this support ticket."
});
console.log(response.output_text);"enlitt-standard" is the standard model identifier in both adapters.
See Models and pricing for premium calls and streaming.
Choose an import
| Import | Use it for |
|---|---|
@enlitt/sdk/vercel | enlitt(model), the standard model, and Vercel token pricing. |
@enlitt/sdk/openai | enlitt() or enlitt(openAIClient) with responses.create(). |
@enlitt/sdk/core | Session context, typed errors, usage(), and framework-neutral withPremiumCharge(). |
@enlitt/sdk/server | Login handlers, and compatibility re-exports of core and Vercel APIs. |
These four entries are server-only. The package root and @enlitt/sdk/browser
currently provide no integration APIs. Your browser starts login by navigating
to your server's login route; it does not need an Enlitt key or SDK model client.
Next: Application registration, Login and sessions, then Models and pricing.