Skip to main content

Authentication

Azerion AI uses API keys to authenticate requests to its API endpoints.

Obtaining Your API Key

  1. Sign Up/Log In: Ensure you have an account at https://app.azerion.ai.
  2. Navigate to API Tokens: Go to the account settings page and find the API Tokens section: https://app.azerion.ai/account#api-tokens.
  3. Generate Key: Click the button to generate a new API key. Give it a descriptive name (e.g., "My Project Key").
  4. Copy & Store: Your new API key will be displayed only once. Copy it immediately and store it in a secure location (like a password manager or environment variable). Do not share your API key publicly or commit it to version control.
Secure Your Credentials

Keep your API key and access tokens secure and do not share them publicly. Treat them like passwords.

Using Your API Key

All API requests must include your API key in the Authorization header using the Bearer scheme.

Example:

Authorization: Bearer YOUR_API_KEY

Replace YOUR_API_KEY with your actual secret key.

Example using curl:

curl https://api.azerion.ai/v1/models \
-H "Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxx" # Replace with your key

Example using Python (requests library):

import requests
import os

# It's best practice to load your key from an environment variable
# or a secure configuration system, not hardcode it.
API_KEY = os.getenv("AZERION_API_KEY")
BASE_URL = "https://api.azerion.ai/v1"

headers = {
"Authorization": f"Bearer {API_KEY}"
}

try:
response = requests.get(f"{BASE_URL}/models", headers=headers)
response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)
print(response.json())
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
if response is not None:
print(f"Status Code: {response.status_code}")
print(f"Response Body: {response.text}")

Security Best Practices:

  • Never hardcode your API key directly in your source code.
  • Use environment variables (export AZERION_API_KEY='your_key') or secure secret management systems.
  • Generate separate keys for different applications or environments (development, production).
  • Revoke keys immediately if you suspect they have been compromised.