v3

latestOpenAPI 3.1.0raw.githubusercontent.com2025-10-0174039.9 KB
ChatCompletion

Generate a chat completion for the given messages using the specified model.

post/chat/completions

Request body

modelstring required

The identifier of the model to use.

streamboolean

If True, generate an SSE event stream of the response. Defaults to False.

repetition_penaltynumber

Controls the likelyhood and generating repetitive responses.

temperaturenumber

Controls randomness of the response by setting a temperature. Higher value leads to more creative responses. Lower values will make the response more focused and deterministic.

top_pnumber

Controls diversity of the response by setting a probability threshold when choosing the next token.

top_kinteger

Only sample from the top K options for each subsequent token.

max_completion_tokensinteger

The maximum number of tokens to generate.

userstring

A unique identifier representing your application end-user for monitoring abuse.

Example request

{
  "messages": [
    {
      "content": [
        {
          "image_url": {
            "url": "https://example.com/image.jpg"
          }
        }
      ]
    }
  ]
}

Response

If stream=False, returns a CreateChatCompletionResponse with the full completion. If stream=True, returns an SSE event stream of CreateChatCompletionResponseStreamChunk

idstring

The unique identifier of the chat completion request.

All 7 operations