Team working on a SaaS product
SaaS teams shipping AI to their own users

Embed paid AI features in your SaaS

  • No subscription, pay only for inference
  • Use with any model
  • No backend required
  • Per-customer limits and analytics
  • Hide system prompts
  • Tool use and structured output included
Flow demo
sdk + webhook
Track one customer
browser-safe
import { createApiKeySdk } from "keystash-sdk";

const sdk = createApiKeySdk({
  baseUrl: "https://api.keystash.dev"
});

await sdk.account.connect(process.env.KEYSTASH_APP_KEY!);

const session = await sdk.runtime.sessions.create({
  spaceId: "acme-prod",
  endUserId: "user_123",
  operationIds: ["summarize_ticket"],
  ttlMinutes: 15
});

await sdk.runtime.connect(session.token);
Result
{
  "spaceId": "acme-prod",
  "endUserId": "user_123",
  "operationIds": ["summarize_ticket"],
  "expiresIn": "15m",
  "token": "kst_rt_..."
}
  • One customer id per session
  • Per-customer analytics start here
  • Prompts and provider keys stay off the client
Customer
Scoped access
One runtime session per customer and feature set.
Billing
User spend caps
Stripe payments can increase one user's remaining spend.
Prompts
Hidden by default
Ship UI to the browser without exposing prompt logic.
Define
  • One feature per product action
  • Provider key stays server-side
  • Prompt stays hidden
Run
  • Mint runtime sessions per end user
  • Invoke features from browser or app shell
  • Keep models and prompts scoped
Meter
  • Track calls and token usage by workspace
  • Track usage by feature
  • Debit owner balance as users run features

SDK first

  • `sdk.spaces.operations.create(...)`
  • `sdk.runtime.sessions.create(...)`
  • `sdk.runtime.invoke(...)`
  • `sdk.runtime.usage(...)`
No backend required
Ship a client-side app with one app key. KeyStash mints short-lived runtime sessions for each customer.
Hidden system prompts
Feature prompts live in KeyStash. The browser only sends input and receives output.
Optional backend
If you already run your own checkout flow, Stripe can still call Keystash directly to increase one end user's remaining spend.
Create feature
Admin
const feature = await sdk.spaces.operations.create("acme-prod", {
  title: "Summarize ticket",
  slug: "summarize_ticket",
  model: "openai/gpt-5.4-mini",
  systemPrompt: "You summarize support tickets for internal agents.",
  userTemplate: "Ticket:\n{{ticket}}\n\nReturn a concise summary.",
  monthlyInvocationLimit: 10000,
  allowedOrigins: ["https://app.acme.com"]
});
Dashboard preview
summarize_ticket
openai/gpt-5.4-mini
active
Calls
12,842
Tokens
3.2M
Runtime sessions
TTL 15 min
Origin lock app.acme.com
What ships now
  • Any-model routing
  • Client-side app flow
  • Per-customer limits
  • Per-customer analytics
  • Hidden system prompts
  • Tool use and structured output