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:https://api.edgee.ai). To use a custom base URL, use Method 3 or 4.
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://api.edgee.ai)
Complete Examples
Example 1: Production Setup
Example 2: Multi-Environment Setup
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 if environment variable
EDGEE_BASE_URLis overriding it - Ensure you’re using the correct configuration method