




















OAuth for AI spend · Developer preview
Wattfare drops a “Connect AI budget” button into your app. Users connect, set a spending cap, and you call any model through one SDK — charged to them, not you. You stop eating the inference bill.
OpenAI-compatible Works with the Vercel AI SDK ~5-min integration
Think “Sign in with Google”, but for AI spend. One button connects a user's inference budget to your app — metered, capped, and revocable. You never store a key. They never overspend.
The problem
Every AI app makes the same uncomfortable bet: price high enough to survive your power users, ration usage so nobody hurts you, or quietly lose money on the heavy ones. Tokens scale with usage — your subscription price doesn't.
Today You pay for their tokens
With Wattfare They bring their own budget
Napkin math illustrative — drag the slider
Monthly active users 1,000 Usage profile
Your inference bill, today $750/mo
With Wattfare $0/mo
Users fund their own usage inside caps they set. Your COGS stops scaling with their curiosity.
How it works
A claim like that needs receipts — so here's the whole integration, as the diff you'd ship.
feat: let users bring their own AI budget +9 −1
1Drop in the button frontend · +4
@@ main.tsx @@+ <WattfareProvider publishableKey="pk_live_…" session={getToken}> <App />+ </WattfareProvider>@@ chat.tsx @@ const ai = useChat();+ const { connect, connected } = useWattfare();+ if (!connected) return <button onClick={connect}>Connect AI budget</button>; 2Mint sessions server · +4
+ const wf = new Wattfare({ secretKey: process.env.WATTFARE_SECRET_KEY });+ app.post("/api/ai-session", (c) =>+ c.json(wf.createSession(c.var.userId, { requestLimit: { monthlyUsd: 10 } }))+ ); 3Swap the model chat route · +1 −1
const result = streamText({- model: openai("gpt-4o"), // billed to: you+ model: wf.user(userId).model("anthropic/claude-sonnet-4"), // billed to: them prompt, }); // the deleted line is the one where you were paying. 01 Publishable key in the browser. The secret key stays on your server and mints short-lived session tokens.
02 Consent happens on Wattfare's domain — a popup, a cap, ~30s. State lives with us, keyed by your existing user ids.
03 The returned model is AI-SDK-compatible. Stream like you already do — every token metered against their cap.
Two sides, one button
Every mechanism in the middle is read from both ends. Same line, two balance sheets.
Inference is funded by the person using it. Your AI line item drops toward zero, and margins stop fighting compute.
the budget
One budget covers every connected app — no more paying five different markups for the same tokens.
Your worst case is their cap, never your card. The front page of HN stops being a financial event.
the cap
You pick a monthly number. It's enforced upstream — requests stop at your cap, not at an honor system.
No provider keys to collect, encrypt, rotate, or leak. Connection state lives on Wattfare, keyed by your user ids.
the key
You never paste a raw API key into a stranger's app. Consent happens on Wattfare's domain, like OAuth.
Disconnects surface as typed errors — the not-connected path is a normal flow state, not a 3am page.
the switch
Revoke any app in one click. The spending stops immediately, for that app only.
One SDK, hundreds of models, AI-SDK native. Same code in dev and prod — test keys auto-approve.
the models
Your prompts proxy straight through to the model. Wattfare meters cost; it isn't where conversations live.
Freemium that costs you nothing — give the whole product away and let usage fund itself.
the free tier
Try new AI apps in 30 seconds without a new account, card, or subscription each time.
Enterprise spend controls — per-seat budgets, finance-grade reporting — are on the roadmap.
OpenAI-compatible
Standard wire format, proxied to OpenRouter. No protocol to learn.
AI SDK native
Drop-in model for the Vercel AI SDK — stream as usual.
Real from day one
Connect your own budget on localhost — same consent flow your users see.
Edge-fast
Cloudflare Workers, streamed untouched, typed errors — no buffering.
FAQ
BYOK makes the user paste a raw provider key into your app. Wattfare is an OAuth-style consent flow: the user owns the budget, sets a cap, and can revoke it — and your app never sees or stores a key. Usage is metered for them.
Same conviction — users should fund their own inference — different layer. Provider sign-ins tie your app to one vendor's accounts and hand you a per-user key to store, scope, and babysit. Wattfare keeps all state on its side, keyed by the user ids you already have, and adds the parts apps actually need: monthly caps, usage status, one-click revocation, and an AI-SDK-ready model(). Inference currently routes through OpenRouter under the hood; the connection layer is provider-neutral by design.
It's an OpenAI-compatible proxy to OpenRouter, so hundreds of models across providers — Anthropic, OpenAI, Google, open-weights — all behind one AI-SDK-compatible model() call.
Inference is proxied through to read the final usage so we can meter cost — Wattfare isn't a place your conversations are meant to live. As an early preview, treat it accordingly; full data terms land before general availability.
The user picks a monthly cap. Wattfare meters usage against it, and the underlying provider key carries a hard ceiling as the real backstop — so requests stop at the cap, even mid-stream.
Wattfare is in developer preview and free to build on while we shape it. Pricing for the hosted service will be simple and announced well before it kicks in.
Cloudflare Workers + Hono on the edge, KV for connection state and soft metering. The SDK is a tiny TypeScript package with server, client, and react entry points.
Developer preview · free to start
Install the SDK, wrap your app, and let your users fund their own AI. Five minutes to your first capped, metered request.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。