---
title: "Inference: Chat Completion"
method: POST
path: "/chat/completions"
tags: ["chat completions"]
---

# Inference: Chat Completion

`POST /chat/completions`

## Request

- Base URL: `https://inference-api.nousresearch.com/v1`
- URL: `https://inference-api.nousresearch.com/v1/chat/completions`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/nousresearch/apis/nous-research-inference-api/docs/chat/completions/post.ts> (a function with typed inputs; its response is checked against the schema)

Compatible with the [OpenAI Chat API](https://platform.openai.com/docs/api-reference/chat).

## Request body

- object
  - `model` string, required: The model to use for the request.
  - `messages` object[], required: List of messages comprising the conversation.
    - `role` 'system' | 'user' | 'assistant', required: The role of the message sender.
    - `content` string, required: The content of the message.
  - `temperature` number: Sampling temperature to use. Must be between 0.0 and 2.0.
  - `max_tokens` integer: The maximum number of tokens to generate. Must be between 1 and 32000.
  - `stream` boolean: Whether to stream responses incrementally.

## Response `200`

Successful Response

- object
  - `id` string: Unique identifier for the response.
  - `object` string
  - `created` integer: Timestamp of response creation.
  - `model` string: The model used.
  - `choices` object[]
    - `index` integer
    - `message` object
      - `role` string
      - `content` string
    - `finish_reason` string

---

[API](https://skmtc.dev/nousresearch/apis/nous-research-inference-api.md) - [All operations](https://skmtc.dev/nousresearch/apis/nous-research-inference-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nousresearch/apis/nous-research-inference-api/revisions/6817833021cd?raw)
