Create a chat completion
Request a chat completion. Supports tools and tool_choice for function calling, and reasoning_effort for reasoning models. Body follows ChatCompletionsRequest.
curl --request POST \
--url https://api.synapsai.cloud/v1/chat/completions \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{}
],
"temperature": 123,
"top_p": 123,
"top_k": 123,
"max_completion_tokens": 123,
"stream": false,
"frequency_penalty": 123,
"presence_penalty": 123,
"logit_bias": {},
"logprobs": false,
"top_logprobs": 123,
"stop": "<string>",
"seed": 123,
"tools": [
{
"type": "function"
}
]
}
'import requests
url = "https://api.synapsai.cloud/v1/chat/completions"
payload = {
"messages": [{}],
"temperature": 123,
"top_p": 123,
"top_k": 123,
"max_completion_tokens": 123,
"stream": False,
"frequency_penalty": 123,
"presence_penalty": 123,
"logit_bias": {},
"logprobs": False,
"top_logprobs": 123,
"stop": "<string>",
"seed": 123,
"tools": [{ "type": "function" }]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"object": "chat.completion",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "<string>",
"content": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
]
},
"logprobs": {
"content": [
{
"token": "<string>",
"logprob": 123,
"top_logprobs": {}
}
]
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}Body
Request body for chat completions endpoint describing conversation and generation parameters.
List of messages (role + content) forming the chat history. Required.
Sampling temperature; higher values increase randomness.
Nucleus sampling cumulative probability threshold.
Keep only the top_k tokens by probability at each generation step.
Maximum number of tokens the model may generate for the completion.
If true, the server may stream partial responses as they are generated.
Penalty applied based on frequency of tokens to reduce repetition.
Penalty applied to discourage new token presence (encourages topic shifting).
Mapping from token id (string or int) to a bias value added to the token logits.
Show child attributes
Show child attributes
If true, include logprob information in the response.
Return the top N token logprobs at each position if logprobs enabled.
Stop sequence or list of sequences where generation should halt.
Optional random seed for reproducibility.
Optional list of tool/function definitions that the model may call.
Show child attributes
Show child attributes
Controls which tool the model calls: auto, none, required, or a specific function.
auto, none, required Constrains reasoning depth for supported reasoning models. Higher values generally increase quality and latency.
none, minimal, low, medium, high, xhigh Response
Chat completion response
Response schema for the chat completions endpoint.
Unique identifier for this chat completion.
Type of the returned object; defaults to 'chat.completion'.
Unix timestamp (seconds) of creation.
Model identifier used to generate the chat response.
List of chat choices returned by the model.
Show child attributes
Show child attributes
Token usage details for the chat completion.
Show child attributes
Show child attributes
curl --request POST \
--url https://api.synapsai.cloud/v1/chat/completions \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{}
],
"temperature": 123,
"top_p": 123,
"top_k": 123,
"max_completion_tokens": 123,
"stream": false,
"frequency_penalty": 123,
"presence_penalty": 123,
"logit_bias": {},
"logprobs": false,
"top_logprobs": 123,
"stop": "<string>",
"seed": 123,
"tools": [
{
"type": "function"
}
]
}
'import requests
url = "https://api.synapsai.cloud/v1/chat/completions"
payload = {
"messages": [{}],
"temperature": 123,
"top_p": 123,
"top_k": 123,
"max_completion_tokens": 123,
"stream": False,
"frequency_penalty": 123,
"presence_penalty": 123,
"logit_bias": {},
"logprobs": False,
"top_logprobs": 123,
"stop": "<string>",
"seed": 123,
"tools": [{ "type": "function" }]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"object": "chat.completion",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "<string>",
"content": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
]
},
"logprobs": {
"content": [
{
"token": "<string>",
"logprob": 123,
"top_logprobs": {}
}
]
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}