npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@useoutlet/sdk

v0.6.0

Published

Connect your users' AI accounts to your app. Capped, revocable App keys, never raw credentials. Outlet is never in the data path.

Readme

@useoutlet/sdk

Let your users plug in the AI they already pay for.

Outlet connects a user's existing AI account (Anthropic, OpenAI, Google, or any OpenAI-compatible provider) to your app through capped, revocable App keys, one per app. Never their raw credentials. Your app calls the provider directly with the official SDK. Outlet is never in the data path.

Status: direct mode works today (validated bring-your-own-key, no server). Vault mode (capped, revocable App keys) is in early access. Registration is by invite. Get one at useoutlet.dev. The same session in both modes. Protocol docs at useoutlet.dev. Feedback welcome.

Have a Vault invite? Paste this into your AI.

Your AI adds the Connect your AI button for you. The same button can offer Direct, Vault or both. Your Vault invite brings the app ID.

Add Outlet to this app so users can connect their own AI account.
Read https://useoutlet.dev/llms-full.txt first.
Install: npm install @useoutlet/sdk
App ID: <from your Vault invite>
Return address: <the https or private-scheme return address>
Local testing: http://localhost/outlet/return, any port
Button: import { mountConnectButton } from "@useoutlet/sdk/ui".
Mount on an empty div with mode: "both", appId and redirectUri.
Vault return: pass Outlet.handleRedirect() as session only when the return address has code and state.
Receive the Direct or Vault session through onSession.
No app secret in the app.
Vault provider: choose openai, anthropic or fal. Use a separate Vault connection request for each provider.
Place the Connect your AI button where users connect their AI account.
After connect: call the provider with its official SDK using session.keys.<provider>.

Why

  • Users already pay for AI. They shouldn't pay again inside every app.
  • Developers shouldn't store customer API keys (breach target, compliance).
  • Raw keys are all-or-nothing. Outlet keys are per-app, capped, revocable.

Install

npm install @useoutlet/sdk

Usage today (direct mode)

Your user pastes their own API key; the SDK validates it locally (catches provider mix-ups, refuses admin keys) and hands back a session. No network, nothing sent to Outlet. A local format check.

import Outlet from "@useoutlet/sdk";

const session = await Outlet.direct({
  keys: { openai: userPastedKey },
});

import OpenAI from "openai";
const ai = new OpenAI({ apiKey: session.keys.openai });

Works with any OpenAI-compatible provider. Pass the key under that provider and point the OpenAI SDK at its base URL:

const session = await Outlet.direct({ keys: { groq: userPastedKey } });

const ai = new OpenAI({
  apiKey: session.keys.groq,
  baseURL: "https://api.groq.com/openai/v1",
});

OpenAI, Anthropic, and Google get strict key-format checks (mix-ups caught, admin keys refused); other providers are accepted with the same admin-key safety check, since their key formats vary.

Vault mode (the same session, in early access)

Same session shape. The pasted key becomes an App key: provisioned inside the user's own account for your app alone, capped, and revocable.

// NOTE: vault mode is by invite during early access. Your invite brings your app_id: useoutlet.dev
//
// 1. user clicks [ Connect your AI ], which opens the Outlet grant screen
const session = await Outlet.connect({
  appId: "app_yourapp",
  providers: ["openai"],
  requestedCapUsd: 10,
});

// 2. same as before
const ai = new OpenAI({ apiKey: session.keys.openai });

// later: re-fetch keys (session.grantId is the thing you persist)
const fresh = await Outlet.refresh(session.grantId);

// check spend / status
const info = await Outlet.status(session.grantId);
console.log(`${info.spendUsd} of ${info.capUsd} used`);

No backend? Public clients use PKCE

connect() suits apps with a server (it can hold an appSecret). A pure frontend (SPA, phone app, CLI) registers as a public client instead: no secret, just a registered redirectUri. Grant creation is secured by PKCE (protocol docs at useoutlet.dev), so the flow spans the redirect in two calls:

// on your [ Connect your AI ] button: generates PKCE, redirects to the grant screen
await Outlet.connectRedirect({
  appId: "app_yourapp",
  providers: ["anthropic"],
  redirectUri: "https://yourapp.com/outlet/return",
});

// on the page served at redirectUri: verifies state, exchanges the code
const session = await Outlet.handleRedirect();
const ai = new Anthropic({ apiKey: session.keys.anthropic });

// session.refreshToken (not an app secret) authorizes later calls.
const fresh = await Outlet.refresh(session.grantId, { refreshToken: session.refreshToken });
// fresh.refreshToken replaces the one you sent; the old one now gets 401. Store the new one.

The provider key arrives only on the back-channel exchange, never in the redirect URL. The refreshToken belongs to this one grant.

