API reference
Chat completions
Generate a model response for a conversation. The endpoint accepts the OpenAI Chat Completions request schema and returns a chat.completion object.
Endpoint
POST https://chat.merkium.nl/api/v1/chat/completionsSend a JSON body with Content-Type: application/json and your key in the Authorization header.
Request body
- modelstring, required
- A model ID from GET /models, for example
ganymede-1.1. An unknown ID returns400. - messagesarray, required
- The conversation so far. Each message has a
role(system,user,assistantortool) andcontent. Assistant messages may carrytool_calls, and tool messages carrytool_call_id. See Tool calling. - temperaturenumber, optional
- Sampling temperature from 0 to 2. Higher values give more varied output.
- top_pnumber, optional
- Nucleus sampling from 0 to 1.
- max_tokensinteger, optional
- Maximum number of tokens to generate, from 1 to the model's max output (16,384 for Ganymede 1.1).
- stoparray of strings, optional
- Up to 4 sequences where generation stops.
- streamboolean, optional
- When
true, the response is sent as server-sent events. See Streaming. - toolsarray, optional
- Function tools the model may call, in the OpenAI format.
- tool_choicestring, optional
"auto"lets the model decide whether to call a tool.
Example request
curl https://chat.merkium.nl/api/v1/chat/completions \
-H "Authorization: Bearer $MERKIUM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "ganymede-1.1",
"messages": [
{ "role": "user", "content": "A bat and a ball cost 1.10 in total. The bat costs 1.00 more than the ball. How much does the ball cost? Answer briefly." }
],
"max_tokens": 1500
}'Response
{
"id": "chatcmpl-8c4ff8c20e18",
"object": "chat.completion",
"created": 1792542501,
"model": "ganymede-1.1",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The ball costs **$0.05**.\n\n- Ball: $0.05\n- Bat: $1.05\n- Total: $1.10\n- Difference: $1.00",
"reasoning_content": "The ball costs 0.05."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 2828,
"completion_tokens": 50,
"total_tokens": 2878
}
}- id
- Unique ID for the completion, prefixed with
chatcmpl-. - object
- Always
"chat.completion". - created
- Unix timestamp in seconds.
- model
- The model that produced the response.
- choices[].message.content
- The answer text.
nullwhen the model calls a tool instead. - choices[].message.reasoning_content
- The model's reasoning text, when it returns any. Kept separate from
content. See Reasoning. - choices[].message.tool_calls
- Present when the model calls one or more tools. See Tool calling.
- choices[].finish_reason
"stop"when the model finished its answer,"tool_calls"when it is waiting for tool results,"length"when it reachedmax_tokens.- usage
prompt_tokens,completion_tokensandtotal_tokensfor the request.
Multi-turn conversations
The API is stateless. To continue a conversation, send the full message history each time, appending the assistant's previous reply as a message with role: "assistant". A system message at the start sets instructions for the whole conversation.
[
{ "role": "system", "content": "You are a concise assistant." },
{ "role": "user", "content": "What is the capital of the Netherlands?" },
{ "role": "assistant", "content": "Amsterdam." },
{ "role": "user", "content": "And its largest port?" }
]Questions or problems with the API: mail@merkium.nl. Last verified against the live API on October 20, 2026.