> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.reka.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.reka.ai/_mcp/server.

# Chat

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

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

## Authentication

- `X-Api-Key` header (required) — API Key authentication via header

## Request

### Body (application/json)

This endpoint expects a ChatRequest.

- `messages` (list of ChatMessage-Input, required) — List of messages specifying the conversation so far.
- `model` (string, required) — See [Available Models](/chat/models) for possible values.
- `frequency_penalty` (double, optional, nullable) — Parameter which penalises tokens based on their frequency in the model's output so far. The larger the value, the higher the penalisation. 0.0 means no frequency penalty. Defaults to 0.0.
- `max_tokens` (integer, optional, nullable) — The maximum number of new tokens to be generated by the model. Note that this is limited by the model's context length. Defaults to 1024.
- `presence_penalty` (double, optional, nullable) — Parameter which penalises tokens based on whether they have appeared in the model's output so far. The larger the value, the higher the penalisation. 0.0 means no presence penalty. Defaults to 0.0.
- `seed` (integer, optional, nullable) — Random seed used for generations. The same value forces the model to sample the same output.
- `stop` (list of string, optional, nullable) — A list of stop strings used to control generation. If the model generates one of these, it will stop.
- `stream` (boolean, optional, default: false) — Set to true to enable streaming. See [Chat Streaming](/chat/overview#streaming)
- `temperature` (double, optional, nullable) — Positive number representing the temperature to use for generation. Higher values will make the output more unformly random or *creative*. 0.0 means greedy decoding. Defaults to 0.4.
- `tool_choice` (enum, optional, nullable) — Controls how the model may use the provided tools. Set to 'auto' to let the model decide whether or not to invoke a tool. Set to 'none' to disable tool use. Set to 'tool' to force the model to invoke a tool.
  - Allowed values: `auto`, `tool`, `none`
- `tools` (list of Tool, optional, nullable) — List of tools the model has access to.
- `top_k` (integer, optional, nullable) — Parameter which forces the model to only consider the tokens with the `top_k` highest probabilities at the next step. Defaults to 1024.
- `top_p` (double, optional, nullable) — Parameter used to do nucleus sampling, i.e. only consider tokens comprising the `top_p` probability of the next token's distribution. Defaults to 0.95.

## Response

### 200

Newest response from the model.

- `chat_create_Response_200`

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### ChatMessage-Input

A collection of pieces of content from a single entity (role).

- `role` (enum, required) — What is the role of the particular turn. Supports turns from a person and the model for now
  - Allowed values: `user`, `assistant`, `tool`
- `content` (ChatMessageInputContent, optional, nullable)
- `tool_calls` (list of ToolCall, optional, nullable)

### Tool

The whole tool specification that includes the name of the tool function, a description, and the detailed input schema. An example of a tool function that returns the temperature of a city in a given unit: \{ "name": "get\_weather\_in\_unit", "description": "Get the weather in a given location in the given unit.", "parameters": \{ "type": "object", "properties": \{ "location": \{ "type": "string", "description": "The city and state, e.g. San Francisco, CA" }, "unit": \{ "enum": \["c", "f"], "description": "The unit of temperature, either 'c' (celsius) or 'f' (fahrenheit)" }, } "required": \["location"] } }

- `name` (string, required)
- `parameters` (ToolParameters, required)
- `description` (string, optional, nullable)

### ChatResponse

A chat response.

- `id` (string, required)
- `model` (string, required)
- `choices` (list of MessageResponse, required)
- `usage` (Usage, required) — Type representing usage metadata for a given request.

### ChunkChatResponse

Streaming specialisation of a chat response.

- `id` (string, required)
- `model` (string, required)
- `choices` (list of ChunkMessageResponse, required)
- `usage` (Usage, required) — Type representing usage metadata for a given request.

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### ChatMessageInputContent

### ToolCall

Represents a call to a tool function. Attributes: id (str): Unique identifier for the tool call. name (str): Name of the tool function to be called. parameters (JsonSchemaValue): Parameters to be passed to the tool function.

- `id` (string, required)
- `name` (string, required)
- `parameters` (ToolCallParameters, required)

### ToolParameters

### MessageResponse

Non-streaming response message type

- `index` (integer, required)
- `message` (ChatMessage-Output, required) — A collection of pieces of content from a single entity (role).
- `finish_reason` (enum, optional, nullable) — Enumeration which represents a reason of why the model stopped generating. - `stop` means the model generated a stop token - `length` means the model reached max_tokens number of tokens - `context` means the model reached its maximum context length
  - Allowed values: `stop`, `length`, `context`

### Usage

Type representing usage metadata for a given request.

- `input_tokens` (integer, required)
- `output_tokens` (integer, required)

### ChunkMessageResponse

Streaming response message type

- `index` (integer, required)
- `delta` (ChatMessageChunk, required) — Type that represents a collection of turns from a single entity (role). This is the streaming version.
- `finish_reason` (enum, optional, nullable) — Enumeration which represents a reason of why the model stopped generating. - `stop` means the model generated a stop token - `length` means the model reached max_tokens number of tokens - `context` means the model reached its maximum context length
  - Allowed values: `stop`, `length`, `context`

### ValidationErrorLocItems

### ToolCallParameters

### ChatMessage-Output

A collection of pieces of content from a single entity (role).

- `role` (enum, required) — What is the role of the particular turn. Supports turns from a person and the model for now
  - Allowed values: `user`, `assistant`, `tool`
- `content` (ChatMessageOutputContent, optional, nullable)
- `tool_calls` (list of ToolCall, optional, nullable)

### ChatMessageChunk

Type that represents a collection of turns from a single entity (role). This is the streaming version.

- `role` (enum, required) — What is the role of the particular turn. Supports turns from a person and the model for now
  - Allowed values: `user`, `assistant`, `tool`
- `content` (ChatMessageChunkContent, optional, nullable)
- `tool_calls` (list of ToolCall, optional, nullable)

### ChatMessageOutputContent

### ChatMessageChunkContent

## Examples

### Single turn

**Request**

```json
{
  "messages": [
    {
      "role": "user",
      "content": "What is the fifth prime number?"
    }
  ],
  "model": "reka-flash",
  "stream": false
}
```

**Response**

```json
{
  "id": "a22157d5-6712-4f0d-b6d1-0143e0511986",
  "model": "reka-flash",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "content": " The fifth prime number is 11. Here's a quick breakdown of the first five prime numbers in order: 2, 3, 5, 7, 11.\n\n",
        "role": "assistant"
      }
    }
  ],
  "usage": {
    "input_tokens": 14,
    "output_tokens": 40
  }
}
```

**SDK Code**

```python Single turn
from openai import OpenAI

client = OpenAI(
    base_url="https://api.reka.ai/v1",
    api_key="YOUR_API_KEY",
)

response = client.chat.completions.create(
    model="reka-flash",
    messages=[
        {
            "role": "user",
            "content": "What is the fifth prime number?",
        }
    ],
)
print(response.choices[0].message.content)

```

```javascript Single turn
const url = 'https://api.reka.ai/v1/chat/completions';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"messages":[{"role":"user","content":"What is the fifth prime number?"}],"model":"reka-flash","stream":false}'
};

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

```go Single turn
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"What is the fifth prime number?\"\n    }\n  ],\n  \"model\": \"reka-flash\",\n  \"stream\": false\n}")

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

	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 Single turn
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"What is the fifth prime number?\"\n    }\n  ],\n  \"model\": \"reka-flash\",\n  \"stream\": false\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.reka.ai/v1/chat/completions")
  .header("Content-Type", "application/json")
  .body("{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"What is the fifth prime number?\"\n    }\n  ],\n  \"model\": \"reka-flash\",\n  \"stream\": false\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.reka.ai/v1/chat/completions', [
  'body' => '{
  "messages": [
    {
      "role": "user",
      "content": "What is the fifth prime number?"
    }
  ],
  "model": "reka-flash",
  "stream": false
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Single turn
using RestSharp;

var client = new RestClient("https://api.reka.ai/v1/chat/completions");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"What is the fifth prime number?\"\n    }\n  ],\n  \"model\": \"reka-flash\",\n  \"stream\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Single turn
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "messages": [
    [
      "role": "user",
      "content": "What is the fifth prime number?"
    ]
  ],
  "model": "reka-flash",
  "stream": false
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.reka.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()
```

### Multiple turns

**Request**

```json
{
  "messages": [
    {
      "role": "user",
      "content": "My name is Matt."
    },
    {
      "role": "assistant",
      "content": "Nice to meet you."
    },
    {
      "role": "user",
      "content": "What was my name?"
    }
  ],
  "model": "reka-flash",
  "stream": false
}
```

**Response**

```json
{
  "id": "7cbdff68-c840-4390-ade7-30ffda8fd1c4",
  "model": "reka-flash",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "content": " Hello! Based on the information you provided, your name is Matt. If you have a different name or would like to use a different name, feel free to let me know!\n\n",
        "role": "assistant"
      }
    }
  ],
  "usage": {
    "input_tokens": 32,
    "output_tokens": 39
  }
}
```

**SDK Code**

```python Multiple turns
from openai import OpenAI

