OpenAI SDK

Python, Node and anything else built on the OpenAI SDK, change one line.

Steps

01
Install
The standard OpenAI client works unchanged.
02
Point it at LuxeChain
Set base_url and your lxc_live_ key.
03
Pick a model
Any model id from /models works here.
python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.luxechain.si/v1",
    api_key="lxc_live_YOUR_KEY",
)

r = client.chat.completions.create(
    model="YOUR_MODEL_ID",        # any model id from /models
    messages=[{"role": "user", "content": "Hello"}],
)
print(r.choices[0].message.content)
javascript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.luxechain.si/v1",
  apiKey:  "lxc_live_YOUR_KEY",
});

const r = await client.chat.completions.create({
  model: "YOUR_MODEL_ID",        // any model id from /models
  messages: [{ role: "user", content: "Hello" }],
});
console.log(r.choices[0].message.content);
Streaming, tool calls and JSON mode all pass straight through.

← All guides Get tokens