Install
pip install openai # Python
npm install openai # JavaScript / TypeScriptPython
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.luv13.ai/v1",
api_key=os.environ["LUV13_API_KEY"],
)
resp = client.chat.completions.create(
model="luv13/glm-5.3-flash",
messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(resp.choices[0].message.content)The Python SDK also reads the OPENAI_BASE_URL environment variable if you don't pass base_url.
JavaScript and TypeScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.luv13.ai/v1",
apiKey: process.env.LUV13_API_KEY,
});
const resp = await client.chat.completions.create({
model: "luv13/glm-5.3-flash",
messages: [{ role: "user", content: "Say hello in five words." }],
});
console.log(resp.choices[0].message.content);Retries and timeouts
Both SDKs retry certain errors (such as connection errors, 429 and 5xx responses) twice by default with a short backoff. Set max_retries (Python) or maxRetries (JavaScript) to change that, and timeout to change the 10-minute default. See Retrying Requests and Timeouts.
Things to know
- The SDKs are built for OpenAI, so some methods call endpoints luv13 may not offer. Stick to chat completions and model listing unless a luv13 page says otherwise. See Chat Completions and Listing Models.
- For the base URL idea in general, see Base URL.