Outlet registers http://localhost/outlet/return for every app. It matches any port.

Phones

The public-client flow works inside iPhone and Android apps. Open the grant URL in the system browser sheet, take the code back on your registered return address (a private scheme like com.yourapp:/outlet/return, or your website), then call exchangeCode(). React Native has no Web Crypto: pass crypto: { getRandomValues, sha256 } from expo-crypto to createGrant(). Guide: https://useoutlet.dev/docs/dev/mobile

Media apps

Choose the provider that serves the models your app needs. The provider and model determine which images, video or voice your app can make.

Model hosts

fal serves models from other makers for image, video and voice apps. Use an API-scope fal Direct API key for Direct. For Vault, the user adds an ADMIN-scope fal Vault admin key on useoutlet.dev. Your app receives a separate Vault App key.

Replicate serves models from other makers. Use a Replicate API token as a Direct API key. Replicate is Direct only because it does not provide an API for Outlet to create separate Vault App keys.

Model makers

OpenAI’s gpt-image-2 and gpt-image-2.5 image models run through the existing OpenAI Vault connection. Anthropic can provide text alongside media through Direct or Vault. Google’s Gemini API is Direct only. Veo uses a long-running operation; submitting a request does not mean the result is ready.

Other providers can use the generic Direct screen. Your app supplies the provider’s name and official page for getting a Direct API key. Implement and check that provider’s model calls in your app.

mountConnectButton(target, {
  mode: "direct",
  providers: ["fal", "replicate", { id: "runway", name: "Runway", keysUrl: "https://dev.runwayml.com/" }],
  onSession,
});

Vault caps for media

fal does not enforce a spending limit on each Vault App key. Outlet measures the Vault App key’s spending from delayed fal reports. Outlet deletes the Vault App key when reported spending reaches the Vault cap. Spending can exceed the Vault cap, especially when jobs are costly or already running. Revoking Vault access may not stop work the provider has accepted.

Background jobs and workers

Use Vault for work your app must manage after the browser closes. Keep the Vault connection and its refresh credentials in protected server storage, associated with the user, app and provider. Your worker loads that connection to obtain the app’s Vault App key. The app never receives the Vault admin key.

Refresh the Vault connection before access expires. Save the refreshed connection before the next job uses it. Check Vault access before submitting more work.

On a 401 response, stop submitting jobs and check whether the failure came from Outlet or the provider. If the Vault connection has expired, refresh it. If refresh fails or access is no longer active, ask the user to reconnect through Outlet. Do not repeatedly retry a rejected Vault App key or resubmit a generation whose outcome is unknown.

If Vault access is paused, stop new work and show that the connection needs attention on Outlet. If Vault access is revoked, require the user’s approval before reconnecting. If the Vault cap is reached, stop new work and show that the Vault cap has been reached. Do not create another Vault connection to bypass the Vault cap.

For fal, submit long jobs to its queue. Save the request ID with the job so the worker can check that request instead of submitting it again. Use polling or fal webhooks to collect the result. Verify webhook signatures and handle repeated deliveries without processing the result twice.

When Vault access stops, stop local retries and further submissions. Request cancellation of pending provider work where available. Cancellation may fail to stop work already processing, so a job can still finish and be charged after Vault access is stopped.

Direct API keys are never sent to Outlet. Your app holds the key, in the browser or on your own server when the provider accepts calls only from a server, and tells the user which. Work that runs after the browser closes belongs in the Vault.

Several providers

Create a separate connection for each provider your app uses. A text connection can sit alongside connections for video and voice. If the same provider serves several models, those models can use that provider’s connection.

For example, an app can use Anthropic in Vault for text and fal in Vault for video and voice. Each provider’s Vault connection has its own Vault App key, Vault cap and revoke control. Video and voice using the same fal Vault App key share its Vault cap.

Keep each Vault connection associated with its provider when saving, refreshing and using it. Revoking the fal Vault connection does not revoke the Anthropic Vault connection.

You can also offer a Direct connection, such as Replicate, alongside Vault. Outlet never receives a Direct API key. Direct does not get Vault caps or Outlet’s Vault revoke control. The user removes Direct access on the provider’s website.

What your app never sees (vault mode)

  • The user's root API key or account credentials
  • Other apps' keys or spend
  • Anything after revocation. A revoked grant stops working

Direct mode is the bridge while vault mode is in early access. The user's own key, in your app, by their choice. Validated, never an admin credential. The same API you keep when you upgrade to vault mode.

What Outlet never does

No proxying. No token markup. No model routing. No prompt storage. Free for end users, forever. Direct mode is free. The vault is the paid product for developers. MIT licensed.


Docs: useoutlet.dev · Source · Contact: [email protected]