LiveLLMAPI

API Documentation

LiveLLMAPI exposes a single OpenAI-compatible pay-as-you-go gateway. Point any OpenAI SDK at https://api.livellmapi.com/v1, pass your LiveLLMAPI key, and pay strictly per token.

Quickstart

1. Create an account and add credits on the Credits page.
2. Create an API key on the API keys page.
3. Call /v1/chat/completions with any model ID from the Models page.

curl https://api.livellmapi.com/v1/chat/completions \
  -H "Authorization: Bearer $LIVELLMAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v3.2",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

List available models

curl https://api.livellmapi.com/v1/models -H "Authorization: Bearer $LIVELLMAPI_KEY"

OpenAI SDK drop-in

Any OpenAI-compatible client works by setting base_url and api_key.

Python

from openai import OpenAI

client = OpenAI(
    base_url="https://api.livellmapi.com/v1",
    api_key="YOUR_LIVELLMAPI_KEY",
)

resp = client.chat.completions.create(
    model="glm-5.2",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)

Node / TypeScript

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.livellmapi.com/v1",
  apiKey: process.env.LIVELLMAPI_KEY,
});

const resp = await client.chat.completions.create({
  model: "glm-5.2",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);

Streaming (SSE)

Pass "stream": true for Server-Sent Events with final token usage included automatically.

curl https://api.livellmapi.com/v1/chat/completions \
  -H "Authorization: Bearer $LIVELLMAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v3.2",
    "messages": [{"role": "user", "content": "Count to five"}],
    "stream": true
  }'

Tool calling, vision & JSON mode

Standard OpenAI parameters (tools, tool_choice, response_format, multimodal image_url parts, temperature, top_p, seed) pass through cleanly.

Function / tool calling

curl https://api.livellmapi.com/v1/chat/completions \
  -H "Authorization: Bearer $LIVELLMAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v3.2",
    "messages": [{"role": "user", "content": "Weather in Paris?"}],
    "tools": [{
      "type": "function",
      "function": {
        "name": "get_weather",
        "parameters": {
          "type": "object",
          "properties": { "city": { "type": "string" } }
        }
      }
    }]
  }'

Vision

curl https://api.livellmapi.com/v1/chat/completions \
  -H "Authorization: Bearer $LIVELLMAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama-4-maverick",
    "messages": [{
      "role": "user",
      "content": [
        {"type": "text", "text": "What is in this image?"},
        {"type": "image_url",
         "image_url": {"url": "https://example.com/photo.jpg"}}
      ]
    }]
  }'

Structured JSON output

curl https://api.livellmapi.com/v1/chat/completions \
  -H "Authorization: Bearer $LIVELLMAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v3.2",
    "messages": [{"role": "user", "content": "List 3 primes as JSON"}],
    "response_format": {"type": "json_object"}
  }'

Embeddings

Call POST /v1/embeddings for dense retrieval vectors, metered on input tokens only.

curl https://api.livellmapi.com/v1/embeddings \
  -H "Authorization: Bearer $LIVELLMAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "model": "bge-m3", "input": "your text here" }'

Presets

Save reusable model + parameter + system-prompt bundles on the Presets page and invoke them with @preset/<slug>.

curl https://api.livellmapi.com/v1/chat/completions \
  -H "Authorization: Bearer $LIVELLMAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "@preset/fast-json",
    "messages": [{"role": "user", "content": "List 3 primes"}]
  }'

Web search & page fetch

Append :online to any model ID to ground answers in live web search results, or call POST /v1/fetch to extract readable text from a URL.

curl https://api.livellmapi.com/v1/chat/completions \
  -H "Authorization: Bearer $LIVELLMAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v3.2:online",
    "messages": [{"role": "user", "content": "What happened in AI this week?"}]
  }'
curl https://api.livellmapi.com/v1/fetch \
  -H "Authorization: Bearer $LIVELLMAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com/article" }'

Metering headers, generation lookup & errors

Every non-streaming response returns exact per-request cost and remaining balance in micro-USD (1 USD = 1,000,000 micro-USD). Cached prompt input tokens are automatically billed at 0.1x the input rate.

HTTP/1.1 200 OK
x-live-cost-micro-usd: 152          # this call cost $0.000152
x-live-balance-micro-usd: 4998480   # balance left, in millionths of a dollar
x-request-id: 8f3c1b9e-...

Look up a past generation

curl "https://api.livellmapi.com/v1/generation?id=chatcmpl-..." \
  -H "Authorization: Bearer $LIVELLMAPI_KEY"
HTTP Type Meaning
401authMissing or invalid API key
402insufficient_creditsWallet balance is below the request estimate — top up on /credits
429rate_limit / spend_capPer-key rate limit or rolling 30-day spend cap reached
502upstreamTemporary inference error — reservation released, you are not charged