---
title: "Creates a chat conversation."
method: POST
path: "/v1/chat/completions"
tags: ["Chat"]
---

# Creates a chat conversation.

`POST /v1/chat/completions`

## Request body

- CreateChatCompletionRequest
  - `messages` ChatCompletionRequestMessage[], required — A list of messages comprising the conversation so far. Depending on the model you use, different message types (modalities) are supported, like text, images, and audio.
    - union
      - ChatCompletionRequestSystemMessage
        - `content` string, required — The contents of the system message.
        - `role` 'system', required — The role of the messages author, in this case system.
        - `name` string — An optional name for the participant.
      - ChatCompletionRequestUserMessage
        - `content` union, required
          - string — The text contents of the message.
          - ChatCompletionRequestMessageContentPart[] — An array of content parts with a defined type.
            - union
              - …
        - `role` 'user', required — The role of the messages author, in this case user.
        - `name` string — An optional name for the participant.
      - ChatCompletionRequestAssistantMessage
        - `content` string, nullable — The contents of the assistant message.
        - `role` 'assistant', required — The role of the messages author, in this case assistant.
        - `name` string — An optional name for the participant.
        - `tool_calls` ChatCompletionMessageToolCall[] — The tool calls generated by the model, such as function calls.
          - `id` string, required — The ID of the tool call.
          - `type` 'function', required — The type of the tool. Currently, only function is supported.
          - `function` object, required — The function that the model called.
            - `name` string, required — The name of the function to call.
            - `arguments` string, required — The arguments to call the function with, as generated by the model in JSON format.
      - ChatCompletionRequestToolMessage
        - `role` 'tool', required — The role of the messages author, in this case tool.
        - `content` string, required — The contents of the tool message.
        - `tool_call_id` string, required — Tool call that this message is responding to.
  - `model` string, required — Model ID used to generate the response.
  - `frequency_penalty` number, nullable — Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
  - `max_completion_tokens` integer, nullable — An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.
  - `presence_penalty` number, nullable — Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
  - `safety_identifier` string, nullable — A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user.
  - `seed` integer, nullable — If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result.
  - `stream` boolean, nullable — If set to true, the model response data will be streamed to the client as it is generated using server-sent events.
  - `temperature` number, nullable — What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
  - `top_p` number, nullable — An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
  - `top_k` integer, nullable — Top-k sampling parameter. If specified, the sampler considers only the k most likely next tokens at each step. If omitted, the model's configured sampler defaults are used.

## Response `200`

OK

- CreateChatCompletionResponse — Represents a chat completion response returned by model, based on the provided input.
  - `id` string, required — A unique identifier for the chat completion.
  - `choices` object[], required — A list of chat completion choices. Can be more than one if n is greater than 1.
    - `finish_reason` 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call', required — The reason the model stopped generating tokens.
    - `index` integer, required — The index of the choice in the list of choices.
    - `message` ChatCompletionResponseMessage, required — A chat completion message generated by the model.
      - `content` string, nullable, required — The contents of the message.
      - `role` 'assistant', required — The role of the author of this message.
      - `tool_calls` ChatCompletionMessageToolCall[] — The tool calls generated by the model, such as function calls.
        - `id` string, required — The ID of the tool call.
        - `type` 'function', required — The type of the tool. Currently, only function is supported.
        - `function` object, required — The function that the model called.
          - `name` string, required — The name of the function to call.
          - `arguments` string, required — The arguments to call the function with, as generated by the model in JSON format.
  - `created` integer, required — The Unix timestamp (in seconds) of when the chat completion was created.
  - `model` string — The model used for the chat completion.
  - `object` 'chat.completion', required — The object type, which is always chat.completion.
  - `usage` CompletionUsage — Usage statistics for the completion request.
    - `completion_tokens` integer, required — Number of tokens in the generated completion.
    - `prompt_tokens` integer, required — Number of tokens in the prompt.
    - `total_tokens` integer, required — Total number of tokens used in the request (prompt + completion).

---

[API](https://skmtc.net/qualcomm/apis/llm-vlm-genai-microservice-apis.md) · [All operations](https://skmtc.net/qualcomm/apis/llm-vlm-genai-microservice-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/qualcomm/llm-vlm-genai-microservice-apis/revisions/8557fe985a5e/schema)
