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"
)
Keys in an organization
In an organization, every key belongs to the member who created it. Owners can revoke any key; members can revoke the keys they made.
- A member leaves. When an owner removes a member, the keys that member created in the organization are revoked.
- Two-factor login required. An owner can require two-factor login for the whole organization (the gear next to the organization in the account switcher, then Beveiliging). Keys created by a member who has not set it up stop working until they do, and that member cannot open the organization in the dashboard. Older keys, made before Appelon recorded who created a key, have no creator and keep working; the Beveiliging page counts them so you can replace them.
Your personal account is not affected by any organization’s settings.
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. |
403 |
mfa_required: the organization requires two-factor login and the key’s creator has not set it up. |
403 |
The key’s creator is no longer a member of the organization. |