Skip to content

Authentication

All gateway endpoints require an API key. The recommended authentication method is the Authorization header.

Bearer Token

ItemValue
HeaderAuthorization
FormatBearer YOUR_API_KEY
Applies toAll public gateway endpoints
bash
curl https://api.llmapi.site/v1/usage \
  -H 'Authorization: Bearer YOUR_API_KEY'

Compatible Headers

The server also accepts these headers for client compatibility:

HeaderExample
AuthorizationBearer YOUR_API_KEY
x-api-keyYOUR_API_KEY
x-goog-api-keyYOUR_API_KEY

Use only one authentication method per request. New integrations should use Authorization: Bearer.

API Key Types

When creating an API key in the console, choose the correct binding type:

TypeBindingSupported endpoints
General API keyGeneral groupText APIs, model listing, usage queries, and synchronous platform image endpoints.
Task API keyPer-model Task Plans/v1/tasks, /v1/tasks/events, /v1/tasks/{id}, result asset downloads, queued task cancellation, and OpenAI Images compatible synchronous endpoints.

The bindings are mutually exclusive. See Create API Keys for the full steps.

A Task API key may select a different plan for each model—for example, an economy plan for an image model and a stability plan for a video model. Models without an explicit selection use their own model-specific default plan. API requests do not include a plan parameter, and public model names do not change between plans.

If an explicitly selected plan is disabled, deleted, or no longer supports that model, only that model returns to its own default plan. Selections for other models are unchanged.

Authentication Failure

Interface details:

ItemValue
HTTP status401
Error typeauthentication_error
TriggerMissing, invalid, or unrecognized API key

Response example:

json
{
  "type": "error",
  "error": {
    "type": "authentication_error",
    "message": "Invalid API key"
  }
}

Group and Platform Restrictions

Successful authentication does not make every endpoint available.

Key typeExample endpointsRestrictions
General API key / OpenAI group/v1/responses, /v1/chat/completions, /v1/images/generations, /v1/images/editsTasks require a Task API key.
General API key / Anthropic group/v1/messages, /v1/messages/count_tokensOpenAI-specific image endpoints are unavailable.
General API key / Gemini group/v1beta/models, /v1beta/models/{model}:generateContentOpenAI-specific image endpoints are unavailable.
Task API key/v1/tasks, /v1/tasks/events, /v1/images/generations, /v1/images/editsOnly for Task APIs and OpenAI Images compatible synchronous endpoints, not for text or conversation endpoints.

When the platform or key type does not match, the endpoint may return 400, 403, or 404. See the errors page for examples.