/v1/chat/completionsCreates a model response for the given conversation. Fully compatible with the OpenAI Chat Completions API — existing SDKs work without modification.
| Parameter | Type | Description |
|---|---|---|
modelrequired | string | The model to use. Currently "default" is supported, which maps to google/gemma-3-4b-it via Simplismart. |
messagesrequired | array | Array of message objects. Each has role ("system", "user", or "assistant") and content (string). |
stream | boolean | If true, tokens are sent as server-sent events as they are generated. Defaults to false. |
temperature | number | Sampling temperature between 0 and 2. Higher values produce more random output. Defaults to 1. |
max_tokens | integer | Maximum tokens to generate. Defaults to model maximum if not set. |
top_p | number | Nucleus sampling — only the top-p probability mass is considered. Defaults to 1. |
stop | string | array | Up to 4 sequences where the API will stop generating. Can be a string or array of strings. |
n | integer | Number of chat completion choices to generate. Defaults to 1. |
{
"model": "default",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of France?"}
],
"temperature": 0.7,
"max_tokens": 256,
"stream": false
}Returns a chat.completion object when stream=false, or a stream of chat.completion.chunk events when stream=true.
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1748000000,
"model": "default",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The capital of France is Paris."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 28,
"completion_tokens": 9,
"total_tokens": 37
}
}Each line is a data: event. Read choices[0].delta.content and concatenate chunks until you receive data: [DONE].
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","choices":[{"delta":{"role":"assistant"},"index":0}]}
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","choices":[{"delta":{"content":"The"},"index":0}]}
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","choices":[{"delta":{"content":" capital"},"index":0}]}
data: [DONE]401402422429502