Chat Completions
The /chat/completions endpoint is OpenAI-compatible. If your code already talks to OpenAI chat completions, it works here unchanged.
Request
Common fields:
model— a served model id (see Models).messages— array of{role, content}objects (system,user,assistant).max_tokens— max tokens to generate.temperature,top_p,stop— standard sampling controls.stream— settruefor token streaming (see Streaming).
POST https://api.jouledns.com/v1/chat/completions
Authorization: Bearer <your-org-key>
Content-Type: application/json
{
"model": "qwen2.5-7b-instruct",
"messages": [
{"role": "system", "content": "You are concise."},
{"role": "user", "content": "What is an inference router?"}
],
"max_tokens": 256,
"temperature": 0.7
}Response
A standard chat-completion object. The generated text is at choices[0].message.content; token accounting is under usage.
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "qwen2.5-7b-instruct",
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": "..."},
"finish_reason": "stop"
}
],
"usage": {"prompt_tokens": 24, "completion_tokens": 40, "total_tokens": 64}
}The in-console Playground clamps
max_tokens to 512 to keep demo spend small. Direct API calls are bounded only by the model’s own limits.