Skip to main content

Overview

For HTTP header details and request examples, see /en/api/rest/authentication.
Shannon supports API key authentication to secure access to the orchestration platform. Authentication is disabled by default for easy local development and can be enabled for production deployments.

Authentication Modes

Development Mode (Default)

In development mode:
  • No API key required
  • All requests are accepted
  • Useful for local testing and development

Production Mode

In 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:
Never commit API keys to version control or share them publicly.

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 in config/shannon.yaml:
Modes:
  • enforce: Deny requests that violate policies
  • dry-run: Log violations but allow requests
  • off: 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

Cause: Missing or invalid API keySolution:
Cause: Valid API key but insufficient permissions (OPA policy)Solution: Check OPA policy logs:
Cause: Exceeded rate limitsSolution: Implement retry logic with exponential backoff:
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