v1

latestOpenAPI 3.0.32026-07-2672219.4 KB
Chat

Creates a chat conversation.

post/v1/chat/completions

Request body

modelstring required

Model ID used to generate the response.

frequency_penaltynumber 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_tokensinteger nullable

An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.

presence_penaltynumber 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_identifierstring 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.

seedinteger 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.

streamboolean nullable

If set to true, the model response data will be streamed to the client as it is generated using server-sent events.

temperaturenumber 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_pnumber 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_kinteger 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.

Example request

{
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "What is in this image?"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://images.pexels.com/photos/210186/pexels-photo-210186.jpeg?cs=srgb&dl=cascade-clouds-cool-wallpaper-210186.jpg&fm=jpg%22"
          }
        }
      ]
    }
  ],
  "model": "qwen2.5-vl-3b",
  "seed": 42
}

Response

OK

idstring required

A unique identifier for the chat completion.

createdinteger required

The Unix timestamp (in seconds) of when the chat completion was created.

modelstring

The model used for the chat completion.

object'chat.completion' required

The object type, which is always chat.completion.