Create API Keys
Before calling LLMAPI, create the correct API key type in the console.
| Type | Bound to | Primary use |
|---|---|---|
| General API key | General group | Text APIs, model listing, usage queries, synchronous platform image endpoints, and other regular gateway APIs. |
| Task API key | Per-model Task Plans | Long-running image, video, and other media jobs through /v1/tasks, plus task retrieval, cancellation, SSE updates, asset downloads, and OpenAI Images compatible synchronous endpoints. |
The bindings are mutually exclusive. A general API key cannot submit tasks. A Task API key can only access /v1/tasks*, POST /v1/images/generations, and POST /v1/images/edits.
Create a General API Key
Use a general API key for text models, OpenAI-compatible APIs, Anthropic Messages, Gemini Native, and synchronous platform image endpoints.
Steps:
- Sign in to the console and open the API Key page.
- Click Create API Key.
- Enter a name, for example
production-textorclaude-code. - Set Binding type to General group.
- Select an available Resource group.
- Optionally configure a custom key, IP restrictions, quota, rate limits, and expiration.
- Submit the form, then copy and store the generated key.
The selected general group determines available platforms and models:
| Group platform | Common endpoints |
|---|---|
| OpenAI | /v1/responses, /v1/chat/completions, /v1/models, /v1/images/generations, /v1/images/edits |
| Anthropic | /v1/messages, /v1/messages/count_tokens |
| Gemini | /v1beta/models, /v1beta/models/{model}:generateContent, /v1beta/models/{model}:streamGenerateContent |
Use the key like this:
curl https://api.llmapi.site/v1/models \
-H 'Authorization: Bearer YOUR_API_KEY'Create a Task API Key
Use a Task API key for long-running image, video, and other media jobs. The key may select a Task Plan separately for each model. Models without an explicit selection follow their model-specific default plan.
Steps:
- Sign in to the console and open the API Key page.
- Click Create API Key.
- Enter a name, for example
production-mediaormedia-jobs. - Select the Task key type. Optionally choose a plan for each model under Model plans; leave a model on Follow default to use its current default plan.
- Optionally configure quota, rate limits, and expiration.
- Submit the form, then copy and store the generated key.
One key may use different plans for different models—for example, an economy plan for gpt-image-2 and a stability plan for seedance. The request protocol stays the same: do not add a plan parameter or modify the model name. Before submitting a task, use GET /v1/tasks/models with that key to read each model's effective price and parameter constraints.
If an explicit selection is disabled, deleted, or no longer supports that model, that model returns to its own default plan without changing other model selections. Existing keys also follow the default automatically when an administrator adds a new model.
Task API keys are only for these public endpoints:
| Endpoint | Description |
|---|---|
POST /v1/tasks | Submit a task. |
GET /v1/tasks/models | List executable models, prices, and parameter constraints for the current key. |
GET /v1/tasks/{id} | Retrieve task status and result. |
GET /v1/tasks/events | Subscribe to task updates for the current key. |
GET /v1/tasks/{id}/assets/{index} | Download a result asset. |
POST /v1/tasks/{id}/cancel | Cancel a queued task. |
POST /v1/images/generations | OpenAI Images compatible generation request. Waits synchronously for up to 120 seconds. |
POST /v1/images/edits | OpenAI Images compatible edit request. Waits synchronously for up to 120 seconds. |
Example:
curl https://api.llmapi.site/v1/tasks \
-H 'Authorization: Bearer YOUR_TASK_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-image-2",
"modality": "image",
"params": {
"model": "gpt-image-2",
"prompt": "a clean studio product photo of a matte black water bottle",
"n": 1,
"image_size": "1K",
"aspect_ratio": "1:1"
}
}'Which One to Use
| Requirement | Use |
|---|---|
| Claude Code, Responses, Chat Completions, Messages | General API key |
| Model listing and usage queries | General API key |
| Synchronous OpenAI image generation or edits | General API key with an OpenAI group that supports images |
| Existing OpenAI Images generation or edit client | Task API key calling POST /v1/images/generations or POST /v1/images/edits |
| Gemini image generation or multimodal generation | General API key with a Gemini group |
| Long-running production image or video jobs | Task API key |
| Batch image jobs with Gemini or OpenAI image models | Task API key; optionally select a plan for that model or follow its model default |
Common Issues
| Symptom | Cause and fix |
|---|---|
/v1/tasks returns TASK_SCOPE_REQUIRED | You are using a general API key. Create and use a Task API key. |
Regular model endpoints return task_key_only | You are using a Task API key. Use a general API key for text and conversation endpoints. Task keys only add OpenAI Images compatible access for POST /v1/images/generations and POST /v1/images/edits. |
| The task model is unavailable | The model has no active default plan/available route, or the model name is incorrect. Check GET /v1/tasks/models with the same key. |
params.model must match model | Make params.model identical to the top-level model, or omit params.model. |