Integrations/OpenAI SDK

OpenAI SDK

Official SDKs: change base_url only, leave the rest of your code untouched.

Python

python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://www.starunion.net/v1",
)

resp = client.chat.completions.create(
    model="YOUR_MODEL_ID",
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)

Node.js

javascript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.BIGMODEL_API_KEY,
  baseURL: "https://www.starunion.net/v1",
});

const resp = await client.chat.completions.create({
  model: "YOUR_MODEL_ID",
  messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);

cURL

bash
curl https://www.starunion.net/v1/chat/completions -H "Authorization: Bearer $BIGMODEL_API_KEY" -H "Content-Type: application/json" -d "{\"model\":\"YOUR_MODEL_ID\",\"messages\":[{\"role\":\"user\",\"content\":\"Hello\"}]}"

Full parameter reference: API docs → Chat Completions.

Updated: 2026-08-24