Quickstart
You need an API key, issued after admission. With it, a first call takes three steps: set the key, get the model id, send a chat completion.
1. Set your key
Your key comes with the API host. In the examples, replace API_HOST with it.
export UI_API_KEY="your-key"
Keep the key out of source code. See authentication.
2. Get the model id
curl https://API_HOST/v1/models -H "Authorization: Bearer $UI_API_KEY"
Use the id field of the response wherever the examples say MODEL_ID.
See the models endpoint.
3. Send a chat completion
curl
curl https://API_HOST/v1/chat/completions \
-H "Authorization: Bearer $UI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_ID",
"messages": [{"role": "user", "content": "Summarise the scope document below."}]
}'
Python
Install the OpenAI SDK with pip install openai.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://API_HOST/v1",
api_key=os.environ["UI_API_KEY"],
)
reply = client.chat.completions.create(
model="MODEL_ID", # listed by client.models.list()
messages=[{"role": "user", "content": "Summarise the scope document below."}],
)
print(reply.choices[0].message.content)
Node.js
Install the OpenAI SDK with npm install openai.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://API_HOST/v1",
apiKey: process.env.UI_API_KEY,
});
const reply = await client.chat.completions.create({
model: "MODEL_ID", // listed by client.models.list()
messages: [{ role: "user", content: "Summarise the scope document below." }],
});
console.log(reply.choices[0].message.content);
Next steps
- Stream the response token by token.
- Chat completions reference: parameters and tool calls.
- Migrate an existing OpenAI integration.
- Errors and rate limits.
Last updated: 2 December 2026