client = OpenAI(
    base_url="https://api.reka.ai/v1",
    api_key="YOUR_API_KEY",
)

response = client.chat.completions.create(
    model="reka-flash",
    messages=[
        {"role": "user", "content": "My name is Matt."},
        {"role": "assistant", "content": "Nice to meet you."},
        {"role": "user", "content": "What was my name?"},
    ],
)
print(response.choices[0].message.content)

```

```javascript Multiple turns
const url = 'https://api.reka.ai/v1/chat/completions';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"messages":[{"role":"user","content":"My name is Matt."},{"role":"assistant","content":"Nice to meet you."},{"role":"user","content":"What was my name?"}],"model":"reka-flash","stream":false}'
};

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

```go Multiple turns
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"My name is Matt.\"\n    },\n    {\n      \"role\": \"assistant\",\n      \"content\": \"Nice to meet you.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"What was my name?\"\n    }\n  ],\n  \"model\": \"reka-flash\",\n  \"stream\": false\n}")

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

	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 Multiple turns
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"My name is Matt.\"\n    },\n    {\n      \"role\": \"assistant\",\n      \"content\": \"Nice to meet you.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"What was my name?\"\n    }\n  ],\n  \"model\": \"reka-flash\",\n  \"stream\": false\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.reka.ai/v1/chat/completions")
  .header("Content-Type", "application/json")
  .body("{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"My name is Matt.\"\n    },\n    {\n      \"role\": \"assistant\",\n      \"content\": \"Nice to meet you.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"What was my name?\"\n    }\n  ],\n  \"model\": \"reka-flash\",\n  \"stream\": false\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.reka.ai/v1/chat/completions', [
  'body' => '{
  "messages": [
    {
      "role": "user",
      "content": "My name is Matt."
    },
    {
      "role": "assistant",
      "content": "Nice to meet you."
    },
    {
      "role": "user",
      "content": "What was my name?"
    }
  ],
  "model": "reka-flash",
  "stream": false
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Multiple turns
using RestSharp;

var client = new RestClient("https://api.reka.ai/v1/chat/completions");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"My name is Matt.\"\n    },\n    {\n      \"role\": \"assistant\",\n      \"content\": \"Nice to meet you.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"What was my name?\"\n    }\n  ],\n  \"model\": \"reka-flash\",\n  \"stream\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Multiple turns
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "messages": [
    [
      "role": "user",
      "content": "My name is Matt."
    ],
    [
      "role": "assistant",
      "content": "Nice to meet you."
    ],
    [
      "role": "user",
      "content": "What was my name?"
    ]
  ],
  "model": "reka-flash",
  "stream": false
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.reka.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()
```

