Astrai SDK – cost, routing, and privacy control layer for AI agents
Project description
Astrai SDK
Drop-in cost, routing, and privacy control layer for AI agents. Compatible with OpenAI-style clients.
Features
model="auto"smart routing (server-side) orprivacy_mode="local"to keep prompts on-device and route via BYOK.- Per-agent budget headers and
_astrai_metatracing with costs, savings, and reasons. - Lightweight local classifier for task type / complexity without sending content to Astrai.
Quickstart
from astrai import Astrai
client = Astrai(api_key="astrai_sk_...", privacy_mode="proxy")
resp = client.chat.completions.create(
model="auto",
messages=[{"role": "user", "content": "Classify: refund request"}],
)
print(resp.astrai.cost_usd, resp.astrai.routing_reason)
Local privacy mode
client = Astrai(
privacy_mode="local", # no prompt leaves your machine
byok_keys={"openai": "sk-..."}, # provider keys for direct dispatch
provider_endpoints={"openai": "https://api.openai.com/v1"},
)
resp = client.chat.completions.create(
messages=[{"role": "user", "content": "Write a haiku about Saturn"}],
)
print(resp.astrai.model_used)
Routing feedback (metadata only)
Report outcomes to improve routing without sharing content:
# POST /v1/routing/feedback with your Astrai key
License
Proprietary – see repository owner for terms.
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
astrai_sdk-0.1.0.tar.gz
(22.6 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 astrai_sdk-0.1.0.tar.gz.
File metadata
- Download URL: astrai_sdk-0.1.0.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b6f84393da469ed72af3b13cbcda5967abd52fcc449930ca881ea28d9919660
|
|
| MD5 |
a4da98d28c04097c75c1dd1eb12647f0
|
|
| BLAKE2b-256 |
300731b7420ce3a461c66b3cfa3bf7ba15c93d8ba46fe93730e6fae4518c0a37
|
File details
Details for the file astrai_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: astrai_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1acda54d7af34bdfdfc2c2498253c1dd0e9427b82eff8c573030714c4ae52ea9
|
|
| MD5 |
b7eba6651f1042e2918fd2d1b5b270ea
|
|
| BLAKE2b-256 |
ce461a0485f651aafc34add927ccd52cc28e8f9c8446ab44d89ab40730bfecd5
|