{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-openai/json-schema/microsoft-azure-openai-create-chat-completion-stream-response-schema.json",
  "title": "createChatCompletionStreamResponse",
  "description": "Represents a streamed chunk of a chat completion response returned by model, based on the provided input.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-openai-deployments-api-openapi.yml#/components/schemas/createChatCompletionStreamResponse",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "A unique identifier for the chat completion. Each chunk has the same ID."
    },
    "choices": {
      "type": "array",
      "description": "A list of chat completion choices. Can contain more than one elements if `n` is greater than 1.\n",
      "items": {
        "type": "object",
        "required": [
          "delta",
          "finish_reason",
          "index"
        ],
        "properties": {
          "delta": {
            "$ref": "#/$defs/chatCompletionStreamResponseDelta"
          },
          "logprobs": {
            "description": "Log probability information for the choice.",
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "content": {
                "description": "A list of message content tokens with log probability information.",
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "$ref": "#/$defs/chatCompletionTokenLogprob"
                }
              },
              "refusal": {
                "description": "A list of message refusal tokens with log probability information.",
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "$ref": "#/$defs/chatCompletionTokenLogprob"
                }
              }
            },
            "required": [
              "content",
              "refusal"
            ]
          },
          "finish_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\n",
            "enum": [
              "stop",
              "length",
              "tool_calls",
              "content_filter",
              "function_call",
              null
            ]
          },
          "index": {
            "type": "integer",
            "description": "The index of the choice in the list of choices."
          }
        }
      }
    },
    "created": {
      "type": "integer",
      "description": "The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp."
    },
    "model": {
      "type": "string",
      "description": "The model to generate the completion."
    },
    "system_fingerprint": {
      "type": "string",
      "description": "This fingerprint represents the backend configuration that the model runs with.\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n"
    },
    "object": {
      "type": "string",
      "description": "The object type, which is always `chat.completion.chunk`.",
      "enum": [
        "chat.completion.chunk"
      ],
      "required": [
        "prompt_tokens",
        "completion_tokens",
        "total_tokens"
      ]
    }
  },
  "required": [
    "choices",
    "created",
    "id",
    "model",
    "object"
  ],
  "$defs": {
    "chatCompletionMessageToolCallChunk": {
      "type": "object",
      "properties": {
        "index": {
          "type": "integer"
        },
        "id": {
          "type": "string",
          "description": "The ID of the tool call."
        },
        "type": {
          "type": "string",
          "enum": [
            "function"
          ],
          "description": "The type of the tool. Currently, only `function` is supported."
        },
        "function": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "The name of the function to call."
            },
            "arguments": {
              "type": "string",
              "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."
            }
          }
        }
      },
      "required": [
        "index"
      ]
    },
    "chatCompletionStreamResponseDelta": {
      "type": "object",
      "description": "A chat completion delta generated by streamed model responses.",
      "properties": {
        "content": {
          "type": [
            "string",
            "null"
          ],
          "description": "The contents of the chunk message."
        },
        "function_call": {
          "deprecated": true,
          "type": "object",
          "description": "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.",
          "properties": {
            "arguments": {
              "type": "string",
              "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."
            },
            "name": {
              "type": "string",
              "description": "The name of the function to call."
            }
          }
        },
        "tool_calls": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/chatCompletionMessageToolCallChunk"
          }
        },
        "role": {
          "type": "string",
          "enum": [
            "system",
            "user",
            "assistant",
            "tool"
          ],
          "description": "The role of the author of this message."
        },
        "refusal": {
          "type": [
            "string",
            "null"
          ],
          "description": "The refusal message generated by the model."
        }
      }
    },
    "chatCompletionTokenLogprob": {
      "type": "object",
      "properties": {
        "token": {
          "description": "The token.",
          "type": "string"
        },
        "logprob": {
          "description": "The log probability of this token.",
          "type": "number"
        },
        "bytes": {
          "description": "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "integer"
          }
        },
        "top_logprobs": {
          "description": "List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "token": {
                "description": "The token.",
                "type": "string"
              },
              "logprob": {
                "description": "The log probability of this token.",
                "type": "number"
              },
              "bytes": {
                "description": "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.",
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "integer"
                }
              }
            },
            "required": [
              "token",
              "logprob",
              "bytes"
            ]
          }
        }
      },
      "required": [
        "token",
        "logprob",
        "bytes",
        "top_logprobs"
      ]
    }
  }
}