Fleeexdocs

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 typed 402 carrying 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

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.