Skip to content

Authentication

For model endpoints such as /v1/*, the most common authentication method is to include your API key in the request header:

text
Authorization: Bearer sk-your-api-key

You can generate and manage your key on the API Tokens page.

When to use an API key

  • Connecting clients, plugins, or AI apps.
  • Writing scripts that call model APIs.
  • Calling chat, completions, embeddings, images, audio, and other AI model endpoints.

Common errors

401 or authentication failure

Check these items first:

  1. Make sure the key was copied completely.
  2. Make sure you are using an API key created by the current account.
  3. Make sure the endpoint is correct. Model calls usually go through /v1/....
  4. Make sure the request header includes Authorization: Bearer sk-your-api-key.