---
title: "Send a message to a conversation in openai format."
method: POST
path: "/api/v1/projects/{projectId}/chat/completions"
tags: ["Conversations"]
---

# Send a message to a conversation in openai format.

`POST /api/v1/projects/{projectId}/chat/completions`

Send a message to a conversation within an agent (formerly known as project) identified by its unique projectId and sessionId. This endpoint enables you to send a new message to a specific conversation, facilitating seamless communication and collaboration within the agent. By providing the projectId and sessionId, you can target the desired conversation and contribute to the ongoing discussion. This API endpoint supports real-time streaming, allowing for instant message delivery and dynamic updates which enables efficient and interactive communication between the user and agent.
Here is an example to send a message to a conversation: [API](https://github.com/Poll-The-People/customgpt-cookbook/blob/main/examples/Create_a_new_conversation_and_send_a_message_to_the_conversation.ipynb) [SDK](https://github.com/Poll-The-People/customgpt-cookbook/blob/main/examples/SDK_Create_a_new_conversation_and_send_a_message_to_the_conversation.ipynb).

## Path parameters

- `projectId` integer, required

## Request body

- object
  - `messages` object[] — The messages to send to OpenAI
    - `role` 'system' | 'user' | 'assistant'
    - `content` string
  - `model` string, nullable — ID of the model to use
  - `stream` boolean — Whether to stream the response
  - `lang` string — Response language
  - `external_id` string, nullable — External identifier
  - `is_inline_citation` boolean — Whether to include inline citations

## Response `200`

OpenAI chat completion response

- object
  - `id` string
  - `object` string
  - `created` integer
  - `model` string, nullable
  - `usage` object
    - `prompt_tokens` integer
    - `completion_tokens` integer
    - `total_tokens` integer
    - `completion_tokens_details` object
      - `reasoning_tokens` integer
      - `accepted_prediction_tokens` integer
      - `rejected_prediction_tokens` integer
  - `choices` object[]
    - `message` object
      - `role` string
      - `content` string
    - `logprobs` string, nullable
    - `finish_reason` string
    - `index` integer

## Other responses

- `400` — Bad Argument
- `401` — API Token is either missing or invalid
- `404` — Agent not found
- `429` — Resource Exhausted when sending a message to a conversation
- `500` — Internal Server Error
- `501` — Unsupported Argument

---

[API](https://skmtc.net/poll-the-people/apis/customgpt-ai.md) · [All operations](https://skmtc.net/poll-the-people/apis/customgpt-ai/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/poll-the-people/customgpt-ai/revisions/b80e6dfcf78d/schema)
