Chat

Create a chat completion (OpenAI compatible).

post/api/internal/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.

Changes

Changed in 7 of the 19 revisions of this API.13637

    • the response_format request property default value {"type":"text","json_schema":{}} was removed

      request-property-default-value-removed

  • 6fce808cc14e9510See the full diff
    • removed subschema #1 subschema #2 from the tool_choice request property anyOf list

      request-property-any-of-removed

    • request property messages/items/tool_calls/items/type was restricted to a list of enum values

      request-property-became-enum

    • the response property choices/items/logprobs became nullable for the status 200 (media type: text/event-stream)

      response-property-became-nullable

    • the response property choices/items/message/content became nullable for the status 200 (media type: application/json)

      response-property-became-nullable

    • the response property system_fingerprint became nullable for the status 200 (media type: application/json)

      response-property-became-nullable

    • the object response property const value chat.completion was removed for the status 200 (media type: application/json)

      response-property-const-removed

    • the object response property const value chat.completion.chunk was removed for the status 200 (media type: text/event-stream)

      response-property-const-removed

    • the type response property const value function was removed for the status 200 (media type: application/json)

      response-property-const-removed

    • the type response property const value function was removed for the status 200 (media type: text/event-stream)

      response-property-const-removed

    • the max_completion_tokens request property's min was set to 0.00

      request-property-min-set

    • added the new chat.completion enum value to the object response property for the response status 200 (media type: application/json)

      response-property-enum-value-added

    • added the new chat.completion.chunk enum value to the object response property for the response status 200 (media type: text/event-stream)

      response-property-enum-value-added

    • added the new function enum value to the choices/items/delta/tool_calls/items/type response property for the response status 200 (media type: text/event-stream)

      response-property-enum-value-added

    • added the new function enum value to the choices/items/message/tool_calls/items/type response property for the response status 200 (media type: application/json)

      response-property-enum-value-added

    • added subschema #1 subschema #2 to the tool_choice request property anyOf list

      request-property-any-of-added

    • the request property max_completion_tokens became nullable

      request-property-became-nullable

    • the request property messages/items/content became nullable

      request-property-became-nullable

    • the request property response_format/json_schema/additionalProperties/ became nullable

      request-property-became-nullable

    • the request property temperature became nullable

      request-property-became-nullable

    • the request property tools/items/ became nullable

      request-property-became-nullable

    • the request property top_p became nullable

      request-property-became-nullable

    • the type request property const value function was removed

      request-property-const-removed

    • added the new function enum value to the request property messages/items/tool_calls/items/type

      request-property-enum-value-added

    • the max_completion_tokens request property's exclusiveMinimum was decreased from 0.00 to true

      request-property-exclusive-min-decreased

  • 3eac827d87b913See the full diff
    • added the new tool enum value to the choices/items/message/role response property for the response status 200

      response-property-enum-value-added

    • added the optional property choices/items/message/name to the response with the 200 status

      response-optional-property-added

    • added the optional property choices/items/message/tool_call_id to the response with the 200 status

      response-optional-property-added

    • added the optional property choices/items/message/tool_calls to the response with the 200 status

      response-optional-property-added

    • added the new optional request property messages/items/name

      new-optional-request-property

    • added the new optional request property messages/items/tool_call_id

      new-optional-request-property

    • added the new optional request property messages/items/tool_calls

      new-optional-request-property

    • the request property messages/items/content became nullable

      request-property-became-nullable

    • the request property messages/items/content became optional

      request-property-became-optional

    • added the new tool enum value to the request property messages/items/role

      request-property-enum-value-added

  • 6251de8da20038See the full diff
    • the request property messages/items/content became not nullable

      request-property-became-not-nullable

    • the request property messages/items/content became required

      request-property-became-required

    • the messages/items/content request property type/format changed from null/ to string/

      request-property-type-changed

    • added the optional property service_tier to the response with the 200 status

      response-optional-property-added

    • added the optional property system_fingerprint to the response with the 200 status

      response-optional-property-added

    • added the optional property usage to the response with the 200 status

      response-optional-property-added

    • added the required property choices to the response with the 200 status

      response-required-property-added

    • added the required property created to the response with the 200 status

      response-required-property-added

    • added the required property id to the response with the 200 status

      response-required-property-added

    • added the required property model to the response with the 200 status

      response-required-property-added

    • added the required property object to the response with the 200 status

      response-required-property-added

    • added the new optional request property tool_choice

      new-optional-request-property

    • added the new optional request property tools

      new-optional-request-property

  • 70f7bad608d617See the full diff
    • removed the enum value tool of the request property messages/items/role

      request-property-enum-value-removed

    • the request property frequency_penalty became optional

      request-property-became-optional

    • the request property max_completion_tokens became optional

      request-property-became-optional

    • the request property presence_penalty became optional

      request-property-became-optional

    • the request property stream became optional

      request-property-became-optional

    • the request property temperature became optional

      request-property-became-optional

    • the request property top_p became optional

      request-property-became-optional

    • the response_format request property default value {"type":"text","json_schema":{}} was added

      request-property-default-value-added