Back to articles
Stop rebuilding BYOK from scratch — I extracted it into a package

Stop rebuilding BYOK from scratch — I extracted it into a package

via Dev.to WebdevAdam Boon

Every AI SaaS project I've worked on hits the same wall. You need to let users bring their own API keys — or your infrastructure needs to route across providers with fallbacks. Either way, you end up building the same thing: key validation, provider selection, cost estimation, health checks. Then you maintain it. Then you build it again in the next project. I got tired of it, so I extracted that layer into a package. What it is Restormel Keys is a headless BYOK and provider routing library for AI apps. pnpm add @restormel/keys import { createKeys , openaiProvider , anthropicProvider } from " @restormel/keys " ; const keys = createKeys ( { routing : { defaultProvider : " openai " } }, { providers : [ openaiProvider , anthropicProvider ] } ); // Resolves which key to use: BYOK → fallback chain → platform key const resolved = await keys . resolve ( " openai " , " gpt-4o " ); // Cost estimation before you make the call const cost = keys . estimateCost ( " gpt-4o-mini " ); That's the core.

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
6 views

Related Articles