Skip to main content
Swap your OpenAI client base URL and key, include a stable user id, and you can charge for usage in minutes.
1

Create a paywall & choose mode

Create a paywall in the dashboard and choose your mode. This sets how money flows and cannot be changed later.
  • Default (App‑scoped wallet) — You collect payments directly (e.g., Stripe or your own rails). Users’ balances live in your app’s scope. You credit balances via Deposit API and charges deduct from that balance. No end‑user authorization step.
  • Shared (Cross‑app wallet) — Paywalls hosts a user‑controlled wallet that can be spent across apps. Users authorize your paywall. You earn per usage and later withdraw. End‑user authorization required.

Choose a mode

Compare Default vs Shared mode, trade‑offs, and examples.
2

Configure a model provider

  • Default mode (required)
  • Shared mode (optional)
Connect a provider via BYOK. Works with OpenAI, TogetherAI, OpenRouter, or any OpenAI‑compatible API.
3

Configure payments / top‑ups

  • Default mode
  • Shared mode
Paste a restricted Stripe API key in the dashboard. Paywalls auto‑creates checkout links and subscribes to webhooks to credit balances. Or use custom rails and call Deposit API after you receive funds.
4

Copy API key & base URL; make your first request

Grab your paywall API key (sk‑paywalls‑…) and point your OpenAI client at the Paywalls base URL.
Always include a stable, pseudonymous user id: body user (recommended) or header X‑Paywall‑User. Keep your key server‑side.
  • Node (OpenAI SDK)
  • Python (OpenAI SDK)
  • fetch (JS)
  • cURL
import OpenAI from "openai";
const client = new OpenAI({
  apiKey: process.env.PAYWALLS_API_KEY, // sk-paywalls-...
  baseURL: "https://api.paywalls.ai/v1",
});
const resp = await client.chat.completions.create({
  model: "openai/gpt-4o-mini",
  user: "user_123",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0]?.message?.content);
5

Understand responses & next steps

  • Default mode
  • Shared mode
  • Paywall‑required flows arrive as normal assistant messages — render them as any chat reply.
  • If the user must top up, the message already includes the link. After completion, the next requests proceed normally.
  • Stripe webhooks auto‑deposit into the app‑scoped balance.