Getting Started
This page covers the minimum information required to call the LLMAPI gateway. All examples use:
https://api.llmapi.siteBasics
| Item | Value |
|---|---|
| API Base URL | https://api.llmapi.site |
| Recommended authentication | Authorization: Bearer YOUR_API_KEY |
| Request format | application/json; OpenAI image edits may use multipart/form-data |
| Streaming | Depends on the endpoint; SSE and WebSocket are supported by specific routes |
Authentication Example
curl https://api.llmapi.site/v1/models \
-H 'Authorization: Bearer YOUR_API_KEY'x-api-key and x-goog-api-key are also accepted for client compatibility. New integrations should use Bearer tokens.
Create the Right API Key First
The console supports two API key types:
| Type | Best for |
|---|---|
| General API key | Text APIs, model listing, usage queries, and synchronous OpenAI image endpoints. |
| Task API key | Long-running image, video, and other media jobs through /v1/tasks, including task retrieval, cancellation, SSE updates, and asset downloads; also usable with OpenAI Images compatible synchronous endpoints. |
To call Task API, create a Task API key. The key may select a different Task Plan for each model; models without an explicit selection follow that model's default plan. General API keys cannot submit tasks, and Task API keys cannot call regular model endpoints. The synchronous image exceptions are POST /v1/images/generations and POST /v1/images/edits.
Model plan choices are part of the API key configuration. Do not add a plan parameter to requests or change model names for different plans. Use GET /v1/tasks/models with the Task API key to discover each model's effective price and constraints. If one selection becomes invalid, that model returns to its own default plan without changing other model selections.
See Create API Keys for the full steps.
Choosing an Endpoint
| Use case | Recommended endpoint | Notes |
|---|---|---|
| Claude Code or Anthropic Messages clients | POST /v1/messages | Routed by the API key group platform. |
| OpenAI Responses clients | POST /v1/responses | Compatible with the Responses API. |
| OpenAI Chat Completions clients | POST /v1/chat/completions | Works with common OpenAI-compatible clients. |
| List available models | GET /v1/models | Returns models available to the current key group. |
| Check balance, quota, and usage | GET /v1/usage | Returns quota mode and usage statistics. |
| OpenAI synchronous image generation | POST /v1/images/generations | General API keys require an OpenAI group. Task API keys use Task API models and pricing, then wait synchronously for the result. |
| OpenAI synchronous image editing | POST /v1/images/edits | Supports multipart uploads and JSON image URLs. Task API keys use Task API models and pricing. |
| Gemini native image and multimodal calls | POST /v1beta/models/{model}:generateContent | Requires a general API key bound to a Gemini group. |
| Long-running media jobs | POST /v1/tasks | Requires a Task API key; currently supports images and video models with configured channels. |
Minimal Examples
Messages
curl https://api.llmapi.site/v1/messages \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "claude-sonnet-4-5",
"max_tokens": 512,
"messages": [
{ "role": "user", "content": "Hello" }
]
}'Responses
curl https://api.llmapi.site/v1/responses \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-5.1",
"input": "Write a short product description."
}'Chat Completions
curl https://api.llmapi.site/v1/chat/completions \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-5.1",
"messages": [
{ "role": "user", "content": "Hello" }
]
}'Media Task
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"
}
}'Integration Notes
- The API key binding determines which endpoints are available.
- Synchronous OpenAI image endpoints usually require a general API key with an OpenAI group. Task API keys can use
POST /v1/images/generationsandPOST /v1/images/editswith OpenAI Images compatible request bodies. - Gemini image generation uses Gemini Native with a general API key bound to a Gemini group.
- Long-running image, video, and other media jobs should use Task API and a Task API key.
POST /v1/messages/count_tokensis not supported for OpenAI platform groups.