Authentication

Qubax AI uses Bearer token authentication. Every API request must include your API key in the Authorization header.

API keys

Your API key starts with qbx_live_. You can create and manage keys in the API Keys dashboard.

Passing your key

All requests require an Authorization header:

HTTP
Authorization: Bearer qbx_live_...

With the OpenAI SDK (recommended):

Python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.qubax.ai/v1",
    api_key="qbx_live_..."
)

With cURL:

Shell
curl https://api.qubax.ai/v1/models \
  -H "Authorization: Bearer $QUBAX_API_KEY"
⚠️
Never hardcode your API key in source files. Use environment variables instead.

Using environment variables

Shell
# .env
export QUBAX_API_KEY="qbx_live_..."
Python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.qubax.ai/v1",
    api_key=os.environ["QUBAX_API_KEY"]
)

Error responses

If authentication fails, you'll get a 401 response:

JSON
{
  "error": {
    "message": "Invalid API key provided.",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}

Best practices

  • • Store keys in environment variables, never in code
  • • Use separate keys for development and production
  • • Rotate keys if they may be compromised
  • • Never commit keys to version control