Skip to main content

Python SDK for SatGate - Stripe for AI Agents. L402 micropayments for APIs.

Project description

SatGate Python SDK

Stripe for AI Agents — L402 micropayments for APIs.

PyPI version License: MIT

Installation

pip install satgate

For LangChain integration:

pip install satgate[langchain]

Quick Start

from satgate import SatGateSession, LightningWallet

# Implement your wallet (or use a library like lndgrpc, pyln-client)
class MyWallet(LightningWallet):
    def pay_invoice(self, invoice: str) -> str:
        # Pay the invoice and return the preimage
        return your_lightning_node.pay(invoice)

# Create a session that auto-pays 402 responses
session = SatGateSession(wallet=MyWallet())

# Use like requests - payments happen automatically!
response = session.get("https://api.example.com/premium/data")
print(response.json())

LangChain Integration

from satgate import SatGateTool

# Create a tool your AI agent can use
tool = SatGateTool(wallet=MyWallet())

# Add to your LangChain agent
agent = initialize_agent(
    tools=[tool],
    llm=ChatOpenAI(),
    agent=AgentType.OPENAI_FUNCTIONS
)

# The agent can now access paid APIs automatically!
agent.run("Fetch premium market data from https://api.example.com/insights")

How It Works

  1. Your code makes a request to a paid API
  2. The API returns 402 Payment Required with a Lightning invoice
  3. SatGate automatically pays the invoice via your wallet
  4. The request is retried with the L402 token
  5. You get your data ✨

Links

License

MIT License - © 2025 SatGate. Patent Pending.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

satgate-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

satgate-0.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file satgate-0.1.0.tar.gz.

File metadata

  • Download URL: satgate-0.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.1

File hashes

Hashes for satgate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d504f57b4907bcb9bae1cb39623bca15d741103855a4b6d1ac29c76099e4be10
MD5 ab363f0e7794ad8857ae4fe62e968fe4
BLAKE2b-256 f79d306e44cb80a6d0901c606eb07121494fcf147a0de9fe8ea50b2a1fc6da17

See more details on using hashes here.

File details

Details for the file satgate-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: satgate-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.1

File hashes

Hashes for satgate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c42d4e56c1782765e6b7baa697458d436413eddadf7bde1e1d231ed451947f3a
MD5 9bb775991bad0366d93071cc3a431e9a
BLAKE2b-256 17cbc8c180c1f766aebd429cf993ae1376c50643fc1b351042788e0a1f37ad41

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page