Create a chat completion.

Set stream: true to receive Server-Sent Events instead of a single JSON response. The optional X-Conversation-Id request header reuses a server-side session across turns when --conversations-max is non-zero.

post/v1/chat/completions

Headers

X-Conversation-Idstring

Stable identifier used to look up a cached session.

Request body

modelstring

Agent name to invoke. Defaults to the team's default agent when missing or unknown.

streamboolean
temperaturenumber

Validated; full runtime plumbing is in progress.

top_pnumber
max_tokensinteger

Response

OK. Either a JSON ChatCompletion or a text/event-stream of chat.completion.chunk events.

idstring required
object'chat.completion' required
createdinteger required
modelstring required

Changes

Changed in 4 of the 6 revisions of this API.215

    • added the new optional request property

      new-optional-request-property

    • added the non-success response with the status

      response-non-success-status-added

  • 5005084f1ab911See the full diff
    • response property choices/items/message/content list-of-types was widened by adding types array to media type application/json of response 200

      response-property-list-of-types-widened

    • request property // list-of-types was widened by adding types array to media type application/json

      request-property-list-of-types-widened

  • 0deddbed852c112See the full diff
    • request property // list-of-types was narrowed by removing types array from media type application/json

      request-property-list-of-types-narrowed

    • removed the request property

      request-property-removed

    • removed the non-success response with the status

      response-non-success-status-removed

    • response property choices/items/message/content list-of-types was narrowed by removing types array from media type application/json of response 200

      response-property-list-of-types-narrowed

    This revision also has 1 change that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog