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
- Create an API key at dashboard/keys — it starts with
lx-. - Use your model's native SDK — LucidLM is a drop-in replacement for Anthropic, OpenAI, and more.
- 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:
Authorization: Bearer lx-…— used by OpenAI SDKs and any tool pointed at/v1.x-api-key: lx-…— used by Anthropic SDKs and Claude Code CLI when pointed at the base URL.
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.
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.
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.
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.
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.
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.
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 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 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.
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.
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.
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)
| Model | LucidLM | First-party |
|---|---|---|
| claude-opus-4-7 | $1.50/1M in · $7.50/1M out | Anthropic $15.00/1M / $75.00/1M |
| claude-sonnet-4-6 | $0.30/1M in · $1.50/1M out | Anthropic $3.00/1M / $15.00/1M |
| claude-haiku-4-5 | $0.10/1M in · $0.50/1M out | Anthropic $1.00/1M / $5.00/1M |
| gpt-4o | $0.25/1M in · $1.00/1M out | OpenAI $2.50/1M / $10.00/1M |
| gemini-2-5-pro | $0.125/1M in · $1.00/1M out | Google $1.25/1M / $10.00/1M |
| ollama-llama3 | Free | Local |
| openclaw-v1 | $0.10/1M in · $0.40/1M out | Openclaw $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_start → message_stop.
Prompt caching
Pass cache_control headers — upstream honours them for latency wins.
Errors
| Code | Meaning |
|---|---|
| 400 | Malformed body or unsupported parameter |
| 401 | Missing or invalid API key |
| 402 | Insufficient balance |
| 429 | Rate limit / concurrency cap |
| 500 | Infrastructure error |
| 503 | Transient capacity — retry with backoff |
Rate limits
- 5 concurrent calls per user across every endpoint.
- Pre-call balance reservation — no upstream burn on insufficient funds.
- We never re-route to a weaker model under load.
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.