Metadata-Version: 2.4
Name: bridgenode-llm
Version: 0.2.7
Summary: BridgeNode LLM client — AI inference with x402 payment on Solana USDC. No API keys, no registration.
Author-email: BridgeNode <eli.BNx@proton.me>
License-Expression: MIT
Project-URL: Homepage, https://bridgenode.cc
Project-URL: Repository, https://github.com/applefanaimail-blip/bridgenode-llm
Project-URL: Documentation, https://bridgenode.cc/llms.txt
Keywords: x402,solana,usdc,ai,llm,mcp,agents,payment,bridgenode
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: x402[svm]>=2.18.0
Requires-Dist: x402[extensions]>=2.18.0
Requires-Dist: solana<0.40,>=0.36.0
Requires-Dist: httpx>=0.28.1
Requires-Dist: python-dotenv>=1.2.2
Provides-Extra: dev
Requires-Dist: pytest>=9.1.1; extra == "dev"

# bridgenode-llm

BridgeNode Python SDK — AI inference without API keys. Payment: **Solana USDC via x402** (automatic handshake, fee sponsorship — no SOL needed for the agent).

## Installation

```bash
pip install bridgenode-llm
```

## Usage

```python
from bridgenode_llm import LLMClient

client = LLMClient()  # key from .env (BRIDGENODE_WALLET_KEY)
resp = client.chat("deepseek-v4-flash", [
    {"role": "user", "content": "Hello!"}])
print(resp["choices"][0]["message"]["content"])
```

Everything is handled automatically: `402 → partial TX → PAYMENT-SIGNATURE → 200` (§4.1). No API key required.

## .env

```bash
# Required — your Solana wallet private key (base58)
BRIDGENODE_WALLET_KEY=...
# Optional:
# BRIDGENODE_BASE_URL=https://bridgenode.cc/v1
# BRIDGENODE_MAX_PER_CALL=0.05   # spending policy: max USD per call (fail-closed)
# BRIDGENODE_DAILY_CAP=1.0       # spending policy: max USD per day
```

## Security

- **Receipt verification (Free-Riding protection):** after 200, `PAYMENT-RESPONSE` is verified — success, network, payer, fee payer signature over our TX message, amount. Invalid receipt → `BridgenodeError`.
- **Spending policy (fail-closed):** `BRIDGENODE_MAX_PER_CALL` + `BRIDGENODE_DAILY_CAP` — checked BEFORE signing; exceeded → blocked, no payment.
- **SIWX:** automatic known-agent identification (§5.7) — falls back to payment if auth fails.

## Commands

```python
client.chat(model, messages, max_tokens=..., mode="auto")  # mode: auto/eco/premium
```

## Requirements

- Python ≥ 3.11
- Solana wallet with USDC ATA (rent — agent's responsibility, §3.3)

## Links

- Website: https://bridgenode.cc
- Protocol: x402 V2 (docs.x402.org)
