Skip to content

Getting Started

This page covers the minimum information required to call the LLMAPI gateway. All examples use:

text
https://api.llmapi.site

Basics

ItemValue
API Base URLhttps://api.llmapi.site
Recommended authenticationAuthorization: Bearer YOUR_API_KEY
Request formatapplication/json; OpenAI image edits may use multipart/form-data
StreamingDepends on the endpoint; SSE and WebSocket are supported by specific routes

Authentication Example

bash
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:

TypeBest for
General API keyText APIs, model listing, usage queries, and synchronous OpenAI image endpoints.
Task API keyLong-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 caseRecommended endpointNotes
Claude Code or Anthropic Messages clientsPOST /v1/messagesRouted by the API key group platform.
OpenAI Responses clientsPOST /v1/responsesCompatible with the Responses API.
OpenAI Chat Completions clientsPOST /v1/chat/completionsWorks with common OpenAI-compatible clients.
List available modelsGET /v1/modelsReturns models available to the current key group.
Check balance, quota, and usageGET /v1/usageReturns quota mode and usage statistics.
OpenAI synchronous image generationPOST /v1/images/generationsGeneral API keys require an OpenAI group. Task API keys use Task API models and pricing, then wait synchronously for the result.
OpenAI synchronous image editingPOST /v1/images/editsSupports multipart uploads and JSON image URLs. Task API keys use Task API models and pricing.
Gemini native image and multimodal callsPOST /v1beta/models/{model}:generateContentRequires a general API key bound to a Gemini group.
Long-running media jobsPOST /v1/tasksRequires a Task API key; currently supports images and video models with configured channels.

Minimal Examples

Messages

bash
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

bash
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

bash
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

bash
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/generations and POST /v1/images/edits with 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_tokens is not supported for OpenAI platform groups.