Metadata-Version: 2.4
Name: agentpay-python
Version: 0.1.2
Summary: AgentPay Python SDK — Lightning Network payments for AI agents
Author-email: AIPP <aippcore@gmail.com>
License: MIT
Project-URL: Homepage, https://api.aipp.dev
Project-URL: Source, https://github.com/aippdev/agentpay-python
Project-URL: Documentation, https://api.aipp.dev/docs
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.25.0

# AgentPay Python SDK

Lightning Network payment infrastructure for AI agents. L402 paywall, credit management, and idempotent spending — in one clean SDK.

## Installation

```bash
pip install agentpay-python
```

## Quickstart

```python
from agentpay import AgentPayClient

# Get an API key (50 free credits on signup)
client = AgentPayClient(api_key="sg_...")
bal = client.get_balance()
print(f"Balance: {bal.credits_remaining} credits")

# Spend credits (idempotent — safe to retry)
result = client.spend(amount=5.0, description="AI call")
print(f"Spent: {result.credits_used}, Remaining: {result.credits_remaining}")

# Usage forecast
forecast = client.forecast(estimated_cost_per_call=0.05)
if forecast.will_exhaust:
    print("Credits running low!")
print(f"Estimated calls remaining: {forecast.estimated_calls_remaining}")

# L402 Paywall — generate Lightning invoice
pw = client.generate_paywall(amount=10.0, description="Premium content")
print(f"Invoice: {pw.invoice}")

# Topup — purchase more credits
top = client.topup(usd_amount=5.0)
print(f"Topup invoice: {top.invoice}")
```

## API Reference

Full API documentation: [api.aipp.dev/docs](https://api.aipp.dev/docs)

## Features

- **L402 Paywall** — Lightning-native paywall with macaroon tokens
- **Credit System** — Prepaid credits with spending limits
- **Idempotent Spending** — Safe retry, no double-charges
- **Usage Forecasting** — Predict when credits will run out
- **Rate Limiting** — IP + API key rate limits
- **LNURL Auth** — Login with your Lightning wallet

## License

MIT — use it, ship it, build on it.
