{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aiand-com/json-schema/aiand-com-create-chat-completion-response-schema.json",
  "title": "CreateChatCompletionResponse",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aiand-com-openapi.json#/components/schemas/CreateChatCompletionResponse",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "object": {
      "type": "string",
      "const": "chat.completion"
    },
    "created": {
      "type": "integer"
    },
    "model": {
      "type": "string"
    },
    "choices": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "finish_reason": {
            "type": "string",
            "enum": [
              "stop",
              "length",
              "tool_calls",
              "content_filter",
              "function_call"
            ]
          },
          "index": {
            "type": "integer"
          },
          "message": {
            "type": "object",
            "properties": {
              "role": {
                "type": "string",
                "const": "assistant"
              },
              "content": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "refusal": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "tool_calls": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "const": "function"
                    },
                    "function": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "arguments": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "name",
                        "arguments"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "type",
                    "function"
                  ]
                }
              },
              "annotations": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "url_citation"
                    },
                    "url_citation": {
                      "type": "object",
                      "properties": {
                        "end_index": {
                          "type": "integer"
                        },
                        "start_index": {
                          "type": "integer"
                        },
                        "url": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "end_index",
                        "start_index",
                        "url",
                        "title"
                      ]
                    }
                  },
                  "required": [
                    "type",
                    "url_citation"
                  ]
                }
              }
            },
            "required": [
              "role",
              "content"
            ],
            "additionalProperties": true
          },
          "logprobs": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "content": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string"
                    },
                    "logprob": {
                      "type": "number"
                    },
                    "bytes": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "integer"
                      }
                    }
                  },
                  "required": [
                    "token",
                    "logprob"
                  ],
                  "additionalProperties": true
                }
              },
              "refusal": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string"
                    },
                    "logprob": {
                      "type": "number"
                    },
                    "bytes": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "integer"
                      }
                    }
                  },
                  "required": [
                    "token",
                    "logprob"
                  ],
                  "additionalProperties": true
                }
              }
            },
            "required": [
              "content",
              "refusal"
            ]
          }
        },
        "required": [
          "finish_reason",
          "index",
          "message",
          "logprobs"
        ]
      }
    },
    "usage": {
      "$ref": "#/$defs/CompletionUsage"
    },
    "system_fingerprint": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "object",
    "created",
    "model",
    "choices"
  ],
  "additionalProperties": true,
  "$defs": {
    "CompletionUsage": {
      "type": "object",
      "properties": {
        "prompt_tokens": {
          "type": "integer"
        },
        "completion_tokens": {
          "type": "integer"
        },
        "total_tokens": {
          "type": "integer"
        },
        "prompt_tokens_details": {
          "type": "object",
          "properties": {
            "cached_tokens": {
              "type": "integer"
            },
            "audio_tokens": {
              "type": "integer"
            }
          },
          "additionalProperties": true
        },
        "completion_tokens_details": {
          "type": "object",
          "properties": {
            "reasoning_tokens": {
              "type": "integer"
            },
            "audio_tokens": {
              "type": "integer"
            },
            "accepted_prediction_tokens": {
              "type": "integer"
            },
            "rejected_prediction_tokens": {
              "type": "integer"
            }
          },
          "additionalProperties": true
        }
      },
      "required": [
        "prompt_tokens",
        "completion_tokens",
        "total_tokens"
      ]
    }
  }
}