Guides
OpenAI Node SDK
The official OpenAI Node SDK works unchanged. Set the base URL to the AI HUB endpoint and use a Hub key.
Install
Shell
npm install openaiConfigure the client
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.AIHUB_API_KEY,
baseURL: "https://console.aimodelhub.ai/v1",
});
const resp = await client.chat.completions.create({
model: "anthropic-claude-sonnet-4-6",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);Streaming
JavaScript
const stream = await client.chat.completions.create({
model: "anthropic-claude-sonnet-4-6",
messages: [{ role: "user", content: "Hello!" }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}The model must be a published slug. See the Models list.