forge-sdk
Python SDK for the Forge compute economy. AI agents earn and spend Compute Units.
Install
pip install forge-sdk
Quick Start
from forge_sdk import ForgeClient
forge = ForgeClient() # connects to localhost:3000
# Check your CU balance
balance = forge.balance()
print(f"Balance: {balance['effective_balance']} CU")
# Run inference (costs CU)
result = forge.chat("What is gravity?")
print(f"Answer: {result['content']}")
print(f"Cost: {result['cu_cost']} CU")
print(f"Remaining: {result['balance']} CU")
Autonomous Agent
from forge_sdk import ForgeAgent
agent = ForgeAgent(max_cu_per_task=500)
while agent.has_budget():
result = agent.think("What should I do next?")
if result is None:
break # budget exhausted
print(result['content'])
print(agent.status())
API
| Method | Description |
|---|---|
forge.balance() |
CU balance, reputation |
forge.pricing() |
Market price, cost estimates |
forge.chat(prompt) |
Run inference, pay CU |
forge.can_afford(tokens) |
Check before spending |
forge.trades() |
Trade history |
forge.network() |
Mesh economic state + Merkle root |
forge.providers() |
Ranked providers by cost/reputation |
forge.safety() |
Kill switch, circuit breaker status |
forge.kill(reason) |
Emergency halt |
forge.invoice(cu) |
Create Lightning invoice |
Environment
| Variable | Default | Description |
|---|---|---|
FORGE_URL |
http://127.0.0.1:3000 |
Forge node URL |
FORGE_API_TOKEN |
(none) | Bearer token for protected nodes |
What is Forge?
Forge is a distributed inference protocol where compute is currency. Unlike Bitcoin (useless SHA-256 hashes), Forge nodes earn CU by performing useful LLM inference. AI agents can autonomously earn, spend, and manage their compute budget.
Metadata
Release files for forge-sdk 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| forge_sdk-0.2.0.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| forge_sdk-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.9 kB
Release files / forge_sdk-0.2.0.tar.gz
| Download URL | forge_sdk-0.2.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a94629622d924db61c3bdc495e825425290fc485b6021fa2c6db47425f80a74e
|
|
BLAKE2b-256 checksum How to use checksums |
64a91f74d9fb7945df4a7102a8c8b50e251057e2bb96a8f84bdbd8ab11648dc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / forge_sdk-0.2.0-py3-none-any.whl
| Download URL | forge_sdk-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5c42fc2d0c926cea59ae2b0407deb2e67e994bc621f4030f45aa8f1eb64f2bd
|
|
BLAKE2b-256 checksum How to use checksums |
2c02534bf56a12ebc80db7d5509cbf0b80d883ab84e31c4d05143330b4564545
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|