AI inference in your terminal. PII-stripped, compliance-logged, cost-optimized.
pip install astrai
export ASTRAI_API_KEY=your_key_here
astrai chat "explain this Q function"Your team is already using ChatGPT on personal accounts. You know it.
Astrai gives them the same thing — in the terminal, where they work — but every query is PII-stripped, audit-logged, and routed through approved providers.
- PII stripping — proprietary code never hits provider servers raw
- Compliance audit log — exportable CSV for regulators
- EU/GDPR routing — restrict to European providers only
- Cost optimization — smart routing saves 40-60% vs direct API
- Any model — Claude, GPT, Gemini, DeepSeek, Mistral, local models
- On-prem deployment —
astrai deployfor air-gapped environments
astrai chat "write a momentum strategy in Python"
astrai chat -m claude-sonnet-4-5-20250929 "review this code for security issues"
astrai chat --privacy enhanced "analyze this proprietary algorithm"
astrai chat --region eu "process this customer data"cat strategy.q | astrai chat "optimize this Q code for memory usage"
git diff | astrai chat "review these changes"
echo "select from trade where sym=\`AAPL" | astrai chat "explain this query"$ astrai chat
astrai interactive mode (ctrl+d to exit)
model: auto | privacy: standard | region: any
astrai> explain the difference between aj and wj in kdb+pip install astrai[cli]
astrai deploy --mode local --profile fundGenerates Docker Compose files, pulls model weights, and starts a fully local inference stack. No data leaves your network.
from astrai import Astrai
# Drop-in OpenAI replacement
client = Astrai(budget_limit=5.00)
response = client.chat.completions.create(
messages=[{"role": "user", "content": "Optimize this Q query"}],
model="auto", # Astrai picks best model for the task
)
print(response.choices[0].message.content)
print(response.astrai.cost_usd) # What you paid
print(response.astrai.provider_used) # Which provider was selectedfrom astrai import AstraiAgent
agent = AstraiAgent(
agent_id="quant-research",
budget_limit=10.00,
region="eu",
)
response = agent.chat("Write a pairs trading strategy")
print(agent.spend) # $0.003
print(agent.remaining) # $9.997# Required
export ASTRAI_API_KEY=your_key_here
# Optional
export ASTRAI_BASE_URL=https://as-trai.com/v1
export ASTRAI_MODEL=auto
export ASTRAI_PRIVACY=standard # standard|enhanced|max
export ASTRAI_REGION=any # any|eu|us| Mode | PII Stripping | Server Logging | Use Case |
|---|---|---|---|
standard |
No | Full | Development, testing |
enhanced |
Yes | Metadata only | Production, sensitive code |
max |
Yes | None | Regulated industries, EU |
- Free: 50 requests/day, standard privacy
- Pro ($49/mo): Unlimited, enhanced privacy, EU routing, PII stripping
- Enterprise ($999/mo): Team accounts, compliance exports, SLA, on-prem support
Get a free key at as-trai.com