API Reference
Complete API documentation for Aqta.
Base URLs
- Production:
https://api.aqta.ai - Staging:
https://staging-api.aqta.ai - Local:
http://localhost:8000
Authentication
All API requests require an API key in the Authorisation header:
Authorisation: Bearer sk-aqta-YOUR_KEY_HERE
Get your API key from the dashboard: Settings → API Keys
See Authentication guide for detailed authentication.
OpenAI-Compatible Endpoints
Chat Completions
OpenAI-compatible chat endpoint
POST /v1/chat/completions
Supports streaming, multiple providers (OpenAI, Anthropic, Google, Perplexity).
Models
List available models
GET /v1/models
Aqta-Specific Endpoints
Authentication
User authentication and session management
POST /api/auth/login # Email/password login POST /api/auth/signup # Email/password signup POST /api/auth/oauth-signin # OAuth signup (Google, Microsoft) POST /api/auth/logout # Logout GET /api/auth/me # Get current user
API Keys
API key management
GET /api/keys # List API keys POST /api/keys # Create new API key DELETE /api/keys/{key_id} # Delete API key
Analytics
Request history and analytics (Starter tier and above)
GET /api/analytics/requests # Get request analytics GET /api/analytics/costs # Get cost analytics
Compliance
Compliance and audit trail (Healthcare tier)
GET /api/compliance/audit-trail # Get audit trail GET /api/compliance/bias-detection # Get bias detection results POST /api/compliance/report # Generate compliance report
Healthcare
Medical receipt management (Healthcare tier)
GET /api/health/receipts # List receipts GET /api/health/receipts/{id} # Get receipt details POST /api/health/receipts/{id}/verify # Verify receipt GET /api/health/receipts/export # Export receipts
Response Format
Success Response
{ "id": "chatcmpl-123", "object": "chat.completion", "created": 1677652288, "model": "gpt-4", "choices": [{ "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help you?" }, "finish_reason": "stop" }], "usage": { "prompt_tokens": 10, "completion_tokens": 8, "total_tokens": 18 }, "aqta": { "cost_eur": 0.00001, "provider": "openai", "cached": false, "loop_detected": false } }
Error Response
{ "error": { "message": "Invalid API key", "type": "authentication_error", "code": "invalid_api_key" } }
Error Codes
| Code | Status | Description |
|---|---|---|
invalid_api_key | 401 | API key is invalid or expired |
rate_limit_exceeded | 429 | Too many requests |
quota_exceeded | 402 | Monthly quota reached |
loop_detected | 429 | Infinite loop detected |
provider_error | 502 | Upstream provider error |
invalid_request | 400 | Malformed request |
Rate Limits
| Tier | Requests/Month | Rate Limit | Models | Price |
|---|---|---|---|---|
| Free | 500 | 5/min | GPT-3.5 only | €0 |
| Starter | 100,000 | 100/min | All models | €49 |
| Pro | 1,000,000 | 1,000/min | All models | €149 |
| Healthcare | 1,000,000 | 1,000/min | All models | €999 |
See Rate limits for detailed rate limit documentation.
SDKs
Official SDKs
- Python SDK:
pip install aqta(coming soon) - JavaScript SDK:
npm install aqta(coming soon)
Using OpenAI SDKs
Aqta is compatible with OpenAI SDKs. Simply change the base URL:
Python:
import openai openai.api_base = "https://api.aqta.ai/v1" openai.api_key = "sk-aqta-YOUR_KEY" response = openai.ChatCompletion.create( model="gpt-4", messages=[{"role": "user", "content": "Hello!"}] )
JavaScript:
import OpenAI from 'openai'; const openai = new OpenAI({ baseURL: 'https://api.aqta.ai/v1', apiKey: 'sk-aqta-YOUR_KEY', }); const response = await openai.chat.completions.create({ model: 'gpt-4', messages: [{ role: 'user', content: 'Hello!' }], });
Examples
cURL
curl https://api.aqta.ai/v1/chat/completions \ -H "Authorisation: Bearer sk-aqta-YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4", "messages": [{"role": "user", "content": "Hello!"}] }'
Python with Streaming
import openai openai.api_base = "https://api.aqta.ai/v1" openai.api_key = "sk-aqta-YOUR_KEY" response = openai.ChatCompletion.create( model="gpt-4", messages=[{"role": "user", "content": "Tell me a story"}], stream=True ) for chunk in response: if chunk.choices[0].delta.get("content"): print(chunk.choices[0].delta.content, end="")
JavaScript with Error Handling
try { const response = await fetch('https://api.aqta.ai/v1/chat/completions', { method: 'POST', headers: { 'Authorisation': 'Bearer sk-aqta-YOUR_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'gpt-4', messages: [{role: 'user', content: 'Hello!'}] }) }); if (!response.ok) { const error = await response.json(); console.error('API Error:', error.error.message); return; } const data = await response.json(); console.log(data.choices[0].message.content); } catch (error) { console.error('Network Error:', error); }
Features by Tier
Free (€0/month)
- ✅ 500 requests/month
- ✅ GPT-3.5 & cheap models only
- ✅ Loop detection
- ✅ Basic monitoring
- ✅ 5 requests/minute
- ❌ GPT-4 or expensive models
- ❌ Analytics
- ❌ Compliance features
Starter (€49/month)
- ✅ 100,000 requests/month
- ✅ All models (GPT-4, Claude 3.5, etc.)
- ✅ Loop detection
- ✅ Cost tracking
- ✅ Analytics dashboard
- ✅ Email support
- ❌ Compliance features
Pro (€149/month)
- ✅ 1,000,000 requests/month
- ✅ All models
- ✅ Advanced analytics
- ✅ Priority support
- ✅ Custom rate limits
- ❌ Healthcare compliance
Healthcare (€999/month)
- ✅ 1,000,000 requests/month
- ✅ All models
- ✅ HIPAA-ready audit trail
- ✅ Bias detection
- ✅ Compliance reporting
- ✅ Dedicated support
- ✅ SLA guarantee
Webhooks
Coming soon: Real-time notifications for events like:
- Loop detection
- Budget alerts
- High-risk healthcare decisions
- Compliance violations
Support
- Documentation: Authentication | Endpoints | Rate Limits
- Email: hello@aqta.ai
- Dashboard: app.aqta.ai
Questions? Contact us at hello@aqta.ai