satsgate
Charge AI agents in Lightning and USDC on the same 402. Payments go straight to your wallet. 500 free unlocks a month.
No node to run, and no custody: the buyer pays the seller's wallet. After 500 free unlocks in a UTC month, each paid unlock debits 2 sats from a prepaid service balance, capped at 10% of the item price.
satsgate init takes a merchant from nothing to a self-hosted paywall config. It opens a free account, saves the account key in .satsgate/account.env, asks for a Lightning Address, mints a restricted proxy key, writes .env and satsgate-proxy.yaml, and checks the paywall with a real 402. That check does not pay, verify, or settle. It also reads whether the Lightning Address advertises LUD-21 verify.
Terms: https://satsgate.org/terms. Source: https://github.com/Mike-io-hash/satsgate. API reference: https://github.com/Mike-io-hash/satsgate/blob/main/docs/api.md.
It does not ask for a seed, a private key, or a recovery phrase. It does not hold sats or USDC. The account key is not copied into the project .env. The project .env holds SATSGATE_API_KEY (sgr_) and SATSGATE_ORIGIN_SECRET.
uvx satsgate init
or pip install satsgate, then satsgate init.
Three commands:
satsgate trypays a demo paywall once, to your own Lightning Address, so you see a real 402 paid and unlocked before you configure anything of your own.satsgate initwrites the config for your API or your remote MCP server.satsgate statusreads the setup back.
Try it
Once you have a Lightning Address, this takes about five minutes:
uvx satsgate try
try opens or reuses the free account in .satsgate/, sets your Lightning Address, and mints a restricted key for this run only. A demo origin, the proxy, and a buyer run in the same process. Nothing listens on a port. The buyer asks GET /hello, gets a 402 for 10 sats (--sats sets 1 to 1000), and the terminal shows the invoice and a QR a phone camera can scan (--no-qr hides it).
The payment is real. The sats go to your own Lightning Address. Pay from a different wallet than the one behind that address, because some wallets cannot pay their own invoice. When the address advertises LUD-21 verify, try sees the payment by itself. Otherwise it asks for the payment preimage from the paying wallet. After the unlock it prints the demo response and the free unlocks left this month, then revokes the restricted key. It writes only under .satsgate/.
An agent cannot scan a QR for its owner. It gets the invoice and checks later:
satsgate try --json --no-wait --lightning-address merchant@pay.example
satsgate try --check <payment_hash> --json
satsgate try --check <payment_hash> --preimage <hex> --json
--no-wait never prompts, even on a terminal. It returns status awaiting_payment, the challenge (invoice, payment_hash, invoice_expires_at), and a check_command. The macaroon stays in .satsgate/try.json and is not printed. --check reads the status once and returns paid, pending (with retry_after_seconds), expired, preimage_required, or preimage_rejected. A check does not debit and does not use a free unlock. With --json and without --no-wait, try waits for the payment when the address advertises LUD-21 verify and prints the invoice on stderr; otherwise it returns like --no-wait.
API or MCP
Human mode asks what you are charging for. Agent mode defaults to --kind api.
satsgate init --json --lightning-address merchant@pay.example --kind mcp --paid-tool deep_search=21
--kind mcp writes one route with methods: [POST, DELETE] on --mcp-path (default /mcp), signal: in_band, default: free, and one entry per --paid-tool NAME=SATS. Only those tools are charged; every other MCP message is forwarded free. The upstream default is http://127.0.0.1:8000. Without --paid-tool, the route uses example_tool at 10 sats and warns example_tool_placeholder. The check is an unpaid tools/call through the in-memory proxy, and route in the JSON lists the tools. The resource of a paid tool is route:mcp:<tool>.
Lightning Address
When the Lightning Address is missing, or does not advertise LUD-21 verify, init and try list providers that advertised LUD-21 verify on a given date. Human mode prints the list. Agent mode adds address_options (checked_on, providers) and a next_steps line. The list is alphabetical and is not an endorsement. It can change: the live check on your own address is what counts. In human mode, init offers to try another address after a negative check, up to three times. The YAML does not change.
Status
satsgate status
satsgate status --json
satsgate status --check-address
status shows the account (key_preview and fingerprint, never the key), the Lightning Address, the last LUD-21 check from .satsgate/last-check.json, the free unlocks left and when they reset, the prepaid balance, paid unlocks in the last 24 hours, the routes from satsgate-proxy.yaml with USDC on or off, and whether the proxy answers GET /healthz on its local address. --check-address checks the address again with one unpaid invoice; nothing is paid or debited. --config reads another YAML. Exit codes: 0 fine, 1 the API or the network failed, 2 usage (for example no account here), 3 something needs a decision (no address, an address without LUD-21 verify, a suspended account, USDC on a route without a verified EVM payee, or a rejected key).
Human and agent
Human mode prompts when stdin is a terminal and --json is not set. It asks what you are charging for (API or MCP) and the Lightning Address. With MCP it also asks for the tool to charge for and its price. USDC test mode and the origin snippet are flags (--want-usdc, --framework). Agent mode (--json, or stdin that is not a terminal) never prompts. It prints one JSON object on stdout and notes on stderr. A missing Lightning Address is exit 2 and names --lightning-address.
satsgate init --json --lightning-address merchant@pay.example
satsgate init --json --lightning-address merchant@pay.example --want-usdc
satsgate init --docker --framework fastapi
JSON (schema_version 1) includes ok, status, exit_code, api_url, kind, account (client_id, key_preview, fingerprint, reused), payee_lightning_address, usdc, files, route, test_402, lud21, address_options, start_command, next_steps, warnings, and error. A key is shown as sg_… or sgr_… plus the last four characters, and as a fingerprint. The connect link is not a JSON field.
LUD-21 check
After the test 402, init asks the core once for the status of that unpaid test invoice. It is a read: nothing is paid, nothing is debited, and no second invoice is created. The answer shows whether the Lightning Address advertises LUD-21 verify.
lud21.supported: true: a person can pay the QR from any Lightning wallet, and the proxy confirms the payment without a preimage.lud21.supported: falseand the warninglud21_not_supported: agents can still pay, because they send the preimage. A person who pays the QR from a wallet that does not show the preimage cannot finish. To accept those payments, use a Lightning Address that advertises LUD-21 verify.lud21.supported: nulland the warninglud21_not_checked: the check did not get an answer. Runsatsgate initagain to check.
The check never fails init and does not change the exit code. lud21 is null when init stopped before the check, for example when the test 402 failed. Human mode prints the same sentence after the Lightning Address.
"lud21": {
"supported": false,
"detail": "The Lightning Address does not advertise LUD-21 verify. Agents can still pay: they send the preimage. A person who pays the QR from a wallet that does not show the preimage cannot finish. To accept those payments, use a Lightning Address that advertises LUD-21 verify."
},
"warnings": ["lud21_not_supported"]
Exit codes: 0 done, 1 the API or the network failed, 2 usage, 3 a human has to decide, 4 rate-limited. A 429 includes retry_after_seconds and is not retried.
Files
| Path | Mode | Contents |
|---|---|---|
.satsgate/ |
0700 | directory |
.satsgate/account.env |
0600 | SATSGATE_ACCOUNT_KEY |
.satsgate/.gitignore |
* |
|
.env |
0600 when created here | SATSGATE_API_KEY, SATSGATE_ORIGIN_SECRET |
satsgate-proxy.yaml |
proxy config, no secrets | |
.satsgate/connect-link.txt |
0600 | wallet link in agent mode |
.satsgate/last-check.json |
0600 | last LUD-21 result for status; a cache, not listed in files |
.satsgate/try.json |
0600 | the pending try for --check, with its macaroon |
A second run reuses the account and the keys. An existing YAML or snippet is not overwritten (agent exit 3 file_exists). A different SATSGATE_* value is exit 3 env_conflict. A symlink is refused. On Windows the run finishes and warns permissions_not_restricted; WSL is the supported way to get owner-only files.
USDC payments: Base network only
USDC payments use Base only. Ethereum mainnet, Polygon, Solana, Arbitrum, and any other chain are not accepted.
| Network | Network id | Circle USDC contract | Status |
|---|---|---|---|
| Base Sepolia (testnet) | eip155:84532 |
0x036CbD53842c5426634e7929541eC2318f3dCF7e |
Testing. It is not a network for real buyers. |
| Base | eip155:8453 |
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
Live mode (on by default on api.satsgate.org; a self-hosted core needs SATSGATE_X402_CDP=1 and CDP credentials, see self-hosting). |
payTo must be an address you control on Base. The USDC moves from the buyer to that address. Satsgate does not hold a buyer wallet and does not run its own facilitator.
When USDC is off, the next steps of a successful init include: "To also accept USDC on Base, run satsgate init again with --want-usdc." --want-usdc mints a one-time connect link when the EVM payee is not verified yet. A terminal prints the link once and can open it. Otherwise it is written to .satsgate/connect-link.txt and is not printed. After the payee is verified, a later run sets x402: true and x402_mode: test. The unpaid 402 then includes a Base Sepolia offer. Paying that offer is a later step for a buyer agent (satsgate-mcp-pay), with the key on the buyer's machine. Test mode is free.
To turn USDC test mode off, delete the YAML and run init again. It is regenerated and the keys are reused. Manual edits to the YAML are lost. To keep them, remove the route's x402 and x402_mode lines and restart the proxy instead.
Lightning has no test network. A paid Lightning request moves real sats to the merchant's own address.
Start
uvx --env-file .env satsgate-proxy --config satsgate-proxy.yaml
satsgate 0.2.0. --docker writes docker-compose.satsgate.yml and prints docker compose -f docker-compose.satsgate.yml up. The compose file uses the public image ghcr.io/mike-io-hash/satsgate-proxy:0.15.1. The generated service listens on 0.0.0.0; the YAML written for uvx stays on 127.0.0.1.
Contributors' note
To build the image yourself, use proxy/Dockerfile from the repo. From a checkout: pip install -e sdk/python -e proxy -e cli.
--framework fastapi, express, or nginx copies the existing origin check. A client that can reach the origin directly must fail closed. The Caddy file in the package is a note, not an HMAC check.
Metadata
Release files for satsgate 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| satsgate-0.2.0.tar.gz | 47.6 kB | With provenance | Details for satsgate-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| satsgate-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for satsgate-0.2.0-py3-none-any.whl |
Total release size: 96.8 kB
Release files / satsgate-0.2.0.tar.gz
| Download URL | satsgate-0.2.0.tar.gz |
|---|---|
| Size | 47.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe301455def72c5723e01934ee25c0cefff0b5990f169e0aafb46d014189986b
|
|
BLAKE2b-256 checksum How to use checksums |
43130619eb55097d289f13df03d49e50a8564539a1b37454aeb988bdaa5261e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / satsgate-0.2.0-py3-none-any.whl
| Download URL | satsgate-0.2.0-py3-none-any.whl |
|---|---|
| Size | 49.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
391425c52dd07cf6ea83479502cfd4fb0189bc53a95e7635fd50d02f96bceb8c
|
|
BLAKE2b-256 checksum How to use checksums |
6db2882e171ebdda884933ada42a66b7daf4a162d33a7007a10a695ae2aa2655
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logSecurity for satsgate 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for satsgate-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.