{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/kymaapi-com/json-schema/kymaapi-com-chat-completion-request-schema.json",
  "title": "ChatCompletionRequest",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/kymaapi-com-openapi.json#/components/schemas/ChatCompletionRequest",
  "type": "object",
  "properties": {
    "model": {
      "type": "string",
      "description": "Exact model ID, e.g. qwen-3.6-plus. See GET /v1/models for the list."
    },
    "messages": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Message"
      },
      "description": "Array of messages in the conversation"
    },
    "temperature": {
      "type": "number",
      "minimum": 0,
      "maximum": 2,
      "default": 1,
      "description": "Sampling temperature. Lower = more focused, higher = more creative"
    },
    "max_tokens": {
      "type": "integer",
      "description": "Maximum tokens to generate. Default 4096. Forwarded directly to model with no gateway cap"
    },
    "stream": {
      "type": "boolean",
      "default": false,
      "description": "Stream response as server-sent events"
    },
    "top_p": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 1,
      "description": "Nucleus sampling parameter"
    },
    "tools": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {}
      },
      "description": "List of tools/functions the model can call. Supported on 15/16 models"
    },
    "response_format": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "text",
            "json_object"
          ]
        }
      },
      "required": [
        "type"
      ],
      "description": "Force output format. Use json_object for structured outputs"
    }
  },
  "required": [
    "model",
    "messages"
  ],
  "$defs": {
    "Message": {
      "type": "object",
      "properties": {
        "role": {
          "type": "string",
          "enum": [
            "system",
            "user",
            "assistant",
            "tool"
          ]
        },
        "content": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {}
              },
              "description": "Multimodal content (text + images)"
            }
          ]
        },
        "tool_calls": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {}
          },
          "description": "Tool calls made by the assistant"
        },
        "tool_call_id": {
          "type": "string",
          "description": "ID of the tool call this message is responding to"
        }
      },
      "required": [
        "role",
        "content"
      ]
    }
  }
}