Create Chat Completion
Generate a chat completion based on the provided messages and model parameters.
Body Required
-
The ID of the model to use for chat completion.
-
A list of messages comprising the conversation so far.
-
temperature number
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
Minimum value is
0
, maximum value is2
. Default value is1.0
. -
top_p number
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
Minimum value is
0
, maximum value is1
. Default value is1.0
. -
n integer
How many chat completion choices to generate for each input message.
Minimum value is
1
. Default value is1
. -
stream boolean
If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.
Default value is
false
. -
max_tokens integer
The maximum number of tokens to generate in the chat completion.
Minimum value is
1
. -
presence_penalty number
Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
Minimum value is
-2
, maximum value is2
. Default value is0
. -
frequency_penalty number
Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
Minimum value is
-2
, maximum value is2
. Default value is0
. -
logit_bias object
Modify the likelihood of specified tokens appearing in the completion.
-
user string
A unique identifier representing your end-user, which can help the API to monitor and detect abuse.
-
tools array[object]
A list of tools the model may call. Currently, only functions are supported as a tool.
tool_choice string | object
Controls how the model uses tools.
One of: Controls how the model uses tools. 'auto' allows the model to use tools when appropriate, 'none' disables tool usage.
Values are
auto
ornone
.
curl \
-X POST https://api.rimunace.xyz/v1/chat/completions \
-H "Authorization: $API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"string","messages":[{"role":"system","content":"string","name":"string","tool_call_id":"string","tool_calls":[{"id":"string","type":"function","function":{"name":"string","arguments":"string"}}],"function_call":{"name":"string","arguments":"string"}}],"temperature":1.0,"top_p":1.0,"n":1,"stream":false,"max_tokens":42,"presence_penalty":0,"frequency_penalty":0,"logit_bias":{"additionalProperty1":42.0,"additionalProperty2":42.0},"user":"string","tools":[{"type":"function","function":{"name":"string","parameters":{},"description":"string"}}],"tool_choice":"auto"}'
{
"model": "string",
"messages": [
{
"role": "system",
"content": "string",
"name": "string",
"tool_call_id": "string",
"tool_calls": [
{
"id": "string",
"type": "function",
"function": {
"name": "string",
"arguments": "string"
}
}
],
"function_call": {
"name": "string",
"arguments": "string"
}
}
],
"temperature": 1.0,
"top_p": 1.0,
"n": 1,
"stream": false,
"max_tokens": 42,
"presence_penalty": 0,
"frequency_penalty": 0,
"logit_bias": {
"additionalProperty1": 42.0,
"additionalProperty2": 42.0
},
"user": "string",
"tools": [
{
"type": "function",
"function": {
"name": "string",
"parameters": {},
"description": "string"
}
}
],
"tool_choice": "auto"
}
{
"id": "string",
"object": "chat.completion",
"created": 42,
"model": "string",
"choices": [
{
"index": 42,
"message": {
"role": "system",
"content": "string",
"name": "string",
"tool_call_id": "string",
"tool_calls": [
{
"id": "string",
"type": "function",
"function": {
"name": "string",
"arguments": "string"
}
}
],
"function_call": {
"name": "string",
"arguments": "string"
}
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 42,
"completion_tokens": 42,
"total_tokens": 42
}
}
{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}
{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}
{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}