Lumen API documentation

Migrating from OpenRouter / Helicone / Portkey

From OpenRouter

OpenRouter is a marketplace — you pick the model. Lumen decides for you based on per-request difficulty.

# Before (OpenRouter)
client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key="sk-or-...")
client.chat.completions.create(model="anthropic/claude-3.5-sonnet", messages=[...])

# After (Lumen)
client = OpenAI(base_url="https://lumen-api.eliteaiempire.com/v1", api_key="lumen_sk_...")
client.chat.completions.create(model="auto", messages=[...])
# - or - if you want anthropic specifically:
client.chat.completions.create(model="auto", messages=[...],
    extra_body={"brand_pref":"anthropic"})  # Pro+ feature

Why migrate: OpenRouter takes a margin and you still over-pay for easy prompts. Lumen routes per-request and you net 30-70% savings.

From Helicone

Helicone is an observability proxy — caching, logs, metrics — but you still pick the model.

# Before (Helicone) — wrapping OpenAI
client = OpenAI(
    base_url="https://oai.helicone.ai/v1",
    api_key="sk-..."  # OpenAI key
)

# After (Lumen) — replace OpenAI entirely
client = OpenAI(
    base_url="https://lumen-api.eliteaiempire.com/v1",
    api_key="lumen_sk_..."
)

You keep: caching (Redis-backed), audit log (cryptographic — better than Helicone's), usage analytics in /app/dashboard.

You gain: autonomous routing across 8 providers, quality-floor cascade, plan-aware budget caps.

You lose: Helicone's per-user/per-feature analytics overlay (we have basic by-key analytics, more granular coming).

From Portkey

Portkey is a gateway+observability+prompt-mgmt stack with multiple providers but again model-selection is yours.

# Before (Portkey)
client = OpenAI(base_url="https://api.portkey.ai/v1", api_key="...",
    default_headers={"x-portkey-config": "..."})

# After (Lumen)
client = OpenAI(base_url="https://lumen-api.eliteaiempire.com/v1", api_key="lumen_sk_...")

Trade-offs: Portkey has prompt-management UI; Lumen doesn't. Lumen has autonomous routing and a cryptographic audit chain; Portkey has neither.

A/B testing before switching

Run both side-by-side for a week. Lumen returns lumen.cost_per_1k so you can compute what you would have paid via OpenRouter (their model_cost field) vs what you actually paid via Lumen. Most teams see 40-60% cost reduction with zero quality regressions on internal eval suites.