Create a key
Create a separate API key for development and keep it outside source control.
Developer integration guide
Keep the OpenAI SDK you already use. Change the base URL, select a live model, and test the compatibility details that matter before production.
from openai import OpenAI client = OpenAI( api_key=os.environ["LUOLUO_API_KEY"], base_url="https://api.luoluocoder.com/v1", ) response = client.chat.completions.create( model="gpt-5.4-mini", messages=[{"role": "user", "content": "Hello"}], )
Create a separate API key for development and keep it outside source control.
Set the SDK base URL to https://api.luoluocoder.com/v1.
Query GET /v1/models and use an exact model ID returned by the service.
pip install openai
from openai import OpenAI
import os
client = OpenAI(
api_key=os.environ["LUOLUO_API_KEY"],
base_url="https://api.luoluocoder.com/v1",
timeout=60.0,
)
stream = client.chat.completions.create(
model="gpt-5.4-mini",
messages=[{"role": "user", "content": "Explain API gateways briefly."}],
stream=True,
)
for chunk in stream:
text = chunk.choices[0].delta.content
if text:
print(text, end="", flush=True)npm install openai
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.LUOLUO_API_KEY,
baseURL: "https://api.luoluocoder.com/v1",
timeout: 60_000,
});
const stream = await client.chat.completions.create({
model: "gpt-5.4-mini",
messages: [{ role: "user", content: "Explain API gateways briefly." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}| Check | Why it matters |
|---|---|
| Streaming chunks | Delta fields and stream termination must match your client assumptions. |
| Tool calling | Tool names, arguments, and finish reasons can differ between routes. |
| Error objects | Your retry logic should distinguish authentication, balance, rate limits, and upstream failures. |
| Usage fields | Verify token accounting before using it for customer billing. |
| Timeouts and retries | Use bounded retries and do not retry every 4xx response. |
For a reusable test project, see the open-source Python, Node.js, and cURL examples.
No. luoluoAI is an independent developer API gateway. SDK and API compatibility do not imply affiliation or endorsement.
Yes, but first test streaming, tool calls, structured output, errors, latency, rate limits, and usage accounting for the exact model route you plan to use.
Use the Model Plaza for configured models and pricing, and query GET /v1/models for the live list.
Start with a separate development key and one low-risk workflow.