Developers
Log in to create a key →API docs
Base URL: https://api.elselane.com. Authenticate with Authorization: Bearer el_live_…. Create keys in the dashboard after sign-in.
Machine-readable OpenAPI 3.1: api.elselane.com/openapi.json. For AI coding tools, also see llms.txt.
POST /v1/answer
Send only a prompt. ElseLane classifies, routes, and fails over.
curl https://api.elselane.com/v1/answer \
-H "Authorization: Bearer el_live_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: optional-unique-id" \
-d '{"prompt":"Explain CAP theorem simply"}'Optional body fields: system (string) and response_format ({ "type": "json_object" }).
{
"id": "...",
"answer": "...",
"task_type": "chat",
"model_used": "gemini-3.6-flash",
"provider": "google",
"fallback_used": false,
"attempts": [
{ "provider": "google", "model": "gemini-3.6-flash" }
],
"usage": {
"input_tokens": 12,
"output_tokens": 40,
"credits_charged": 10
}
}attempts lists each provider tried. Failed steps include error (e.g. quota, circuit open, provider disabled, invalid_json_response).
JSON structured output
Set response_format: { "type": "json_object" } on either endpoint. ElseLane only routes to providers with native JSON mode (OpenAI, Google, Groq, Together — Anthropic steps are skipped), passes the provider constraint, and validates that the answer parses as a JSON object. Invalid JSON fails that attempt and fails over. Streaming is not supported with JSON mode in v1.
curl https://api.elselane.com/v1/chat/completions \
-H "Authorization: Bearer el_live_..." \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"response_format": { "type": "json_object" },
"messages": [
{ "role": "system", "content": "Return JSON with keys title and summary." },
{ "role": "user", "content": "Write a short blog brief about failover APIs." }
]
}'Which model answered
Top-level model on chat completions stays "auto". Read the actual model from the body or headers:
/answer→model_used,provider,attempts/chat/completions→elselane.model_used,elselane.provider- Headers on success:
X-ElseLane-Model,X-ElseLane-Provider,X-ElseLane-Fallback,X-ElseLane-Task-Type
Deno / Edge (fetch)
Works in Supabase Edge Functions and other Deno runtimes — no Node SDK required.
const res = await fetch("https://api.elselane.com/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${Deno.env.get("ELSELANE_API_KEY")}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "auto",
response_format: { type: "json_object" },
messages: [
{ role: "system", content: "Return JSON with keys title and summary." },
{ role: "user", content: "Brief on multi-provider failover." },
],
}),
});
if (!res.ok) throw new Error(await res.text());
const model = res.headers.get("X-ElseLane-Model");
const data = await res.json();
const content = data.choices[0].message.content; // JSON string
const parsed = JSON.parse(content);POST /v1/chat/completions
OpenAI-compatible shim. Use model: "auto" only. ElseLane metadata is under elselane in the response. Set stream: true for SSE (text/event-stream) chunks ending with data: [DONE]; final chunk includes usage and elselane. Do not combine stream: true with JSON mode.
curl https://api.elselane.com/v1/chat/completions \
-H "Authorization: Bearer el_live_..." \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"messages": [{"role":"user","content":"Hello"}]
}'curl --no-buffer https://api.elselane.com/v1/chat/completions \
-H "Authorization: Bearer el_live_..." \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"stream": true,
"messages": [{"role":"user","content":"Hello"}]
}'API version & compatibility
Current public HTTP API is v1 under /v1/… on api.elselane.com. Breaking changes will ship as a new version path (for example /v2) rather than silently changing v1 behaviour. Additive fields and new optional body parameters may appear in v1 without a version bump.
See Changelog for product notes. OpenAPI: api.elselane.com/openapi.json.
CORS & clients
The v1 API is intended for server-side callers (your backend, Edge Functions, workers). Do not embed live secret keys in browsers — including on api.elselane.com. Browser fetch from arbitrary origins is not supported; there is no first-party CORS allowlist for browser keys. Call ElseLane from your server and return results to your client.
Abuse controls today are credits + API key auth (optional Upstash rate limits on some auth routes). WAF / edge rate limits can be added later if needed.
Deno, Node, Python, and similar runtimes can use plain HTTPS as shown in the examples above.
Errors
401— invalid API key402— insufficient credits422— high-risk PII blocked ({ "error": "...", "pii": { "types": ["ssn"] } })503— all providers failed (includesattempts)
PII guardrails
High-risk patterns are blocked by default before any provider call on both /v1/answer and /v1/chat/completions (same scanner). Types: ssn, credit_card, private_key, aws_access_key, stripe_secret, github_token. One match returns 422 with pii.types. Emails, phones, names, and normal currency amounts are not blocked. Card detection requires a plausible IIN/BIN plus Luhn (not every long digit ID).
If an admin sets mode to redact, matches are replaced with [REDACTED_…] and the response may include pii_redacted: true. Mode is global (admin SystemConfig), not per API key.
Billing
Credits: 1 credit = $0.0001. Charged at estimated provider token cost × 1.10 (10% platform fee), rounded up. Successful answers are charged at least 10 credits ($0.001).
Prompts and answers are not stored — usage metadata only (status, model, credits, latency).
Buy packs in Billing. Charts and recent events are on Usage.
Dashboard
- API keys — create, copy once, last used, revoke
- Account — profile, password, connected apps, email alerts, export/delete
- Usage — 7/30/90 day charts plus recent events