Overview
TheEdgee class constructor accepts multiple input types:
Noneor no arguments - reads from environment variablesstr- API key string (backward compatible)EdgeeConfig- Configuration dataclass (type-safe)dict- Plain dictionary (flexible)
Method 1: Environment Variables (Recommended for Production)
The simplest and most secure approach is to use environment variables. The SDK automatically readsEDGEE_API_KEY (required) and optionally EDGEE_BASE_URL from your environment variables.
Method 2: String API Key (Quick Start)
For quick testing or simple scripts, pass the API key directly as a string:EDGEE_BASE_URL; otherwise it defaults to https://edgee.io. To set a base URL explicitly, use the configuration object below.
Method 3: Configuration Object (Type-Safe)
For better type safety, IDE support, and code clarity, use theEdgeeConfig dataclass:
Configuration Priority
The SDK uses the following priority order when resolving configuration:- Constructor argument (if provided)
- Environment variable (if constructor argument is missing)
- Default value (for
base_urlonly, defaults tohttps://edgee.io)
Complete Examples
Troubleshooting
”EDGEE_API_KEY is not set” Error
Problem: The SDK can’t find your API key. Solutions:-
Set the environment variable:
-
Pass it directly:
-
Use EdgeeConfig:
Custom Base URL Not Working
Problem: Your custom base URL isn’t being used. Check:- Verify the base URL in your configuration
- Check whether an explicit constructor URL takes precedence over
EDGEE_BASE_URL - Ensure you’re using the correct configuration method