Node.js / TypeScript
The official OpenAI Node SDK with a custom baseURL.
Install
npm install openaiTypeScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.000labs.xyz/v1",
apiKey: process.env["000_LABS_API_KEY"],
});
const completion = await client.chat.completions.create({
model: "openai/gpt-4o-mini",
messages: [{ role: "user", content: "What is the meaning of life?" }],
});
console.log(completion.choices[0].message.content);Streaming
TypeScript
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.000labs.xyz/v1", apiKey: process.env["000_LABS_API_KEY"] });
const stream = await client.chat.completions.create({
model: "openai/gpt-4o-mini",
messages: [{ role: "user", content: "What is the meaning of life?" }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}Never call the API from browser code with your key — proxy through your own server.