Metadata-Version: 2.4
Name: astrai-sdk
Version: 0.2.0
Summary: AI inference in your terminal. PII-stripped, compliance-logged, cost-optimized.
Author-email: Astrai <hello@as-trai.com>
License: MIT
Project-URL: Homepage, https://as-trai.com
Project-URL: Documentation, https://as-trai.com/docs
Project-URL: Source, https://github.com/beee003/astrai-cli
Keywords: ai,llm,inference,cli,compliance,pii,privacy,routing
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: License :: OSI Approved :: MIT License
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.27.0
Requires-Dist: spacy>=3.7.0
Provides-Extra: openai
Requires-Dist: openai>=1.12.0; extra == "openai"
Provides-Extra: cli
Requires-Dist: click>=8.1.0; extra == "cli"
Requires-Dist: rich>=13.7.0; extra == "cli"
Requires-Dist: jinja2>=3.1.0; extra == "cli"
Requires-Dist: pyyaml>=6.0; extra == "cli"
Requires-Dist: huggingface-hub>=0.20.0; extra == "cli"

# Astrai — Compliant LLM Gateway

PII stripping, audit logs, multi-model routing. Built for regulated industries.

```bash
pip install astrai
```

## Quick Start

```bash
# Configure your API key
astrai config --api-key YOUR_KEY

# Chat with the best model (auto-routed)
astrai chat "What is risk parity?"

# Use a specific model
astrai chat -m claude-opus-4.5 "Explain Black-Scholes"

# Export audit log for compliance
astrai audit --days 30 -o audit.json
```

## Commands

| Command | Description |
|---------|-------------|
| `astrai chat` | Send a chat message (streaming) |
| `astrai models` | List available models and pricing |
| `astrai health` | Model health dashboard |
| `astrai usage` | Usage statistics and spend |
| `astrai audit` | Export compliance audit log |
| `astrai preferences` | View learned routing preferences |
| `astrai config` | Configure API key, model, strategy |

## Features

- **Auto-routing**: Automatically picks the best model for cost/quality/latency
- **PII stripping**: Sensitive data is stripped before reaching external models
- **Audit logs**: Every request is logged with model, cost, latency, routing reason
- **BYOK**: Bring your own API keys per provider
- **Fallback chains**: Claude -> GPT -> Llama automatic failover
- **EU routing**: Route to EU-based providers for GDPR compliance

## Models

| Tier | Models | Use Case |
|------|--------|----------|
| Ultra | claude-opus-4.5, gpt-5.2, gemini-3-pro | Complex analysis |
| Target | llama-4-maverick, deepseek-v3.2, llama-3.3-70b | General use |
| Draft | llama-4-scout, gemini-3-flash | Fast/cheap tasks |
| Reasoning | o3, deepseek-r1 | Multi-step reasoning |

## Environment Variables

| Variable | Description |
|----------|-------------|
| `ASTRAI_API_KEY` | Your Astrai API key |
| `ASTRAI_API_URL` | Custom API endpoint |
| `ASTRAI_MODEL` | Default model override |

## For Compliance Officers

Export a complete audit trail of all AI model usage:

```bash
# JSON export for the last 30 days
astrai audit --days 30 --format json -o compliance_report.json

# Weekly CSV export
astrai audit --days 7 --format csv -o weekly_audit.csv
```

Each audit record includes:
- Timestamp, model used, provider
- Routing reason (cost, quality, preference)
- Token count, cost, latency
- Task type classification
