Introduction
@fleeex/sdk is a thin wrapper over the OpenAI SDK for the Fleeex LLM proxy: a preconfigured connection, billing helpers, and no loss of OpenAI compatibility.
@fleeex/sdk is the official client for Fleeex, a centralized prepaid wallet for AI
usage with an OpenAI-compatible LLM proxy. The SDK is a thin wrapper over the OpenAI
SDK: it preconfigures the base URL, your API key, and the x-fleeex-user header, and
adds a few billing helpers. Two lines to start, and nothing about OpenAI compatibility
is given up.
import { FleeexClient } from "@fleeex/sdk";
const client = new FleeexClient({
apiKey: process.env.FLEEEX_API_KEY!, // flx_…, a server-side secret
userId: "user-123", // the end user your app vouches for
});
const completion = await client.chat.completions.create({
model: "nova-lite",
messages: [{ role: "user", content: "Hello!" }],
});client.chat.completions.create is the OpenAI method, with OpenAI's own request and
return types. The SDK only preconfigures the connection and maps the 402. What the
server accepts inside that request is narrower: the wire is iso-OpenAI, the parameter
surface is a documented subset of it, and an unsupported parameter comes back as a 400
naming itself rather than a field silently dropped. See
Supported parameters.
Why use it
- Two-line setup. Point at Fleeex without wiring the base URL, bearer key, and per-user header yourself.
- Billing built in.
getBalance(),getUsageSummary(), and a typed402carrying a top-up link, which is data the raw OpenAI SDK doesn't expose. - No lock-in. The wire stays iso-OpenAI, so you can drop back to the raw OpenAI SDK at any time (there's a non-regression test asserting byte-identical requests). See Drop back to raw OpenAI.
Backend only. The API key is a server-side secret, so never ship it in a browser or mobile client. See Authentication.
Where to go next
- Installation: add the SDK to your project.
- Quickstart: your first metered call.
- Choosing a model: pass an alias, and ask which models your app may call. Read this before your first call.
- Supported parameters: what the proxy honors, accepts inert, and refuses. Read this second.
- Sandbox: integrate, and exercise every refusal, without paying a cent.
- Calling the model: streaming and its usage chunk, function calling, structured output, vision.
- Money and onboarding: balance and payments, connecting users, usage, and webhooks so you're told before a user is cut off.
- API reference: every option, method, type, and error.
What is Fleeex?
One prepaid balance funds AI usage across every app that integrates Fleeex, and consumption is metered per app and per end user, so a person pays for their own AI usage, transparently. Learn more at fleeex.app.