Official Python SDK for DAPP AI Cost Platform - Measure, verify, and standardize AI computational costs
Project description
DAPP SDK - Python
Official Python client for the DAPP AI Cost Platform. Measure, verify, and standardize AI computational costs across providers using Decentralized Compute Units (DCU).
Features
- Token Counting: Accurate token counting using official provider tokenizers
- DCU Calculation: Convert provider-specific costs to standardized DCU
- Markup Validation: Real-time tolerance breach detection
- Efficiency Ratios: Calculate and compare provider efficiency
- Carbon Footprint: Track sustainability metrics
- ROI Computation: Comprehensive cost-benefit analysis
Installation
pip install dapp-sdk
Quick Start
from dapp_sdk import DAPPClient
import os
# Initialize client
client = DAPPClient(
base_url=os.getenv("DAPP_API_URL", "https://your-production-domain.com"),
api_key="your-api-key"
)
# Count tokens with official tokenizers
result = client.count_tokens(
text="Hello, world!",
model="gpt-4"
)
print(f"Tokens: {result['tokenCount']}")
# Calculate DCU cost
dcu_result = client.calculate_dcu(
input_tokens=100,
output_tokens=50,
model="gpt-4",
provider="openai"
)
print(f"DCU Cost: {dcu_result['dcuCost']}")
Environment Variables
Set DAPP_API_URL to your DAPP platform URL:
export DAPP_API_URL=https://your-domain.com
Documentation
Full documentation available at docs.dapp-platform.com
Support
License
MIT License - see LICENSE file for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dapp_sdk-1.0.0.tar.gz.
File metadata
- Download URL: dapp_sdk-1.0.0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51f889261dbe2f7191e29d98cb304d6b29dc8b214695454fd80bfe997cc1457b
|
|
| MD5 |
a961707e5fc2574b3c526ac4acd85473
|
|
| BLAKE2b-256 |
dd05da2e6e83d4054465edcf0b04e7ec6c98cde8515ae522cf20f03285949fbd
|
File details
Details for the file dapp_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: dapp_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8847dab972e2f3b1cd66c5d9709aed036881112725ca1f38ecf778b4bdf0ebef
|
|
| MD5 |
82b9c8da5ac60f54e61029f7cdc20bf4
|
|
| BLAKE2b-256 |
08d09e1aef218ab728513b47fffc5c683ae1289ed29f73c8a52b2cae58e352ca
|