Easiest path: swap the base URL
Most AI nodes accept an OpenAI‑compatible endpoint. Set:- Base URL:
https://api.paywalls.ai/v1 - API Key: your Paywalls API key (server/secret credential)
- Model: keep the same model id (e.g.,
openai/gpt-4o-mini) or choose from your configured models - User: provide a stable id if the node supports it (body
useror a header field)
n8n (Agents / OpenAI nodes)
- Open the AI node (e.g., Agent, Chat Model, OpenAI node).
- Provider: OpenAI (or OpenAI‑compatible).
- Advanced/Custom host: set Base URL to
https://api.paywalls.ai/v1. - API Key: set a credential holding your Paywalls key.
- Model: select your desired model (e.g.,
openai/gpt-4o-mini). - Optional: add a stable
userfield if supported to enable per‑user metering.
Zapier (AI Actions / AI by Zapier)
- In an AI step that supports an OpenAI‑compatible provider, set Base URL to
https://api.paywalls.ai/v1. - Use your Paywalls API key as the credential.
- Keep the rest of your prompt/chain as‑is.
Alternative: Custom HTTP request (when needed)
If your tool or step doesn’t expose model settings, call the Chat Completions API directly.- URL:
POST https://api.paywalls.ai/v1/chat/completions - Headers:
Authorization: Bearer <PAYWALLS_API_KEY>,Content-Type: application/json - Optional:
X-Paywall-User: <user_id>if you can’t putuserin the body - Body:
{ model, user, messages, stream? }
Advanced: custom payments and manual charges
For more complex flows (your own checkout, per‑tool fees, post‑processing charges), call these endpoints directly from your no‑code tool:- Deposit credits (credit a user after your checkout succeeds):
POST https://api.paywalls.ai/v1/user/balance/deposit - Charge user (manual one‑off debit for actions outside token metering):
POST https://api.paywalls.ai/v1/user/charge
Authorization: Bearer <PAYWALLS_API_KEY>Content-Type: application/jsonIdempotency-Key: <stable-request-id>(strongly recommended)
user: stable pseudonymous user idamount: string value in your configured currency (e.g., “1.50”)metadata: optional JSON with your payment reference (payment_intent,checkout_session, internal ids)
- Method: POST
- URL: one of the endpoints above
- Data: JSON with
user,amount,metadata - Headers: add the three headers listed above
- Method: POST
- URL: one of the endpoints above
- Send: JSON
- Body:
user,amount, optionalmetadata - Headers: add the three headers listed above
- Default mode: use Deposit after your own payment succeeds; makes the balance available for future usage charges.
- Shared mode:
POST /user/chargemay returnsuccess: falsewith an assistant message containing an authorization or top‑up link—forward that message to your user. - Always reuse the same Idempotency‑Key when retrying to prevent duplicate deposits/charges.
- Deposit:
api-reference/user/balance/deposit/post.mdx - Charge:
api-reference/user/charge/post.mdx
Tips
- Store
PAYWALLS_API_KEYas a secret/credential inside your tool; never hardcode in steps. - Always pass a stable pseudonymous
userto get accurate per‑user balances and analytics. - Use Shared mode for zero‑setup launches; switch to Default mode with Stripe when you want direct capture.