Language models (OpenAI-compatible)¶
Every chat model in the catalog - open models and Claude, GPT and Gemini alike -
answers at an OpenAI-compatible endpoint. Point any OpenAI client at
https://api.factorialcompute.com/v1 with your Factorial key:
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.factorialcompute.com/v1",
apiKey: process.env.FACTORIAL_API_KEY,
});
const reply = await client.chat.completions.create({
model: "glm-5.3-flash",
messages: [{ role: "user", content: "Name three uses for a forklift." }],
});
console.log(reply.choices[0].message.content);
from openai import OpenAI
client = OpenAI(base_url="https://api.factorialcompute.com/v1",
api_key=os.environ["FACTORIAL_API_KEY"])
reply = client.chat.completions.create(
model="glm-5.3-flash",
messages=[{"role": "user", "content": "Name three uses for a forklift."}])
print(reply.choices[0].message.content)
curl https://api.factorialcompute.com/v1/chat/completions \
-H "Authorization: Bearer $FACTORIAL_API_KEY" -H "Content-Type: application/json" \
-d '{"model": "glm-5.3-flash", "messages": [{"role": "user", "content": "Hello"}]}'
Streaming, tools and response_format pass through. Embeddings are at
/v1/embeddings.
Reasoning models
Many of these models think before they answer, and the thinking counts
against max_tokens. Too low a cap is spent thinking and the answer comes
back empty - the reasoning is in reasoning_content. Leave room, or leave
max_tokens out.
Pictures and video in the same call¶
The OpenAI format takes images as URLs or data URIs. To use a file you have
uploaded, or another model's answer - a cut-out, a frame from a video - call the
same models through POST /v1/executions instead, which takes media ids and run
ids directly. See Chaining models.