satsgate lets you charge sats for AI agents, APIs, and web apps in minutes — without building a payment stack.
Add a Lightning paywall to any endpoint with two calls: /v1/paywall/challenge (return 402) and /v1/paywall/verify.
It’s a hosted + self-hostable FastAPI service that gives you:
- L402 paywall primitives (invoice + macaroon + preimage verification)
- Prepaid credits (plans) for predictable costs (1 credit = 1 successful verification)
- Usage & reporting (ledger, daily series, forecast + purchase recommendation)
- Roadmap (active): new wallet backends, integrations, and production hardening
Your users pay your Lightning Address (LNURL-pay). You don’t need to run a node or manage webhooks.
Hosted beta: https://api.satsgate.org (start in CUSTOMER_QUICKSTART.md).
No LLM in the hot path: satsgate is a lightweight “cashier/turnstile” that sits in front of your agent.
This project is currently in beta. See BETA.md.
If you're integrating satsgate as a customer (agent operator), start here:
- Hosted health: https://api.satsgate.org/health
- Hosted manifest: https://api.satsgate.org/.well-known/satsgate.json
See STATUS.md.
- Support:
SUPPORT.md - Contributing:
CONTRIBUTING.md - Changelog:
CHANGELOG.md - Security:
SECURITY.md
GET /.well-known/satsgate.json→ machine-readable manifest (endpoints + auth + pricing)GET /openapi.json→ OpenAPI
Configured via env vars:
-
SATSGATE_WALLET_MODE=mock(recommended for local testing)- invoices are simulated
- DEV helper:
/dev/mock/pay/{payment_hash}returns thepreimage
-
SATSGATE_WALLET_MODE=lnaddr- generates real invoices via your Lightning Address (LNURL-pay)
- requires:
SATSGATE_LIGHTNING_ADDRESS=user@domain
Endpoints:
GET /v1/plans→ list plansGET /v1/topup/{plan_id}→ start purchase (returns 402 + invoice + macaroon)GET /v1/topup/{plan_id}withAuthorization: L402 ...→ finalize purchase, credit balanceGET /v1/balancewithX-Api-Key: ...→ current credit balanceGET /v1/clientwithX-Api-Key: ...→ client info (incl. payee)POST /v1/client/payeewithX-Api-Key: ...→ register client payee (Lightning Address)
Reporting:
GET /v1/ledgerwithX-Api-Key: ...→ credit ledger entriesGET /v1/usage/summary?since_hours=24withX-Api-Key: ...→ usage summaryGET /v1/usage/daily?days=30withX-Api-Key: ...→ daily series (UTC)GET /v1/usage/forecast?lookback_hours=24&buffer_days=7&max_topups=3&trigger_hours=24withX-Api-Key: ...- forecast + recommended purchase + “when to top up” trigger
These are the endpoints your customers (agent operators) integrate:
POST /v1/paywall/challengewithX-Api-Key: ...→ returnsinvoice + macaroonfor a resourcePOST /v1/paywall/verifywithX-Api-Key: ...+Authorization: L402 ...- verifies the preimage
- charges 1 credit (only once per
payment_hash)
python client_mock_demo.py(mock L402 demo)node client_nwc_demo.mjs(pays/v1/ticketsusing NWC)node client_topup_nwc.mjs trial|starter|growth|scale|hyper|mega(buy credits via NWC)node client_paywall_credit_demo.mjs <resource> <amount_sats>(challenge + pay + verify)
sdk/python(packagesatsgate-sdk)- install locally:
pip install -e sdk/python - FastAPI examples:
- Minimal:
sdk/python/examples/fastapi_demo/main.py - Reference integration:
sdk/python/examples/fastapi_reference/
- Minimal:
- install locally:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
uvicorn app.main:app --reload --port 8000This repo includes a minimal Docker setup with Caddy (TLS) and a persistent SQLite volume.
- Copy env file:
cp .env.example .env- Edit
.envand set at least:
SATSGATE_HOSTNAME=api.yourdomain.comSATSGATE_MACAROON_SECRET=...(use a long random value)SATSGATE_WALLET_MODE=lnaddrSATSGATE_LIGHTNING_ADDRESS=user@domainSATSGATE_DEV_MODE=0
- Start:
docker compose up -d --buildNotes:
- Your DNS must point
SATSGATE_HOSTNAMEto your server IP. - Ports 80 and 443 must be open for Caddy/Let’s Encrypt.