Developer Guide
Everything you need to call the Lexora inference API from your app.
Quickstart
Lexora is an OpenAI-compatible API. Change one line in your existing code and your requests route to distributed GPU nodes at a fraction of the cost.
1. Get API Key
Sign up and generate a key from the dashboard.
2. Change base URL
Point your OpenAI SDK at api.lexora.network/v1.
3. Send requests
Identical SDK, 95% lower cost.
Authentication
All requests require a sk-lexora-… API key in the Authorization header.
Get your key at Dashboard → API Keys.
curl https://api.lexora.network/v1/chat/completions \
-H "Authorization: Bearer sk-lexora-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"Qwen/Qwen3-8B","messages":[{"role":"user","content":"Hello"}]}'Chat Completions
Endpoint: POST /v1/chat/completions — identical to the OpenAI spec.
Python (openai SDK)
from openai import OpenAI
client = OpenAI(
base_url="https://api.lexora.network/v1",
api_key="sk-lexora-YOUR_KEY",
)
# Streaming (recommended)
stream = client.chat.completions.create(
model="Qwen/Qwen3-8B",
messages=[{"role": "user", "content": "Explain quantum entanglement simply."}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="", flush=True)Node.js / TypeScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.lexora.network/v1",
apiKey: process.env.LEXORA_API_KEY,
});
const stream = await client.chat.completions.create({
model: "Qwen/Qwen3-8B",
messages: [{ role: "user", content: "Hello!" }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}Non-streaming response
response = client.chat.completions.create(
model="Qwen/Qwen3-8B",
messages=[{"role": "user", "content": "What is 2+2?"}],
stream=False,
max_tokens=512,
temperature=0.7,
)
print(response.choices[0].message.content)modelstringRequired. See Models section.messagesarrayRequired. OpenAI message format.streambooleanDefault true. SSE streaming.max_tokensintegerDefault 512. Max 32768.temperaturefloatDefault 0.7. Range 0–2.Image Generation
Endpoint: POST /v1/images/generations — returns base64 PNG.
import base64, requests
resp = requests.post(
"https://api.lexora.network/v1/images/generations",
headers={"Authorization": "Bearer sk-lexora-YOUR_KEY"},
json={
"model": "black-forest-labs/FLUX.1-schnell",
"prompt": "A futuristic cityscape at dawn, cinematic lighting",
"width": 768,
"height": 768,
"num_inference_steps": 4, # schnell default — do not increase beyond 4
"guidance_scale": 0.0, # schnell is guidance-free
"n": 1,
},
timeout=120,
)
data = resp.json()["data"][0]["b64_json"]
with open("output.png", "wb") as f:
f.write(base64.b64decode(data))modelstringRequired. Only FLUX.1-schnell is live.promptstringRequired. Describe the image.width / heightinteger256–2048. Default 768x768.num_inference_stepsinteger1–50. Default 4 (schnell).guidance_scalefloat0–20. Default 0.0 (schnell is guidance-free).nintegerAlways 1 (only one image per request).Partner Models
Frontier models from DeepSeek, Kimi, Google, and OpenAI are available through a dedicated, OpenAI-compatible flow. Same request shape — just a different path.
/dashboard/billing to get access.Chat endpoint: POST /v1/partner/chat/completions
Image endpoint: POST /v1/partner/images/generations
Text chat
import requests
resp = requests.post(
"https://api.lexora.network/v1/partner/chat/completions",
headers={"Authorization": "Bearer sk-lexora-YOUR_KEY"},
json={
"model": "deepseek-v4-pro", # swap for any partner model ID below
"messages": [{"role": "user", "content": "Explain quicksort."}],
},
timeout=120,
)
print(resp.json()["choices"][0]["message"]["content"])Vision / multimodal (Gemini 2.5, GPT-5.6)
Pass an array of content parts instead of a plain string. Both image_url (HTTPS URL) and base64 data URIs are accepted.
import requests
resp = requests.post(
"https://api.lexora.network/v1/partner/chat/completions",
headers={"Authorization": "Bearer sk-lexora-YOUR_KEY"},
json={
"model": "gemini-2.5-flash", # or gpt-5.4-mini / gpt-4.1 / gpt-4.1-mini / gemini-2.5-pro
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "What's in this image?"},
{"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}},
],
}],
},
timeout=60,
)
print(resp.json()["choices"][0]["message"]["content"])
# Base64 data URI also works:
# "url": "data:image/jpeg;base64,/9j/4AAQ..."// TypeScript / Node.js — same shape via the OpenAI SDK
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.lexora.network/v1/partner",
apiKey: process.env.LEXORA_API_KEY,
});
const response = await client.chat.completions.create({
model: "gemini-2.5-flash",
messages: [{
role: "user",
content: [
{ type: "text", text: "Describe this screenshot." },
{ type: "image_url", image_url: { url: "https://example.com/screenshot.png" } },
],
}],
});
console.log(response.choices[0].message.content);deepseek-v4-prochatDeepSeek V4 Prodeepseek-flashchatDeepSeek Flashkimi-k2.7-codechatKimi K2.7 Codekimi-k2.7-code-highspeedchatKimi K2.7 Code (High Speed)kimi-k2.6chatKimi K2.6gemini-2.5-flashchatGemini 2.5 Flash · vision ✓gemini-2.5-prochatGemini 2.5 Pro · vision ✓gpt-5.4-minichatGPT-5.4 Mini · vision ✓gpt-4.1chatGPT-4.1 · vision ✓gpt-4.1-minichatGPT-4.1 Mini · vision ✓flux-devimageFLUX.1 devPartner usage is billed to your balance at your plan's rate and deducted on completion. See your plan on the pricing page.
Available Models
Language Models
| Model ID | Context | Price | Status |
|---|---|---|---|
| Qwen/Qwen3-8B | 128K | $0.10 / 1M tokens | Live |
| meta-llama/Llama-3.1-70B-Instruct | 128K | TBD | Pipeline |
Image Models
| Model ID | Output | Price | Status |
|---|---|---|---|
| black-forest-labs/FLUX.1-schnell | PNG | $0.002 / image | Live |
| black-forest-labs/FLUX.1-dev | PNG | TBD | Pipeline |
| stabilityai/stable-diffusion-xl-base-1.0 | PNG | TBD | Pipeline |
Pricing
All prices are Beta Pricing and may adjust as the network scales. Deductions happen at job completion — failed jobs are not charged.
Qwen3-8B
$0.10 / 1M tokens
input + output combined
FLUX.1 schnell
$0.002 / image
any resolution up to 2048px
Add credits at Dashboard → Billing. Unused balance never expires.
Error Codes
| HTTP | Cause | Fix |
|---|---|---|
| 401 | Invalid or revoked API key | Check your key at Dashboard → API Keys |
| 402 | Insufficient balance | Add credits at Dashboard → Billing |
| 429 | Daily free limit reached (5/day) | Add credits or wait for daily reset |
| 503 | No nodes available for model | Retry in 30s — nodes may be loading |
| 504 | Job timed out (>120s) | Retry; long queues during peak hours |
Something missing? Open an issue on GitHub