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://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 a binding type:

TypeBinding fieldSupported endpoints
General API keyGeneral group group_idText APIs, model listing, usage queries, synchronous OpenAI image endpoints, and Gemini native paths.
Image API keyImage batch group image_batch_group_idAsync image tasks, task retrieval, cancellation, and task events.

The bindings are mutually exclusive. An image API key cannot bind to a general group. A general API key cannot bind to an image batch group. See Create API Keys for the full steps.

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. For general API keys, the general group determines platform capabilities. For image API keys, the image batch group determines available image models, account selection, concurrency, and pricing.

Key typeExample endpointsRestrictions
General API key / OpenAI group/v1/responses, /v1/chat/completions, /v1/images/generationsAsync image tasks require an image 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...Gemini native paths require a Gemini group; async image tasks still require an image API key.
General API key / Antigravity group/antigravity/v1/messages, /antigravity/v1beta/models...Dedicated prefixes force the Antigravity account pool.
Image API key / image batch group/v1/images/tasks, /v1/images/tasks/eventsOnly for async image tasks, not for text APIs or synchronous image endpoints.

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