Overview
Visca AI Gateway provides enterprise-grade API key management with granular access control, usage limits, and comprehensive audit logging.Fine-Grained Access
Control which models, providers, and features each key can access
Usage Limits
Set spending caps, rate limits, and quota restrictions
Audit Logs
Track every request with complete audit trails
IAM Rules
Implement complex access policies with IAM-style rules
Creating API Keys
1
Navigate to API Keys
Go to your dashboard and click Create
API Key
2
Configure basic settings
- Name: Descriptive name (e.g., “Production App”, “Development”, “User Analytics”) - Description: Optional notes about the key’s purpose - Expiration: Set expiry date or never expire
3
Set permissions
Choose access level: - Full Access: All models and features - Read
Only: Only list models and view usage - Custom: Fine-grained control
(recommended)
4
Configure limits
Set usage restrictions: - Rate Limit: Requests per minute/hour/day -
Budget: Maximum spending per day/month - Quota: Total requests
allowed
5
Save and copy
IAM-Style Access Control
Define precise access policies using IAM-style rules:Allow Specific Models
Restrict by Provider
Time-Based Access
Budget-Based Restrictions
Usage Limits
Rate Limiting
Control request frequency:- Per Minute
- Per Hour
- Per Day
Spending Limits
Set budget caps:Token Quotas
Limit token usage:Security Best Practices
Key Rotation
Key Rotation
Rotate API keys regularly:Recommended rotation schedule: Every 90 days
1
Create new key
Generate a new API key with same permissions
2
Update applications
Deploy new key to all applications
3
Monitor usage
Verify new key is working correctly
4
Revoke old key
Delete the old key after confirming migration
Environment Isolation
Environment Isolation
Use separate keys for each environment: ```bash # Development
VISCA_API_KEY_DEV=vsk_dev_… # Staging VISCA_API_KEY_STAGING=vsk_staging_…
Production VISCA_API_KEY_PROD=vsk_prod_… ``` Configure different limits
for each: - Dev: Unlimited, all models - Staging: Production-like limits - Production: Strict limits, monitoringSecret Storage
Secret Storage
Never commit keys to version control! Use secure storage: - AWS Secrets
Manager - Azure Key Vault - HashiCorp Vault - Google Secret Manager -
Environment variables (with encryption)
python # Good ✅ api_key = os.environ.get("VISCA_API_KEY") # Bad ❌ api_key = "vsk_1234567890abcdef" Monitoring & Alerts
Monitoring & Alerts
Set up alerts for:
- Budget thresholds reached
- Unusual usage patterns
- Rate limit exceeded
- Failed authentication attempts
- Key compromises detected
Audit Logging
Track all API key usage with comprehensive logs:View Audit Logs
Log Contents
Each log entry includes:Multi-Tenant API Keys
Create hierarchical key structures for organizations:Organization-Level Keys
Team-Level Keys
User-Level Keys
Temporary Keys
Generate short-lived keys for specific use cases:IP Allowlisting
Restrict key usage to specific IP addresses:Webhooks for Key Events
Receive notifications about key activities:Managing Keys Programmatically
Create API Key
List All Keys
Revoke API Key
Update Key Permissions
Troubleshooting
401 Unauthorized
401 Unauthorized
403 Forbidden
403 Forbidden
Causes: - Insufficient permissions - Model not allowed - Budget/quota
exceeded Solution: - Check IAM policy - Review usage limits - Contact
admin for access
429 Rate Limit
429 Rate Limit
Causes: - Too many requests - Burst limit exceeded Solution: -
Implement exponential backoff - Request rate limit increase - Distribute load
across time
Budget Exceeded
Budget Exceeded
Causes:
- Monthly/daily budget reached
- Unexpected usage spike
- Review budget settings
- Analyze usage patterns
- Request budget increase
- Use cost-optimized routing