Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

limen (Python)

x402 paywall middleware + standalone proxy for Python. USDC on Base and Solana. Drop-in for FastAPI, Flask, Django, Starlette.

pypi license


Install

pip install limen
# With optional framework extras:
pip install "limen[fastapi]"
pip install "limen[django]"
pip install "limen[flask]"

Python 3.11+.


FastAPI quickstart

import os
from fastapi import FastAPI
from limen.fastapi import LimenMiddleware

app = FastAPI()
app.add_middleware(
    LimenMiddleware,
    wallets={"base": os.environ["LIMEN_WALLET_BASE"]},
    endpoints=[
        {"path": "/api/v1/weather/*", "price_usdc": "0.001"},
        {"path": "/api/v1/premium/**", "price_usdc": "0.05"},
    ],
    redis_url=os.environ["REDIS_URL"],
)


@app.get("/api/v1/weather/{city}")
def weather(city: str) -> dict:
    return {"city": city, "temp_c": 17}

Flask

from flask import Flask
from limen.flask import limen_middleware

app = Flask(__name__)
app.wsgi_app = limen_middleware(
    app.wsgi_app,
    wallets={"base": os.environ["LIMEN_WALLET_BASE"]},
    endpoints=[{"path": "/api/v1/*", "price_usdc": "0.001"}],
    redis_url=os.environ["REDIS_URL"],
)

Django

settings.py:

MIDDLEWARE = [
    "limen.django.LimenMiddleware",
    # ...
]

LIMEN = {
    "wallets": {"base": os.environ["LIMEN_WALLET_BASE"]},
    "endpoints": [{"path": "/api/v1/*", "price_usdc": "0.001"}],
    "redis_url": os.environ["REDIS_URL"],
}

Standalone proxy

limen start --config limen.config.yml --upstream http://localhost:3000

CLI

limen start        Run the proxy.
limen doctor       Check config + connectivity + ports.
limen verify       Verify a transaction against config.
limen config       lint | print | explain | migrate
limen keys         generate-webhook-secret | generate-admin-keypair
limen audit        verify | tail

Security

This package enforces the nine invariants listed in docs/security.md § 4. Report vulnerabilities privately — see SECURITY.md.

Full getting-started, API reference, scaling, compliance docs: ../../docs/.


Development

hatch env create
hatch run test     # pytest with coverage
hatch run lint     # ruff
hatch run typecheck  # mypy strict

License

MIT — see LICENSE.

Metadata

Release files for limenpay 0.1.0a2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for limenpay 0.1.0a2
File Size Uploaded Provenance Actions
limenpay-0.1.0a2.tar.gz 43.5 kB Without provenance Details for limenpay-0.1.0a2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for limenpay 0.1.0a2
File Interpreter ABI Platform Actions
limenpay-0.1.0a2-py3-none-any.whl Python 3 none any Details for limenpay-0.1.0a2-py3-none-any.whl

Total release size: 98.9 kB

Release files / limenpay-0.1.0a2.tar.gz

Download URL limenpay-0.1.0a2.tar.gz
Size 43.5 kB
Tags Source
SHA-256 checksum
How to use checksums
45c8e830287c22df0850ac98f787f7cbed37eb705c295559b1bf4c502bf34137
BLAKE2b-256 checksum
How to use checksums
1e9c11093e65716e354706a6827cb7bb21d3f6c874071104a823cf29f6010e59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / limenpay-0.1.0a2-py3-none-any.whl

Download URL limenpay-0.1.0a2-py3-none-any.whl
Size 55.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10abccbd8ea450b98f3409a2fd107c1f3bd16f160fde8943765c69774dc8a080
BLAKE2b-256 checksum
How to use checksums
bfd000727c212353f50974daadb52886cc819bee2956e73e064a8c18cc799a93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Security for limenpay 0.1.0a2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page