SunLicenseSign in
For Python script and tool sellers

Selling a Python tool? Give every buyer a key.

One SDK call. Keys from your store, machine limits, refunds off.

Create free account

Free plan · No credit card · Set up in minutes

Coding with an AI agent? Paste one prompt
  • Python
  • Gumroad
  • Lemon Squeezy
  • Ko-fi
  • Payhip
  • Stripe
  • Windows
  • macOS
  • Linux
What you get

Built for how you sell.

pip install sunlicense

Standard library only, Python 3.8+.

result.valid

Machine limits

1, 2 or 5 machines per license.

TOO_MANY_MACHINES

Keys from your store

Gumroad, Lemon Squeezy, Payhip, Ko-fi or Stripe.

Subscriptions and trials

Ended subscriptions suspend the key.

Offline license files

Signed, checked with your public key.

Ed25519

Key inside the zip

Portal downloads carry each buyer's key.

Standard
How it works

Live before your next release.

  1. 1Create a free account
  2. 2Connect your store
  3. 3pip install, check on start
yourtool/license.py
import platform
import sys

from sunlicense import SunLicense  # pip install sunlicense

client = SunLicense(base_url="https://api.sunlicense.com",
                    token="slk_...")  # API key: validation only, safe to ship

def require_license(key: str) -> None:
    result = client.validate(key, host=platform.node())
    if not result.valid:  # result.data["code"] says why, e.g. TOO_MANY_MACHINES
        sys.exit("License not valid. Manage your key at yourtool.example/account")
FAQ

Questions, answered.

How do I add a license key to a Python script?

Run pip install sunlicense, create an API key in the dashboard, and call client.validate(key, host=machine_id) when your tool starts. It returns valid, the HTTP status and the JSON answer with a code such as EXPIRED or TOO_MANY_MACHINES. The SDK uses only the standard library, so there are no extra dependencies to bundle.

Can't buyers just delete the check from a .py file?

Someone determined can: Python source can be edited, and packaging with PyInstaller only makes that harder. A key check stops casual sharing and refunded copies. Anything your tool does on your own server, such as an API it calls, can check the key there, where it can't be removed.

Can I sell my tool as a subscription?

Yes. Use a subscription policy and connect the store: when a Gumroad membership, a Lemon Squeezy subscription or a Stripe subscription ends, the store tells SunLicense and the key is suspended. SunLicense handles the licensing only; what your tool does is up to you.

Is it free?

Yes. The Free plan covers three products, 100 licenses and 10,000 license checks a month, with no credit card. Paid plans start at $5 a month, and your buyers' license checks keep working even if you go over a limit.

Protect your next release.

  • Free plan
  • No credit card
  • Cancel any time