Fleeexdocs

Introduction

@fleeex/sdk is a thin wrapper over the OpenAI SDK for the Fleeex LLM proxy — preconfigured connection, billing helpers, and zero 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, with zero loss of OpenAI compatibility.

import { FleeexClient } from "@fleeex/sdk";
 
const client = new FleeexClient({
  apiKey: process.env.FLEEEX_API_KEY!, // flx_… — server-side secret
  userId: "user-123", // the end user your app vouches for
});
 
const completion = await client.chat.completions.create({
  model: "anthropic.claude-3-haiku-20240307-v1:0",
  messages: [{ role: "user", content: "Hello!" }],
});

client.chat.completions.create is the OpenAI method — same params, same return types. The SDK only preconfigures the connection and maps the 402.

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 → top-up link — 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 — 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 — a person pays for their own AI usage, transparently. Learn more at fleeex.app.