{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aiand-com/json-schema/aiand-com-create-chat-completion-request-schema.json",
  "title": "CreateChatCompletionRequest",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aiand-com-openapi.json#/components/schemas/CreateChatCompletionRequest",
  "type": "object",
  "properties": {
    "model": {
      "type": "string",
      "description": "ID of the model to use for the chat completion."
    },
    "messages": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ChatCompletionMessage"
      },
      "minItems": 1,
      "description": "A list of messages comprising the conversation so far."
    },
    "stream": {
      "type": [
        "boolean",
        "null"
      ],
      "default": false,
      "description": "If true, partial message deltas will be sent as server-sent events."
    },
    "stream_options": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "include_usage": {
          "type": "boolean"
        }
      }
    },
    "temperature": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "maximum": 2,
      "description": "Sampling temperature between 0 and 2. Higher values make output more random."
    },
    "top_p": {
      "type": [
        "number",
        "null"
      ],
      "exclusiveMinimum": 0,
      "maximum": 1,
      "description": "Nucleus sampling: consider tokens with top_p probability mass. Greater than 0 and at most 1."
    },
    "n": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 1,
      "maximum": 128,
      "description": "How many chat completion choices to generate."
    },
    "max_tokens": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Maximum number of tokens to generate. Deprecated in favor of max_completion_tokens.",
      "deprecated": true
    },
    "max_completion_tokens": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Upper bound for tokens that can be generated, including visible output and reasoning tokens."
    },
    "stop": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1,
          "maxItems": 4
        },
        {
          "type": "null"
        }
      ]
    },
    "frequency_penalty": {
      "type": [
        "number",
        "null"
      ],
      "minimum": -2,
      "maximum": 2,
      "description": "Number between -2.0 and 2.0. Positive values penalize tokens based on existing frequency."
    },
    "presence_penalty": {
      "type": [
        "number",
        "null"
      ],
      "minimum": -2,
      "maximum": 2,
      "description": "Number between -2.0 and 2.0. Positive values penalize tokens based on whether they appear in the text so far."
    },
    "logprobs": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Whether to return log probabilities of the output tokens."
    },
    "top_logprobs": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "maximum": 20,
      "description": "Number of most likely tokens to return at each position (0-20). Requires logprobs=true."
    },
    "response_format": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "text"
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "json_object"
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "json_schema"
            },
            "json_schema": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "strict": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                }
              },
              "required": [
                "name"
              ],
              "additionalProperties": true
            }
          },
          "required": [
            "type",
            "json_schema"
          ]
        }
      ],
      "description": "Output format: { \"type\": \"text\" }, { \"type\": \"json_object\" }, or { \"type\": \"json_schema\", \"json_schema\": {...} }."
    },
    "seed": {
      "type": [
        "integer",
        "null"
      ],
      "description": "If specified, the system will attempt deterministic sampling. Determinism is not guaranteed."
    },
    "tools": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "function"
          },
          "function": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "parameters": {
                "type": "object",
                "additionalProperties": true
              },
              "strict": {
                "type": [
                  "boolean",
                  "null"
                ]
              }
            },
            "required": [
              "name"
            ]
          }
        },
        "required": [
          "type",
          "function"
        ]
      },
      "description": "A list of tools the model may call."
    },
    "tool_choice": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "none",
            "auto",
            "required"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "function"
            },
            "function": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "name"
              ]
            }
          },
          "required": [
            "type",
            "function"
          ]
        }
      ],
      "description": "Controls which tool is called. \"none\", \"auto\", \"required\", or a specific tool object."
    },
    "parallel_tool_calls": {
      "type": "boolean",
      "description": "Whether to enable parallel function calling during tool use."
    },
    "reasoning_effort": {
      "type": "string",
      "enum": [
        "none",
        "minimal",
        "low",
        "medium",
        "high",
        "xhigh",
        "max"
      ],
      "description": "Constrains reasoning effort for reasoning models. The values are per-model — read `reasoning_efforts` from GET /v1/models. Another known level runs at the next listed level up, or the highest, which can cost more; X-Reasoning-Effort reports the level applied. `none` is a 400 unless the model lists it, as is a value outside the vocabulary."
    },
    "top_k": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": -1,
      "description": "Number of highest probability tokens to keep for top-k sampling. -1 to disable."
    },
    "repetition_penalty": {
      "type": [
        "number",
        "null"
      ],
      "description": "Penalizes new tokens based on whether they appear in the generated text so far. Values > 1.0 penalize repetitions."
    },
    "min_tokens": {
      "type": "integer",
      "minimum": 0,
      "description": "Minimum number of tokens to generate before allowing a stop condition."
    },
    "echo": {
      "type": "boolean",
      "description": "If true, the prompt is prepended to the generated output."
    },
    "user": {
      "type": [
        "string",
        "null"
      ],
      "description": "A unique identifier representing your end-user."
    }
  },
  "required": [
    "model",
    "messages"
  ],
  "additionalProperties": true,
  "$defs": {
    "ChatCompletionMessage": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "role": {
              "type": "string",
              "const": "developer"
            },
            "content": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "text"
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ]
                  },
                  "minItems": 1
                }
              ]
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "role",
            "content"
          ]
        },
        {
          "type": "object",
          "properties": {
            "role": {
              "type": "string",
              "const": "system"
            },
            "content": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "text"
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ]
                  },
                  "minItems": 1
                }
              ]
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "role",
            "content"
          ]
        },
        {
          "type": "object",
          "properties": {
            "role": {
              "type": "string",
              "const": "user"
            },
            "content": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "text"
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "text"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "image_url"
                          },
                          "image_url": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string"
                              },
                              "detail": {
                                "type": "string",
                                "enum": [
                                  "auto",
                                  "low",
                                  "high"
                                ],
                                "default": "auto"
                              }
                            },
                            "required": [
                              "url"
                            ]
                          }
                        },
                        "required": [
                          "type",
                          "image_url"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "video_url"
                          },
                          "video_url": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "url"
                            ]
                          }
                        },
                        "required": [
                          "type",
                          "video_url"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "input_audio"
                          },
                          "input_audio": {
                            "type": "object",
                            "properties": {
                              "data": {
                                "type": "string"
                              },
                              "format": {
                                "type": "string",
                                "enum": [
                                  "wav",
                                  "mp3"
                                ]
                              }
                            },
                            "required": [
                              "data",
                              "format"
                            ]
                          }
                        },
                        "required": [
                          "type",
                          "input_audio"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "audio_url"
                          },
                          "audio_url": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "url"
                            ]
                          }
                        },
                        "required": [
                          "type",
                          "audio_url"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "file"
                          },
                          "file": {
                            "type": "object",
                            "properties": {
                              "filename": {
                                "type": "string"
                              },
                              "file_data": {
                                "type": "string"
                              },
                              "file_id": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": true
                          }
                        },
                        "required": [
                          "type",
                          "file"
                        ]
                      }
                    ]
                  },
                  "minItems": 1
                }
              ]
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "role",
            "content"
          ]
        },
        {
          "type": "object",
          "properties": {
            "role": {
              "type": "string",
              "const": "assistant"
            },
            "content": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "text"
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "text"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "refusal"
                          },
                          "refusal": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "refusal"
                        ]
                      }
                    ]
                  },
                  "minItems": 1
                },
                {
                  "type": "null"
                }
              ]
            },
            "refusal": {
              "type": [
                "string",
                "null"
              ]
            },
            "name": {
              "type": "string"
            },
            "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"
                ]
              }
            }
          },
          "required": [
            "role"
          ],
          "additionalProperties": true
        },
        {
          "type": "object",
          "properties": {
            "role": {
              "type": "string",
              "const": "tool"
            },
            "content": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "text"
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ]
                  },
                  "minItems": 1
                }
              ]
            },
            "tool_call_id": {
              "type": "string"
            }
          },
          "required": [
            "role",
            "content",
            "tool_call_id"
          ]
        }
      ]
    }
  }
}