Skip to main content

Self-hosted, non-custodial Bitcoin Lightning payments for autonomous AI agents — your node, your keys, your rules.

Project description

conduit-btc

Python SDK for Conduit — self-hosted, non-custodial Bitcoin Lightning payment infrastructure for autonomous AI agents.

Your node, your keys, your rules. Conduit is software tooling that you run on your own infrastructure, against your own LND node, with your own keys. It never touches your funds — it's a thin client for your Conduit instance.

pip install conduit-btc

The importable package is conduit:

from conduit import Agent

Quickstart

Point the SDK at the Conduit instance you deployed (a 5-minute Docker deploy against your own LND node), create an agent, and send a payment:

import conduit
from conduit import Agent

# Connect to YOUR self-hosted Conduit instance
conduit.api_key = "ck_live_..."              # an API key from your instance
conduit.base_url = "https://conduit.example.com"  # your Conduit URL

# Create an autonomous wallet with an optional spending policy
agent = Agent.create(name="compute-router-7", daily_limit=50_000)

agent.policy.attach(
    max_per_hour=10_000,
    allowlist=["02beef..."],
)

# Send a Lightning payment
receipt = agent.pay(
    to="compute-node-7@lnd.example.com",
    sats=150,
    memo="dataset query",
)

print(receipt.hash, receipt.settled_in_ms)
print(receipt.fee_sats, receipt.platform_fee_sats)

Client-centric API (ConduitClient)

Prefer a single client object with explicit methods over the Agent active-record style? ConduitClient wraps the same retrying, idempotent HTTP client and adds operator funding (credit_agent) — from pip install to a settled payment in a few lines:

from conduit import ConduitClient

client = ConduitClient(base_url="https://conduit.example.com", api_key="ck_live_...")

agent = client.create_agent("compute-router-7")
client.credit_agent(agent.id, sats=10_000)            # operator funds the agent

receipt = client.send_payment(agent.id, dest_pubkey="02beef...", sats=500)
print(receipt.status, receipt.platform_fee_sats)      # 'settled', 2

print(client.get_balance(agent.id).available)         # spendable sats
for tx in client.list_transactions(agent.id):
    print(tx.direction, tx.amount_sats, tx.status)

Both styles talk to the same instance — use whichever you prefer.

Platform fee on receipts

Every payment receipt includes a platform_fee_sats field — the per-transaction platform fee in satoshis configured by the operator who deployed the instance. It is separate from fee_sats (the LND routing fee):

  • fee_sats — the Lightning Network routing fee paid to route the payment.
  • platform_fee_sats — the operator's usage-based revenue, charged on top, kept on settle, and refunded in full if the payment fails.

The fee is configured on your instance via PLATFORM_FEE_PERCENT (default 0.5%), PLATFORM_FEE_MIN_SATS (default 1), and PLATFORM_FEE_MAX_SATS (default 1000).

receipt = agent.pay(to="...", sats=10_000)
print(receipt.amount_sats)        # 10000
print(receipt.fee_sats)           # LND routing fee
print(receipt.platform_fee_sats)  # your platform's per-tx revenue

Configuration

The SDK reads CONDUIT_API_KEY and CONDUIT_API_URL (default https://api.conduit.energy, the hosted demo console) from the environment. Set CONDUIT_API_URL to the URL of your own Conduit deployment.

export CONDUIT_API_KEY=ck_live_xxxxxxxxxxxxx
export CONDUIT_API_URL=https://conduit.example.com

or explicitly in code:

import conduit
conduit.api_key = "ck_live_..."
conduit.base_url = "https://conduit.example.com"

Errors

from conduit import PolicyViolation, InsufficientBalance, PaymentFailed

try:
    agent.pay(to=..., sats=...)
except PolicyViolation as e:
    print(e.code, e.message)  # e.g. "DAILY_LIMIT_EXCEEDED"

See the full error code list in the API docs.

Links

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

conduit_btc-0.8.4.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

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

conduit_btc-0.8.4-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file conduit_btc-0.8.4.tar.gz.

File metadata

  • Download URL: conduit_btc-0.8.4.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for conduit_btc-0.8.4.tar.gz
Algorithm Hash digest
SHA256 9426d8e60fc03408fa125706dc0396a0ab45f45e094826eab07b120f73cab0ed
MD5 3b094083ce423871ee2d5b3607a9f5f7
BLAKE2b-256 d8cd8a5f697847c36a0e5d41a340f527d5831f4a42700f5d139dff6fc23f6bda

See more details on using hashes here.

File details

Details for the file conduit_btc-0.8.4-py3-none-any.whl.

File metadata

  • Download URL: conduit_btc-0.8.4-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for conduit_btc-0.8.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ee7ea62f50bf4539d6ade5b32b40f41e7fc155dd5ef7939627e1f3fc89b592c4
MD5 b61ec37fcff5c08d346e73b3a46720d7
BLAKE2b-256 d559ef77fe69588243aa5792129ebe5519b4b4fc1eee017eff70e077bc54e2c4

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