ShaarAI SDK - The AI Revenue Control Plane. Track AI vendor attribution and ROI.
Project description
ShaarAI Python SDK
The AI Revenue Control Plane - Track which AI vendor actually drives your revenue.
Install
pip install shaarai
Quick Start
from shaarai import ShaarClient, TokenUsage
# Initialize with your API key from https://shaar.ai
client = ShaarClient(api_key="shaar_your_key_here")
# 1. Get offers to show in your AI chatbot
offers = client.get_offers(
ai_vendor="openai", # or "anthropic", "gemini"
category="saas",
model="gpt-4-turbo",
usage=TokenUsage(input_tokens=1200, output_tokens=500)
)
# 2. Show offers to users (tracking_url includes attribution)
for offer in offers:
print(f"{offer.name}: {offer.tracking_url}")
# 3. Report conversions when users take action
client.report_conversion(
token="shaar_token_from_tracking_url",
conversion_type="purchase",
value=99.00
)
OpenAI Function Calling
from openai import OpenAI
from shaarai import ShaarClient
openai = OpenAI()
shaar = ShaarClient(api_key="shaar_...")
# Get the tool schema
tool_schema = shaar.get_tool_schema("openai")
# Use it with OpenAI
response = openai.chat.completions.create(
model="gpt-4-turbo",
messages=[{"role": "user", "content": "Find me a CRM tool"}],
tools=[tool_schema],
tool_choice="auto",
)
What ShaarAI Tracks
| Metric | Description |
|---|---|
| Impressions | How many users saw each AI-powered offer |
| Conversions | How many users took action (purchase, signup, etc.) |
| ROI | Return on AI investment per vendor |
| CPA | Cost per acquisition by AI vendor |
| ROAS | Return on AI spend |
Links
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
shaarai-0.1.0.tar.gz
(4.0 kB
view details)
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 shaarai-0.1.0.tar.gz.
File metadata
- Download URL: shaarai-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39f0552743aaf2fdb6dda0e7fd65189a7397d7fe0e85eb1f3451460bf1be9840
|
|
| MD5 |
6accd5090e967b6f702ce00b004c446d
|
|
| BLAKE2b-256 |
3d23529ecd1f8efb91201cd0cd6bb96c7667ec4b11d97ad397663ba18f18e8b2
|
File details
Details for the file shaarai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: shaarai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f6478999d326c8fe1f876aea1f149de670f598ce52907d6c8d22d44a5eb80e0
|
|
| MD5 |
fdec02d9db35e65529cfc4ca2c9b8df7
|
|
| BLAKE2b-256 |
c26ca1652ca5e375727d11380e917113282bb4bd5321a9524a8f30f0002848d8
|