Wattfare / Docs
Dashboard
Getting started

Wattfare documentation

Wattfare is an OAuth-like consent layer for AI spend. Your users connect their own inference budget, set a cap, and you call any model through one SDK — charged to them, not you.

Shipping an AI feature usually means you pay for every token your users burn. Costs are unpredictable, a single power user can wreck your margins, and you carry the risk. Wattfare flips that around: your users bring their own AI budget and approve a spending cap once, in a hosted consent popup. You make model calls on their behalf — metered against that budget, billed to them.

Think “Sign in with Google”, but for AI spend. One button connects a user's inference budget to your app: metered, capped, and revocable at any time. Your secret key never leaves your backend; the browser only ever holds a short-lived, scoped session token.

Why Wattfare

01 Predictable costs Your users' spend is their own. No surprise inference bills, no per-seat AI pricing you have to model and absorb.
02 One SDK, every model An OpenAI-compatible proxy backs hundreds of models. Swap openai/gpt-4o-mini for anthropic/claude-sonnet-4 with a string.
03 Users stay in control Caps are enforced upstream. Users can see usage and revoke any app from their dashboard — which is exactly what builds trust.
04 No secrets in the browser The frontend forwards a 10-minute JWT minted by your backend. The secret key and the user's funding source never touch the client.

Three SDK surfaces

The wattfare package has no root export — you import only the surface you need. Each is a thin, focused layer over the same HTTP API.

At a glance

Installing is one command. On your backend, inference is a drop-in AI SDK provider — if you've used the Vercel AI SDK, this will look familiar:

terminal
npm install wattfare
server.ts
import { Wattfare } from "wattfare/server";
import { generateText } from "ai";

const wf = new Wattfare({ secretKey: process.env.WATTFARE_SECRET_KEY! });

// Scoped to one of *your* user ids — no Wattfare account for end users.
const ai = wf.user("user_123");

const { text } = await generateText({
  model: ai.model("openai/gpt-4o-mini"), // billed to the user's budget
  prompt: "Say hello.",
});

The only Wattfare-specific lines are constructing the client and calling wf.user(id). Everything downstream is standard AI SDK. Usage is metered automatically against the connected user's budget.

Start here