> This page is also available as Markdown: append .md to its URL. The full index of Sikaru docs is at https://docs.sikaru.ai/llms.txt. Code examples use only operations from the public API reference at https://docs.sikaru.ai/api-reference.

# Chat

POST https://api.sikaru.ai/v1/chat/completions
Content-Type: application/json

Reference: https://docs.sikaru.ai/api-reference/chat/completions/create

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Body (application/json)

This endpoint expects an object.

- `messages` (list of map from string to any, required)
- `model` (string, required)
- `stream` (false, required)
- `audio` (map from string to any, optional, nullable)
- `frequency_penalty` (double, optional, nullable)
- `function_call` (V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaFunctionCall, optional, nullable)
- `functions` (list of map from string to any, optional, nullable)
- `include_reasoning` (boolean, optional, nullable)
- `logit_bias` (map from string to any, optional, nullable)
- `logprobs` (boolean, optional, nullable)
- `max_completion_tokens` (integer, optional, nullable)
- `max_tokens` (integer, optional, nullable)
- `metadata` (map from string to any, optional, nullable)
- `min_p` (double, optional, nullable)
- `modalities` (list of string, optional, nullable)
- `models` (list of string, optional, nullable)
- `moderation` (map from string to any, optional, nullable)
- `n` (integer, optional, nullable)
- `parallel_tool_calls` (boolean, optional, nullable)
- `prediction` (map from string to any, optional, nullable)
- `presence_penalty` (double, optional, nullable)
- `prompt_cache_key` (string, optional, nullable)
- `prompt_cache_options` (map from string to any, optional, nullable)
- `prompt_cache_retention` (string, optional, nullable)
- `provider` (map from string to any, optional, nullable)
- `reasoning` (map from string to any, optional, nullable)
- `reasoning_effort` (V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaReasoningEffort, optional, nullable)
- `reasoning_history` (enum, optional, nullable)
  - Allowed values: `disabled`, `interleaved`, `preserved`
- `repetition_penalty` (double, optional, nullable)
- `response_format` (map from string to any, optional, nullable)
- `route` (string, optional, nullable)
- `safety_identifier` (string, optional, nullable)
- `seed` (integer, optional, nullable)
- `service_tier` (string, optional, nullable)
- `stop` (V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaStop, optional, nullable)
- `store` (boolean, optional, nullable)
- `stream_options` (map from string to any, optional, nullable)
- `temperature` (double, optional, nullable)
- `thinking` (map from string to any, optional, nullable)
- `tool_choice` (V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaToolChoice, optional, nullable)
- `tools` (list of map from string to any, optional, nullable)
- `top_k` (integer, optional, nullable)
- `top_logprobs` (integer, optional, nullable)
- `top_p` (double, optional, nullable)
- `transforms` (list of string, optional, nullable)
- `typical_p` (double, optional, nullable)
- `usage` (map from string to any, optional, nullable)
- `user` (string, optional, nullable)
- `verbosity` (string, optional, nullable)
- `web_search_options` (map from string to any, optional, nullable)

## Response

### 200

- `id` (string, required)
- `object` (string, required)
- `choices` (list of ChatCompletionChoice, optional, nullable)
- `created` (integer, optional, nullable)
- `model` (string, optional, nullable)
- `usage` (CompletionUsage, optional, nullable) — Public CreateChatCompletionResponse fields at this level (CHAT_USAGE_FIELDS); the projection omits the rest.

## Types

### V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaFunctionCall

- string
- map from string to any

### V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaReasoningEffort

- boolean
- integer
- string

### V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaStop

- string
- list of string

### V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaToolChoice

- string
- map from string to any

### ChatCompletionChoice

Public CreateChatCompletionResponse fields at this level (CHAT_CHOICE_FIELDS); the projection omits the rest.

- `finish_reason` (string, optional, nullable)
- `index` (integer, optional, nullable)
- `logprobs` (map from string to any, optional, nullable)
- `message` (ChatCompletionMessage, optional, nullable) — Public CreateChatCompletionResponse fields at this level (CHAT_MESSAGE_FIELDS); the projection omits the rest.

### CompletionUsage

Public CreateChatCompletionResponse fields at this level (CHAT_USAGE_FIELDS); the projection omits the rest.

- `completion_tokens` (integer, optional, nullable)
- `completion_tokens_details` (map from string to any, optional, nullable)
- `prompt_tokens` (integer, optional, nullable)
- `prompt_tokens_details` (map from string to any, optional, nullable)
- `total_tokens` (integer, optional, nullable)

### ChatCompletionMessage

Public CreateChatCompletionResponse fields at this level (CHAT_MESSAGE_FIELDS); the projection omits the rest.

- `annotations` (list of map from string to any, optional, nullable)
- `audio` (map from string to any, optional, nullable)
- `content` (string, optional, nullable)
- `function_call` (map from string to any, optional, nullable)
- `reasoning_content` (string, optional, nullable)
- `refusal` (string, optional, nullable)
- `role` (string, optional, nullable)
- `tool_calls` (list of map from string to any, optional, nullable)

## Examples

**Request**

```json
{
  "messages": [
    {}
  ],
  "model": "string",
  "stream": false
}
```

**SDK Code**

```python
import requests

url = "https://api.sikaru.ai/v1/chat/completions"

payload = {
    "messages": [{}],
    "model": "string",
    "stream": False
}
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.sikaru.ai/v1/chat/completions';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"messages":[{}],"model":"string","stream":false}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.sikaru.ai/v1/chat/completions"

	payload := strings.NewReader("{\n  \"messages\": [\n    {}\n  ],\n  \"model\": \"string\",\n  \"stream\": false\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.sikaru.ai/v1/chat/completions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"messages\": [\n    {}\n  ],\n  \"model\": \"string\",\n  \"stream\": false\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.sikaru.ai/v1/chat/completions")
  .header("Authorization", "Bearer <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"messages\": [\n    {}\n  ],\n  \"model\": \"string\",\n  \"stream\": false\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.sikaru.ai/v1/chat/completions', [
  'body' => '{
  "messages": [
    {}
  ],
  "model": "string",
  "stream": false
}',
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.sikaru.ai/v1/chat/completions");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"messages\": [\n    {}\n  ],\n  \"model\": \"string\",\n  \"stream\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "messages": [[]],
  "model": "string",
  "stream": false
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.sikaru.ai/v1/chat/completions")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```