Overview
For HTTP header details and request examples, see /en/api/rest/authentication.
Authentication Modes
Development Mode (Default)
- No API key required
- All requests are accepted
- Useful for local testing and development
Production Mode
- API key required for all requests
- Invalid keys return 401 Unauthorized
- Rate limiting enforced per key
API Key Format
Shannon uses prefixed API keys:Creating API Keys
Via Command Line
Via API
Rate Limiting
Shannon enforces rate limits per API key using a fixed-window counter:Default Limits
Token budgets and concurrent task limits are enforced at the workflow level by the orchestrator, not at the gateway layer.
Rate Limit Headers
Responses include current window limits. On 429,Retry-After is set:
Rate Limit Exceeded
When you exceed the rate limit:Handling Rate Limits
Implement exponential backoff:Multi-Tenancy
Shannon supports multi-tenant deployments with tenant isolation:Tenant ID
Include tenant ID in requests:Tenant Isolation
Each tenant has:- Isolated session storage
- Per-tenant isolation via payload filters (
tenant_id) within shared Qdrant collections - Independent budget tracking
- Dedicated metrics
OPA Policy Enforcement
Shannon uses Open Policy Agent for fine-grained access control:Policy Structure
Policy Modes
Configure inconfig/shannon.yaml:
enforce: Deny requests that violate policiesdry-run: Log violations but allow requestsoff: Disable policy enforcement
Example: Restricting Models
Security Best Practices
1. Rotate Keys Regularly
2. Use Environment Variables
3. Enable HTTPS in Production
4. Monitor API Key Usage
Track usage in Prometheus metrics:5. Implement IP Whitelisting
Troubleshooting
403 Forbidden
403 Forbidden
Cause: Valid API key but insufficient permissions (OPA policy)Solution: Check OPA policy logs:
429 Rate Limited
429 Rate Limited
Cause: Exceeded rate limitsSolution: Implement retry logic with exponential backoff:
API key not working
API key not working
Cause: Key may be expired or revokedSolution: Create a new test key:
Next Steps
Submit Tasks
Learn how to submit tasks with authentication
Rate Limiting
Understand rate limits and quotas
Python SDK
Use SDK for automatic authentication
REST API Reference
Complete REST API documentation