LucidLM LucidLM

Documentation

LucidLM is a single REST surface for chat, vision, image, voice, and video generation — flat 10× cheaper than first-party list across every model. Drop in by changing one base URL. Native SDK support for Claude, GPT, Gemini, Ollama, and Openclaw.

Quickstart

  1. Create an API key at dashboard/keys — it starts with lx-.
  2. Use your model's native SDK — LucidLM is a drop-in replacement for Anthropic, OpenAI, and more.
  3. Make a request. Same key works across every model — Claude, GPT, Gemini, Ollama, and Openclaw.
# Claude — native Anthropic SDK
from anthropic import Anthropic

client = Anthropic(
    api_key="lx-your-key",
    base_url="https://api.lucidlm.xyz"
)

response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Write a haiku about debugging."}]
)
print(response.content[0].text)

Tip: Every model speaks its own native SDK. Claude uses Anthropic. GPT and Gemini use OpenAI. Ollama has its own Python package. Openclaw works via plain HTTP. One key works across all of them.

Authentication

Every endpoint accepts the API key on either header — pick whichever your SDK already sends:

Keys are workspace-scoped. Revoke from dashboard/keys — subsequent calls fail with 401 immediately.

Tool integrations

Drop-in configs for each supported model family.

Claude · Anthropic SDK

Point base URL at https://api.lucidlm.xyz — the SDK appends /v1/messages automatically.

bash
export ANTHROPIC_BASE_URL="https://api.lucidlm.xyz"
export ANTHROPIC_AUTH_TOKEN="lx-…"
claude

GPT · OpenAI SDK

Point base URL at https://api.lucidlm.xyz/v1.

Python
from openai import OpenAI
client = OpenAI(
    api_key="lx-…",
    base_url="https://api.lucidlm.xyz/v1"
)
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role":"user","content":"Hello"}]
)

Gemini · OpenAI SDK

Google doesn't ship a public chat SDK, so we recommend the OpenAI SDK pointed at https://api.lucidlm.xyz/v1.

Python
from openai import OpenAI
client = OpenAI(
    api_key="lx-…",
    base_url="https://api.lucidlm.xyz/v1"
)
response = client.chat.completions.create(
    model="gemini-2-5-pro",
    messages=[{"role":"user","content":"Tips for clean code?"}]
)

Ollama · Ollama Python SDK

Use the native ollama package. No LucidLM key needed — connects directly to your local instance.

Python
import ollama
response = ollama.chat(
    model="llama3",
    messages=[{"role":"user","content":"Hello"}]
)
print(response["message"]["content"])

Openclaw · HTTP

Openclaw speaks plain HTTP. Point your requests at https://api.lucidlm.xyz/v1.

Python · requests
import requests
resp = requests.post(
    "https://api.lucidlm.xyz/v1/chat/completions",
    headers={"Authorization": "Bearer lx-…"},
    json={
        "model": "openclaw-v1",
        "messages": [{"role":"user","content":"Hello"}]
    }
)
print(resp.json()["choices"][0]["message"]["content"])

API reference

GET /v1/models

OpenAI-shaped catalog discovery. Public — no auth needed. Available at https://api.lucidlm.xyz/v1/models.

bash
curl https://api.lucidlm.xyz/v1/models

POST /v1/chat/completions

OpenAI-compatible. Same shape as platform.openai.com/docs/api-reference/chat/create. Available at https://api.lucidlm.xyz/v1/chat/completions.

Supported fields: model, messages, max_tokens, system, stream, temperature, top_p, stop, tools, tool_choice.

cURL
curl https://api.lucidlm.xyz/v1/chat/completions \
  -H "Authorization: Bearer lx-…" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "messages": [
      {"role": "system", "content": "You are a precise SQL tutor."},
      {"role": "user", "content": "Explain window functions in two sentences."}
    ],
    "stream": true,
    "temperature": 0.4
  }'

POST /v1/messages

Anthropic-compatible. Available at https://api.lucidlm.xyz/v1/messages. Use this for vision, tool use, and any Claude SDK consumer (including Claude Code CLI).

cURL
curl https://api.lucidlm.xyz/v1/messages \
  -H "x-api-key: lx-…" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-4-7",
    "max_tokens": 1024,
    "messages": [{"role":"user","content":"hi"}]
  }'

POST /v1/images/generations

OpenAI-shaped. Returns 24-hour presigned URLs. Available at https://api.lucidlm.xyz/v1/images/generations.

bash
curl https://api.lucidlm.xyz/v1/images/generations \
  -H "Authorization: Bearer lx-…" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nano-banana-2",
    "prompt": "A watercolor city skyline at dusk, cinematic lighting",
    "aspect_ratio": "16:9",
    "n": 4
  }'

POST /v1/audio/speech

OpenAI-shaped TTS. Returns audio bytes inline. Available at https://api.lucidlm.xyz/v1/audio/speech.

bash
curl https://api.lucidlm.xyz/v1/audio/speech \
  -H "Authorization: Bearer lx-…" \
  -H "Content-Type: application/json" \
  -o output.mp3 \
  -d '{
    "model": "elevenlabs-v3-multilingual",
    "voice": "alloy",
    "input": "Hello from LucidLM."
  }'

POST /v1/video/generations

Submit prompt → block until ready → 24-hour presigned URLs. Available at https://api.lucidlm.xyz/v1/video/generations.

bash
curl https://api.lucidlm.xyz/v1/video/generations \
  -H "Authorization: Bearer lx-…" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "veo-3.1",
    "prompt": "A calm ocean wave at sunset, slow camera pan",
    "ratio": "16:9",
    "duration": 8,
    "resolution": "720p",
    "n": 1
  }'

Models & pricing

Flat 10× cheaper than first-party across every model.

Text · vision (per 1M tokens, input / output)

ModelLucidLMFirst-party
claude-opus-4-7$1.50/1M in · $7.50/1M outAnthropic $15.00/1M / $75.00/1M
claude-sonnet-4-6$0.30/1M in · $1.50/1M outAnthropic $3.00/1M / $15.00/1M
claude-haiku-4-5$0.10/1M in · $0.50/1M outAnthropic $1.00/1M / $5.00/1M
gpt-4o$0.25/1M in · $1.00/1M outOpenAI $2.50/1M / $10.00/1M
gemini-2-5-pro$0.125/1M in · $1.00/1M outGoogle $1.25/1M / $10.00/1M
ollama-llama3FreeLocal
openclaw-v1$0.10/1M in · $0.40/1M outOpenclaw $1.00/1M / $4.00/1M

Multimodal input

Both endpoints accept image, video, audio, and PDF input on every vision-capable model.

Tool use (function calling)

Works on both endpoints, across every chat model in the catalog.

Streaming

OpenAI shape: SSE with data: [DONE] termination.

Anthropic shape: Full event sequence — message_startmessage_stop.

Prompt caching

Pass cache_control headers — upstream honours them for latency wins.

Errors

CodeMeaning
400Malformed body or unsupported parameter
401Missing or invalid API key
402Insufficient balance
429Rate limit / concurrency cap
500Infrastructure error
503Transient capacity — retry with backoff

Rate limits

Compatibility matrix

Feature/v1/chat/completions/v1/messages
Text completion
Streaming✓ OpenAI SSE✓ Anthropic SSE
Vision (image input)
Tool use / function calling
JSON mode✗ → 400

Support

Open the Discord — a human replies in under an hour, 24/7.