curl --request POST \
--url https://studio.premai.io/api/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"messages": [
{
"role": "system",
"content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "<string>",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"tool_call_id": "<string>"
}
],
"model": "<string>"
}'
{
"id": "<string>",
"choices": [
{
"finish_reason": "stop",
"index": 1,
"message": {
"content": "<string>",
"role": "assistant",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "<string>",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"tool_call_id": "<string>"
}
}
],
"created": 123,
"model": "<string>",
"system_fingerprint": "<string>",
"object": "<string>",
"usage": {
"completion_tokens": 1,
"prompt_tokens": 1,
"total_tokens": 1
}
}
Use this endpoint to generate a chat completion.
curl --request POST \
--url https://studio.premai.io/api/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"messages": [
{
"role": "system",
"content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "<string>",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"tool_call_id": "<string>"
}
],
"model": "<string>"
}'
{
"id": "<string>",
"choices": [
{
"finish_reason": "stop",
"index": 1,
"message": {
"content": "<string>",
"role": "assistant",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "<string>",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"tool_call_id": "<string>"
}
}
],
"created": 123,
"model": "<string>",
"system_fingerprint": "<string>",
"object": "<string>",
"usage": {
"completion_tokens": 1,
"prompt_tokens": 1,
"total_tokens": 1
}
}
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Successful chat completion response (non-streaming). For streaming, use stream=true and expect text/event-stream.
The response is of type object
.
Was this page helpful?