### Multimodal

**Request**

```json
{
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "image_url",
          "image_url": "https://v0.docs.reka.ai/_images/000000245576.jpg"
        },
        {
          "type": "text",
          "text": "What animal is this? Answer briefly."
        }
      ]
    }
  ],
  "model": "reka-flash",
  "stream": false
}
```

**Response**

```json
{
  "id": "dc3c498e-36b2-4bc4-8119-e2bcb3fcd5e4",
  "model": "reka-flash",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "content": " The animal in the image is a domestic cat. Specifically, it appears to be a ginger or orange tabby cat, which is characterized by its reddish-brown fur with darker stripes or patches. The cat is engaging in a common feline behavior of sniffing or licking objects, which in this case is a computer keyboard. Cats are known for their curiosity and often explore their environment by using their sense of smell, which is highly developed. The act of licking or sniffing can also be a way for cats to mark their territory with pheromones from their saliva.",
        "role": "assistant"
      }
    }
  ],
  "usage": {
    "input_tokens": 654,
    "output_tokens": 117
  }
}
```

**SDK Code**

```python Multimodal
from openai import OpenAI

client = OpenAI(
    base_url="https://api.reka.ai/v1",
    api_key="YOUR_API_KEY",
)

response = client.chat.completions.create(
    model="reka-flash",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "image_url", "image_url": {"url": "https://v0.docs.reka.ai/_images/000000245576.jpg"}},
                {"type": "text", "text": "What animal is this? Answer briefly."}
            ],
        }
    ],
)
print(response.choices[0].message.content)

```

