Authentication
All gateway endpoints require an API key. The recommended authentication method is the Authorization header.
Bearer Token
| Item | Value |
|---|---|
| Header | Authorization |
| Format | Bearer YOUR_API_KEY |
| Applies to | All public gateway endpoints |
curl https://api.llmapi.site/v1/usage \
-H 'Authorization: Bearer YOUR_API_KEY'Compatible Headers
The server also accepts these headers for client compatibility:
| Header | Example |
|---|---|
Authorization | Bearer YOUR_API_KEY |
x-api-key | YOUR_API_KEY |
x-goog-api-key | YOUR_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:
| Type | Binding | Supported endpoints |
|---|---|---|
| General API key | General group | Text APIs, model listing, usage queries, and synchronous platform image endpoints. |
| Task API key | Per-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:
| Item | Value |
|---|---|
| HTTP status | 401 |
| Error type | authentication_error |
| Trigger | Missing, invalid, or unrecognized API key |
Response example:
{
"type": "error",
"error": {
"type": "authentication_error",
"message": "Invalid API key"
}
}Group and Platform Restrictions
Successful authentication does not make every endpoint available.
| Key type | Example endpoints | Restrictions |
|---|---|---|
| General API key / OpenAI group | /v1/responses, /v1/chat/completions, /v1/images/generations, /v1/images/edits | Tasks require a Task API key. |
| General API key / Anthropic group | /v1/messages, /v1/messages/count_tokens | OpenAI-specific image endpoints are unavailable. |
| General API key / Gemini group | /v1beta/models, /v1beta/models/{model}:generateContent | OpenAI-specific image endpoints are unavailable. |
| Task API key | /v1/tasks, /v1/tasks/events, /v1/images/generations, /v1/images/edits | Only 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.