Skip to content

Chat Completions API

POST /v1/chat/completions

The /v1/chat/completions endpoint is the central entry point for conversational and text-generation applications. It supports streaming, tool calling, and multimodal input (vision).

ParameterTypeDescription
modelstringModel ID, e.g. vllm/release/gpt-oss-120b
messagesarrayList of messages (role-driven)
temperaturefloatSampling temperature (default: 1.0)
top_pfloatNucleus sampling (default: 1.0)
max_tokensintegerMaximum number of generated tokens
streambooleanEnables SSE streaming
toolsarrayAvailable tools (function definitions)
tool_choicestring/objectControls tool selection

Messages follow a role model with three standard roles:

  • system: controls the model’s behavior and persona
  • user: user input
  • assistant: previous model responses (for multi-turn)
{
"model": "vllm/release/gpt-oss-120b",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of France?"},
{"role": "assistant", "content": "Paris."},
{"role": "user", "content": "How many inhabitants does the city have?"}
]
}
Terminal window
curl -X POST https://ai.noris.de/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "vllm/release/gpt-oss-120b",
"messages": [{"role": "user", "content": "Explain RAG in one sentence."}]
}'
from openai import OpenAI
client = OpenAI(
base_url="https://ai.noris.de/v1",
api_key="YOUR_API_KEY"
)
response = client.chat.completions.create(
model="vllm/release/gpt-oss-120b",
messages=[{"role": "user", "content": "Explain RAG in one sentence."}]
)
print(response.choices[0].message.content)
const response = await fetch("https://ai.noris.de/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
},
body: JSON.stringify({
model: "vllm/release/gpt-oss-120b",
messages: [{role: "user", content: "Explain RAG in one sentence."}]
})
});
const data = await response.json();
console.log(data.choices[0].message.content);

Set "stream": true to receive responses token by token as Server-Sent Events (SSE). This reduces perceived latency, since the first tokens are emitted immediately.

See Streaming for details and examples.

The tools array exposes functions to the model. Based on tool_choice, the model decides whether to invoke a tool and returns the call in the response as tool_calls.

See Tool Calling for details and examples.

For multimodal models, content is passed as an array that can also include image_url entries:

{
"role": "user",
"content": [
{"type": "text", "text": "What does this image show?"},
{"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}}
]
}

See Multimodal for details and examples.

A successful response contains a choices array. Each choice includes the generated message plus finish-reason metadata. The usage block reports the tokens processed:

FieldMeaning
choices[].message.contentGenerated text
choices[].finish_reasonReason for termination (e.g. stop, length)
usage.prompt_tokensInput tokens
usage.completion_tokensGenerated tokens
usage.total_tokensSum of input and output
{
"id": "chatcmpl-...",
"object": "chat.completion",
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": "..."},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 28,
"total_tokens": 40
}
}