Authentication
API keys
Your API key authenticates all requests. Include it in the Authorization header as a Bearer token.
Authorization: Bearer sk-your-api-key
Keep your key secret. Never commit API keys to version control or expose them in client-side code. Use environment variables instead.
Using with SDKs
Appelon’s API is OpenAI-compatible. Use the official OpenAI SDK with a custom base URL.
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://router.appelon.ai/v1"
)
Environment variables
Store your key in an environment variable for security.
# Add to .bashrc, .zshrc, or .env
export APPELON_API_KEY="sk-your-api-key"
With the environment variable set, initialize the client without hardcoding the key:
client = OpenAI(
api_key=os.environ["APPELON_API_KEY"],
base_url="https://router.appelon.ai/v1"
)
Authentication errors
If authentication fails, you’ll receive one of these responses:
| Code | Description |
|---|---|
401 |
Missing, invalid, or revoked API key. Check the Authorization header. |