Skip to main content

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..."],
)

# Fund the agent from your node's liquidity (operator/admin action)
agent.credit(1_000)

# 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

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.9.0.tar.gz (22.5 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.9.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: conduit_btc-0.9.0.tar.gz
  • Upload date:
  • Size: 22.5 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.9.0.tar.gz
Algorithm Hash digest
SHA256 7acb4be9d33314cb894bd5e222d8f468a41e27402a0992d993568ceb5c6facf0
MD5 5b5cc6e37227838e6a204293478d52f9
BLAKE2b-256 b2cf21c1dad4514970db51e2d178a257359f588ba01e46b9b5e0d06b132ca3d0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: conduit_btc-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 19.5 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.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3ef8786a3db01d57c86a4cf3546c6d7981407e089ba77126f717046b873c9a0
MD5 73a8286fc18606a62ad80e047b266018
BLAKE2b-256 552dd0cbd82044887abdde25e7eae83c4c582a94fcba4b92b16535a931206154

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 Sentry Error logging StatusPage Status page