```javascript Multimodal
const url = 'https://api.reka.ai/v1/chat/completions';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"messages":[{"role":"user","content":[{"type":"image_url","image_url":"https://v0.docs.reka.ai/_images/000000245576.jpg"},{"type":"text","text":"What animal is this? Answer briefly."}]}],"model":"reka-flash","stream":false}'
};

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

```go Multimodal
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"image_url\",\n          \"image_url\": \"https://v0.docs.reka.ai/_images/000000245576.jpg\"\n        },\n        {\n          \"type\": \"text\",\n          \"text\": \"What animal is this? Answer briefly.\"\n        }\n      ]\n    }\n  ],\n  \"model\": \"reka-flash\",\n  \"stream\": false\n}")

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

	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 Multimodal
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"image_url\",\n          \"image_url\": \"https://v0.docs.reka.ai/_images/000000245576.jpg\"\n        },\n        {\n          \"type\": \"text\",\n          \"text\": \"What animal is this? Answer briefly.\"\n        }\n      ]\n    }\n  ],\n  \"model\": \"reka-flash\",\n  \"stream\": false\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.reka.ai/v1/chat/completions")
  .header("Content-Type", "application/json")
  .body("{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"image_url\",\n          \"image_url\": \"https://v0.docs.reka.ai/_images/000000245576.jpg\"\n        },\n        {\n          \"type\": \"text\",\n          \"text\": \"What animal is this? Answer briefly.\"\n        }\n      ]\n    }\n  ],\n  \"model\": \"reka-flash\",\n  \"stream\": false\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.reka.ai/v1/chat/completions', [
  'body' => '{
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "image_url",
          "image_url": "https://v0.docs.reka.ai/_images/000000245576.jpg"
        },
        {
          "type": "text",
          "text": "What animal is this? Answer briefly."
        }
      ]
    }
  ],
  "model": "reka-flash",
  "stream": false
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Multimodal
using RestSharp;

var client = new RestClient("https://api.reka.ai/v1/chat/completions");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"image_url\",\n          \"image_url\": \"https://v0.docs.reka.ai/_images/000000245576.jpg\"\n        },\n        {\n          \"type\": \"text\",\n          \"text\": \"What animal is this? Answer briefly.\"\n        }\n      ]\n    }\n  ],\n  \"model\": \"reka-flash\",\n  \"stream\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Multimodal
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "messages": [
    [
      "role": "user",
      "content": [
        [
          "type": "image_url",
          "image_url": "https://v0.docs.reka.ai/_images/000000245576.jpg"
        ],
        [
          "type": "text",
          "text": "What animal is this? Answer briefly."
        ]
      ]
    ]
  ],
  "model": "reka-flash",
  "stream": false
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.reka.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()
```