v19

latestOpenAPI 3.1.0raw.githubusercontent.com2025-12-123237122.2 KB
Chat

Create a chat completion (OpenAI compatible).

post/api/v1/chat/completions

Request body

modelstring required

The identifier of the model to use for generating completions. This can be a model ID or an alias.

frequency_penaltynumber

A value between -2.0 and 2.0 that penalizes new tokens based on their frequency in the text so far. Higher values decrease the likelihood of the model repeating the same tokens.

max_completion_tokensinteger nullable

The maximum number of tokens to generate in the completion. If null, will use the model's maximum context length. This is the maximum number of tokens that will be generated.

presence_penaltynumber

A value between -2.0 and 2.0 that penalizes new tokens based on whether they appear in the text so far. Higher values increase the likelihood of the model talking about new topics.

seedinteger

A seed value for deterministic sampling. Using the same seed with the same parameters will generate the same completion.

streamboolean

If true, partial message deltas will be sent as server-sent events. Useful for showing progressive generation in real-time.

temperaturenumber nullable

Controls randomness in the model's output. Values between 0 and 2. Lower values make the output more focused and deterministic, higher values make it more random and creative.

top_pnumber nullable

An alternative to temperature for controlling randomness. Controls the cumulative probability of tokens to consider. Lower values make output more focused.

Response

chat completion response

idstring required

A unique identifier for this chat completion response. Can be used for tracking or debugging.

createdinteger required

The Unix timestamp (in seconds) indicating when this completion was generated by the API.

modelstring required

The specific model used to generate this completion. This will be the model's full identifier string.

system_fingerprintstring nullable

A unique identifier for the system state that generated this response. Useful for tracking model behavior across requests.

object'chat.completion' required

The type of object returned, always "chat.completion" for chat completion responses.