API Keys

All API requests require authentication using an API key. You can get your API key from the dashboard.

Using your API key

Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY

Examples

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.xtrix.workers.dev/v1"
)

Security

  • Keep your API keys secure
  • Never share them in public repositories
  • Use environment variables in production

Errors

If your API key is invalid or missing, you’ll receive a 401 error:
{
  "error": {
    "message": "Invalid API key provided.",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}