Quickstart
Prepare your environment and make a familiar chat-completions request.
1. Prepare your environment
Use a server-side application or local terminal. Set the base URL supplied by your API operator, including its /api/v1 suffix. Store your key in environment variables; never bundle it in a browser application.
PRISMHUB_BASE_URL="YOUR_PYTHON_SERVER/api/v1"
PRISMHUB_API_KEY="YOUR_SERVER_SIDE_KEY"2. Choose a specific model
Use the exact identifier supported by your configured endpoint. The workspace model directory lists enabled live models and their identifiers. Confirm the selected version’s inputs, context limit, and tool support.
3. Prepare a request
Choose your language below. The TypeScript example uses a runtime with built-in fetch; Python requires the requests package. Replace provider/model-id before running it.
const response = await fetch(
`${process.env.PRISMHUB_BASE_URL}/chat/completions`,
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PRISMHUB_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "provider/model-id",
messages: [
{ role: "user", content: "Build something brilliant." },
],
}),
},
);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const result = await response.json();Reference template. Set a configured base URL ending in /api/v1, a server-side key, and a supported model identifier. This page sends no API requests.
4. Handle the result
Check the HTTP status before parsing a successful response. Read the returned message and usage fields, keep the request identifier for diagnostics, and give your application a finite request deadline.