---
title: "Call a deployment endpoint with specified tools and messages."
method: POST
path: "/chat/completions"
tags: ["Chat"]
---

# Call a deployment endpoint with specified tools and messages.

`POST /chat/completions`

## Request body

- ChatRequest
  - `tools` ChatCompletionTool[]
    - `type` 'function', required
    - `function` FunctionRequestObject, required
      - `description` string
      - `name` string, required
      - `parameters` object
  - `messages` RequestMessage[], required
    - `role` 'system' | 'user' | 'assistant' | 'tool'
    - `content` string
  - `deployment` string, required
  - `stream` boolean
  - `temperature` number
  - `top_p` number — Probability threshold for token selection in text generation, controlling output randomness.
  - `n` integer
  - `max_tokens` integer
  - `tool_choice` union
    - 'none' | 'auto' | 'required'
    - ChatCompletionNamedToolChoice
      - `type` 'function', required
      - `function` FunctionRequestObject, required
        - `description` string
        - `name` string, required
        - `parameters` object
  - `knowledgebases` string[]
  - `task_id` string

## Response `200`

Successful response

- ChatCompletionResponse
  - `id` string
  - `object` string
  - `created` integer
  - `model` string
  - `task_id` string
  - `choices` Choice[]
    - `index` integer
    - `message` ResponseMessage
      - `role` 'system' | 'user' | 'assistant' | 'tool'
      - `content` string
      - `tool_calls` ToolCall[]
        - `type` 'function'
        - `function` FunctionResponseObject
          - `description` string
          - `name` string, required
          - `arguments` object
  - `usage` Usage
    - `prompt_tokens` integer
    - `completion_tokens` integer
    - `total_tokens` integer

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `500` — Internal Server Error

## Changes

- **2024-07-25** `94dbe6af7da7` — 1 warning, 1 info
  - removed the optional property `choices/items/message/tool_calls/items/function/parameters` from the response with the `200` status
  - added the optional property `choices/items/message/tool_calls/items/function/arguments` to the response with the `200` status
- **2024-07-25** `2e0c0d3d3fd3` — 1 warning, 2 info
  - removed the optional property `tool_calls` from the response with the `200` status
  - added the optional property `choices/items/message/tool_calls` to the response with the `200` status
  - added the optional property `task_id` to the response with the `200` status
- **2024-07-24** `201c8d91a045` — 2 breaking, 5 info
  - the response property `choices/items/message/content` became optional for the status `200`
  - the response property `choices/items/message/role` became optional for the status `200`
  - api operation id `createChatCompletion` removed and replaced with ``
  - the endpoint scheme security `bearerAuth` was added to the API
  - …3 more
- **2024-07-23** `ca4cd347cd3f` — 2 breaking, 5 info
  - the request property `messages/items/content` became required
  - the request property `messages/items/role` became required
  - api operation id `createChatCompletion` was added
  - the endpoint scheme security `apiKeyAuth` was added to the API
  - …3 more
- **2024-07-23** `e8e74f6a79e5` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/propulsion-ai/apis/propulsionai-api/changes/chat/completions/post.md)

---

[API](https://skmtc.dev/propulsion-ai/apis/propulsionai-api.md) · [All operations](https://skmtc.dev/propulsion-ai/apis/propulsionai-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/propulsion-ai/propulsionai-api/revisions/643ad4ee18ac/schema)
