Overview
The Dedalus Go SDK supports multiple authentication methods using API keys. You can configure authentication using environment variables or by passing options directly to the client.Environment Variables
The SDK automatically reads authentication credentials from the following environment variables:DEDALUS_API_KEY
DEDALUS_API_KEY
Primary API key for authenticating with the Dedalus API. This is passed as a Bearer token in the
Authorization header.DEDALUS_X_API_KEY
DEDALUS_X_API_KEY
Alternative API key passed in the
x-api-key header. Some endpoints may require this in addition to or instead of the primary API key.DEDALUS_PROVIDER_KEY
DEDALUS_PROVIDER_KEY
Provider-specific API key for Bring Your Own Key (BYOK) scenarios. Passed in the
X-Provider-Key header.DEDALUS_ORG_ID
DEDALUS_ORG_ID
Organization ID for multi-tenant scenarios.
DEDALUS_PROVIDER
DEDALUS_PROVIDER
Specify a specific provider (e.g., “openai”, “anthropic”). Passed in the
X-Provider header.Quick Start
Explicit API Key Configuration
You can also provide API keys explicitly when creating the client:Options passed to
NewClient() override environment variables.Multiple API Keys
For scenarios requiring multiple authentication headers:Bring Your Own Key (BYOK)
To use your own provider API keys:Per-Request Authentication
You can override authentication on a per-request basis:Custom Headers
For custom authentication headers:Security Best Practices
Use Environment Variables
Store API keys in environment variables or secure vaults like AWS Secrets Manager or HashiCorp Vault.
Rotate Keys Regularly
Implement key rotation policies and update your environment variables accordingly.
Least Privilege
Use API keys with the minimum required permissions for your use case.
Monitor Usage
Track API key usage to detect unauthorized access or anomalies.
Complete Example
Troubleshooting
401 Unauthorized Error
401 Unauthorized Error
403 Forbidden Error
403 Forbidden Error
- Your API key may not have the required permissions
- Contact Dedalus support to verify your account status
Missing API Key
Missing API Key
- The SDK returns an error if no API key is provided
- Check that
DEDALUS_API_KEYis set or passed viaoption.WithAPIKey()