semvec/pypi-packages huggingface dataset:
astrai-sdk 0.2.0
AI inference in your terminal. PII-stripped, compliance-logged, cost-optimized.
License: MIT
Requires Python: >=3.9
Keywords: ai, llm, inference, cli, compliance, pii, privacy, routing

# 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