Chat Completions API
POST /v1/chat/completionsThe /v1/chat/completions endpoint is the central entry point for conversational and text-generation applications. It supports streaming, tool calling, and multimodal input (vision).
Request Parameters
Section titled “Request Parameters”| Parameter | Type | Description |
|---|---|---|
model | string | Model ID, e.g. vllm/release/gpt-oss-120b |
messages | array | List of messages (role-driven) |
temperature | float | Sampling temperature (default: 1.0) |
top_p | float | Nucleus sampling (default: 1.0) |
max_tokens | integer | Maximum number of generated tokens |
stream | boolean | Enables SSE streaming |
tools | array | Available tools (function definitions) |
tool_choice | string/object | Controls tool selection |
Message Format
Section titled “Message Format”Messages follow a role model with three standard roles:
system: controls the model’s behavior and personauser: user inputassistant: 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?"} ]}Basic Example
Section titled “Basic Example”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."}] }'Python
Section titled “Python”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)JavaScript
Section titled “JavaScript”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);Streaming
Section titled “Streaming”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.
Tool Calling
Section titled “Tool Calling”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.
Multimodal/Vision
Section titled “Multimodal/Vision”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.
Response Structure
Section titled “Response Structure”A successful response contains a choices array. Each choice includes the generated message plus finish-reason metadata. The usage block reports the tokens processed:
| Field | Meaning |
|---|---|
choices[].message.content | Generated text |
choices[].finish_reason | Reason for termination (e.g. stop, length) |
usage.prompt_tokens | Input tokens |
usage.completion_tokens | Generated tokens |
usage.total_tokens | Sum 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 }}