Skip to content

smq9sn5jck-coder/kindl-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kindl-sdk — Get paid every time an AI agent uses your tool

kindl-sdk is the official Python SDK for Kindl, the protocol-neutral payment rail for autonomous software (MCP, A2A, OpenAPI, GPT Actions, Claude Skills, raw HTTP) over both Stripe and x402 (USDC on Base).

pip install kindl-sdk

The install name is kindl-sdk (the bare name kindl is reserved on PyPI). The import name is still kindl:

from kindl import meter

Two lines of code

from kindl import meter

@meter(tool="search_legal_db", server_key="ksk_live_xxx", price_cents=2)
def search_legal_db(query: str, *, consumer_key: str | None = None):
    return run_search(query)

That's it. Kindl handles:

  • API-key auth (ksk_… server key, kck_… consumer key)
  • Per-call billing (price set in your Kindl console)
  • HTTP 402 Payment Required on zero-balance consumers
  • Logging every call to your dashboard
  • Stripe Connect payouts (95% to creator, 5% platform fee)

Consumer-side (paying for tool calls from an agent)

from kindl import call, PaymentRequired

try:
    result = call(
        server_key="ksk_live_xxx",
        consumer_key="kck_live_xxx",
        tool="search_legal_db",
        args={"query": "GDPR for solo founders"},
    )
    print(result.cost_cents, result.remaining_balance_cents)
except PaymentRequired as e:
    # top up via Stripe and retry
    print("HTTP 402:", e, "remaining:", e.remaining_balance_cents)

Where the consumer key comes from

In order:

  1. The consumer_key= keyword argument on each call.
  2. The KINDL_CONSUMER_KEY environment variable.
  3. The x-kindl-consumer-key HTTP header (pass http_headers=req.headers from inside FastAPI / MCP runtimes).

Configuration

from kindl import configure
configure("https://YOUR-KINDL-INSTANCE")   # or set KINDL_BASE_URL env

Apache-2.0 licensed. Source: https://github.com/smq9sn5jck-coder/kindl-sdk

About

💰 Get paid every time an AI agent uses your MCP tool. Two lines of code. Usage-based billing for the agentic economy.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages