Authentication

All API requests require authentication via a Bearer token. Include your API key in the Authorization header of every request.

API Keys

API keys are created from your dashboard. Each key has a prefix (e.g., sk-) for identification. The full key is only shown once at creation time.

Bearer Token

Include the API key in the Authorization header:

Authorization: Bearer sk-your-api-key-here

Key Management

You can create, revoke, and rotate API keys from your dashboard. Revoking a key is immediate and irreversible. Rotating a key creates a new key and revokes the old one.

Security Best Practices

  • Never expose API keys in client-side code or version control
  • Use environment variables to store keys
  • Rotate keys regularly
  • Use separate keys for development and production
  • Set up usage alerts to detect unauthorized usage

Example

import requests

headers = {
    "Authorization": "Bearer sk-your-api-key-here",
    "Content-Type": "application/json",
}

response = requests.get(
    "https://api.qinyanai.com/v1/models",
    headers=headers,
)

print(response.json())