Stop rebuilding AI routing logic in every project

Restormel Keys is a one-middleware control layer for routing, fallback chains, and policy enforcement. Works above OpenRouter, Portkey, Vercel AI Gateway, or direct providers. No proxy. No new infrastructure.

One middleware call

One createResolveMiddleware() call replaces your custom provider-selection logic. Your backend asks Restormel which provider and model to use; you keep calling the provider directly.

Dashboard-configured

Fallback chains, model allowlists, and budget caps configured in the dashboard — not scattered across environment variables and try/catch blocks.

Pre-deploy health checks

Health checks run locally or in CI via keys doctor and keys validate before anything breaks in production.

Works with OpenRouter, Portkey, Vercel AI Gateway, and direct providers. 15-minute integration path for Next.js, React, and SvelteKit.

Integrates with the stack you already run

Gateways, model providers, CI, and Postgres — documented paths, not a rip-and-replace migration.

Integration catalog →

Built in real products

See how different teams use Restormel Keys in production: a fast setup for privacy-sensitive extraction at PLOT, and a deeper multi-workload integration at Sophia.

Read full use cases →

AI infrastructure is solved. Product logic isn’t.

Tools like OpenRouter, Portkey, Vercel AI Gateway, and LiteLLM handle infrastructure concerns: provider access, aggregation, and (often) proxy-style routing. But every AI product still has to build the application layer: end-user BYOK, plan-based model access, budgets, and routing decisions based on user context. Restormel Keys is that missing application layer — designed to sit above your existing stack.

Restormel sits above your existing stack

Keep your infrastructure. Restormel adds the application layer: BYOK for your users, routing based on user + plan, cost awareness before execution, and embeddable UX for key management.

Layer 1 — Infrastructure

OpenRouter / Portkey / Vercel AI / direct providers

Layer 2 — Application

Restormel Keys (BYOK, routing, policies, entitlements, budgets)

Three ways to use it

Gateway-backed, builder-managed direct, or end-user BYOK. Same core; adopt progressively.

Gateway-backed

Keep OpenRouter / Portkey / Vercel AI Gateway as your provider-access layer. Use Restormel for routing policies, health, analytics, and progressive rollout.

Builder-managed direct

Keep provider keys in your env/secrets manager. Restormel resolves the route/model/provider decision; you supply provider access from your own infrastructure.

End-user BYOK (builder-managed)

Offer a KeyManager UX for users, but store credentials in your backend (or a gateway-backed scheme). Restormel remains the control layer.

Add it to your stack

Choose your integration path. Tabs are CSS-only, so this section renders cleanly without client JavaScript.

Install
bash
pnpm add @restormel/keys @restormel/keys-svelte
Example
ts
// src/routes/api/chat/+server.ts (SvelteKit)
import { createResolveMiddleware } from "@restormel/keys";
import { KeyManager } from "@restormel/keys-svelte";

const resolve = createResolveMiddleware({
  providers: ["openai", "anthropic"],
});

export async function POST({ request }) {
  const { model, messages } = await request.json();
  const { provider } = await resolve(model);

  const apiKey =
    provider.type === "openai" ? import.meta.env.OPENAI_API_KEY :
    provider.type === "anthropic" ? import.meta.env.ANTHROPIC_API_KEY :
    undefined;
  if (!apiKey) return new Response("Missing provider access", { status: 500 });

  const res = await fetch(provider.chatUrl, {
    method: "POST",
    headers: { "Authorization": `Bearer ${apiKey}` },
    body: JSON.stringify({ model, messages }),
  });
  return new Response(JSON.stringify(await res.json()));
}

// src/routes/settings/+page.svelte
<script lang="ts">
  const user = { id: "u_123" };
  const keys = {} as unknown;
</script>

<KeyManager
  keys={keys}
  userId={user.id}
  onKeyAdded={(event) => console.log("added", event.detail)}
/>
Install
bash
pnpm add @restormel/keys @restormel/keys-react @restormel/keys-elements
Example
tsx
"use client";
import { createKeys } from "@restormel/keys";
import { KeysProvider, KeyManager } from "@restormel/keys-react";

const keys = createKeys({ routing: { defaultProvider: "openai" } });

export function SettingsKeyManager() {
  return (
    <KeysProvider keys={keys}>
      <KeyManager userId="user_123" />
    </KeysProvider>
  );
}
Install
bash
pnpm add @restormel/keys
Example
ts
import { createKeys, openaiProvider, anthropicProvider } from "@restormel/keys";

const keys = createKeys(
  { routing: { defaultProvider: "openai" } },
  { providers: [openaiProvider, anthropicProvider] }
);

const resolved = await keys.resolve("gpt-4o-mini");
const estimate = keys.estimateCost("gpt-4o-mini", { inputTokens: 1200, outputTokens: 350 });

console.log(resolved.provider.type, estimate.totalUsd);

Fits your framework

SvelteKit, Next.js / React, and Web Components are supported package paths. You can also run fully headless in any framework with @restormel/keys. Same API; no Docker, Redis, or proxy.

  • SvelteKit
  • Next.js
  • React
  • Vue
  • Astro

What's in the box

Routing, policies, health, cost, and embeddable UX that sit alongside your existing provider access.

Integrations

Works with OpenRouter, Vercel AI Gateway, Portkey, and direct providers.

Restormel Resolve

Model → provider resolution. One middleware, multiple backends.

Cost

Per-model cost and budget comparison. Estimate before you call.

Entitlements

Gate features by tier. Optional usage limits.

Embeddable UX

ModelSelector, CostEstimator, and optional KeyManager. Svelte, React, or Web Components.

Restormel Doctor & Validate

Health checks you can run locally or in CI to catch bad config and broken provider access before deploy.

Where Restormel fits in your AI stack

CapabilityLiteLLM / Portkey / OpenRouterRestormel Keys
Primary roleInfrastructure / gateway / proxyApplication-layer library
How it runsHosted service or self-hosted infraRuns inside your app
Request routingYes (proxy-based)Yes (in-app, key-aware)
Request/response normalisationYesHandled by your provider or gateway
CachingSometimes built-inUse your existing cache (Redis, CDN, gateway)
Observability / tracingOften built-inUse your existing observability tools
Access to multiple providersYes (via proxy or aggregation)Yes (via your providers or OpenRouter)
End-user BYOK (bring your own keys)NoYes — first-class
Embeddable key management UINoYes — drop-in components
Per-user model availabilityNoYes — based on user keys
Cost estimation (before request)LimitedYes — built-in
Plan-based entitlementsLimitedYes — first-class
Library-first (no infra required)NoYes
Works with existing stackN/A (is the stack)Yes — designed to sit on top

Restormel doesn’t replace your AI gateway — it completes it. Use OpenRouter, Portkey, or direct providers for infrastructure. Use Restormel to add BYOK, routing logic, and product-level controls.

Pricing

Free to build. Upgrade to Pro when you’re ready to ship.

Early access: First 50 founding members get 12 months of Pro via Founders Circle. Full tiers (Team, Platform bundle) are on the pricing page.

Free

$0

Best for prototyping. 2 projects and 1,000 requests/month.

Pro

£10/mo

Best for production. Higher limits, visibility, and routing controls. Other currencies at checkout (Paddle).

See full pricing and FAQ →

Add governance to your AI stack

Install the packages, pick gateway-backed or direct provider access, then add routes and policies. The walkthrough guides you step by step.

Get started