---
title: "Call a deployment endpoint with specified tools and messages."
method: POST
path: "/chat"
---

# Call a deployment endpoint with specified tools and messages.

`POST /chat`

## Request body

- ChatRequest
  - `tools` ChatCompletionTool[]
    - `type` 'function', required
    - `function` FunctionObject, required
      - `description` string
      - `name` string, required
      - `parameters` object
  - `messages` Message[], 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` FunctionObject, required
        - `description` string
        - `name` string, required
        - `parameters` object
  - `knowledgebases` string[]
  - `task_id` string

## Response `200`

Successful response

- ModelRunResponse
  - `id` string
  - `object` string
  - `created` integer
  - `model` string
  - `choices` Choice[]
    - `index` integer
    - `message` Message
      - `role` 'system' | 'user' | 'assistant' | 'tool'
      - `content` string
  - `usage` Usage
    - `prompt_tokens` integer
    - `completion_tokens` integer
    - `total_tokens` integer
  - `tool_calls` ToolCall[]
    - `type` 'function'
    - `function` FunctionObject
      - `description` string
      - `name` string, required
      - `parameters` object

## Other responses

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

## Changes

- **2024-07-23** `a94ec435e027` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/propulsion-ai/apis/propulsionai-api/changes/chat/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/a94ec435e027/schema)
