The Electron Hub API uses API keys for authentication. You’ll need to include your API key in the Authorization header of every request.
Getting Your API Key
- Visit the Electron Hub Console
- Sign up or log in to your account
- Navigate to the API Keys section
- Generate a new API key
- Copy and securely store your API key
Keep your API key secure and never share it publicly. Treat it like a password.
Using Your API Key
Include your API key in the Authorization header with the Bearer prefix:
curl -X POST "https://api.electronhub.ai/v1/chat/completions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-3.5-turbo",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'
Environment Variables
For security, store your API key as an environment variable:
export ELECTRONHUB_API_KEY="your_api_key_here"
Then use it in your code:
import os
api_key = os.getenv("ELECTRONHUB_API_KEY")
API Key Management
- Regenerate Keys: You can regenerate your API key at any time in the console
- Multiple Keys: Create separate keys for different environments (development, production)
- Monitor Usage: Track your API usage in the console dashboard
Rate Limiting
API keys are subject to rate limits based on your plan. See our rate limits guide for more information.