{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/spicyapi/main/json-schema/spicyapi-chat-completion-request-schema.json",
  "title": "ChatCompletionRequest",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/spicyapi-openapi.yml#/components/schemas/ChatCompletionRequest",
  "type": "object",
  "required": [
    "model",
    "messages"
  ],
  "properties": {
    "model": {
      "type": "string"
    },
    "messages": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "role"
        ],
        "properties": {
          "role": {
            "type": "string"
          },
          "content": {
            "oneOf": [
              {
                "type": [
                  "string",
                  "null"
                ]
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            ]
          },
          "tool_call_id": {
            "type": "string"
          },
          "tool_calls": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "reasoning_content": {
            "type": "string",
            "description": "Optional assistant reasoning text; availability and message roles follow the selected model input schema."
          }
        },
        "additionalProperties": true
      }
    },
    "stream": {
      "type": "boolean",
      "default": false
    },
    "max_tokens": {
      "type": "integer"
    },
    "max_completion_tokens": {
      "type": "integer",
      "description": "Alias of `max_tokens`."
    },
    "temperature": {
      "type": "number"
    },
    "top_p": {
      "type": "number"
    },
    "top_k": {
      "type": "integer",
      "description": "Sample only from the k most likely next tokens; only on models that declare it."
    },
    "seed": {
      "type": "integer",
      "description": "Best-effort repeatable sampling; only on models that declare it."
    },
    "stop": {
      "description": "Up to 4 stop sequences (some models accept only one); only on models that declare it.",
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      ]
    },
    "tools": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "tool_choice": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "object",
          "additionalProperties": true
        }
      ]
    },
    "parallel_tool_calls": {
      "type": "boolean",
      "description": "Set false to allow at most one tool call per turn; only on models that declare it."
    },
    "response_format": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "additionalProperties": {
    "description": "Forwarded to the model input schema and rejected when undeclared."
  }
}