{
  "openapi": "3.1.1",
  "info": {
    "title": "WebGateway.API | v1",
    "version": "1.0.0"
  },
  "paths": {
    "/v1/Chat/completions": {
      "post": {
        "tags": [
          "Chat"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ChatRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "HTTPBearer": [ ]
          }
        ]
      }
    },
    "/v1/Models": {
      "get": {
        "tags": [
          "Models"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "HTTPBearer": [ ]
          }
        ]
      }
    },
    "/v1/RAG/augmentation": {
      "post": {
        "tags": [
          "RAG"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RAGAugmentationRequestWithoutTenant"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RAGAugmentationRequestWithoutTenant"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RAGAugmentationRequestWithoutTenant"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "HTTPBearer": [ ]
          }
        ]
      }
    },
    "/v1/RAG/completions": {
      "post": {
        "tags": [
          "RAG"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RAGCompletionsRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RAGCompletionsRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RAGCompletionsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "HTTPBearer": [ ]
          }
        ]
      }
    },
    "/v1/RAG/upload": {
      "post": {
        "tags": [
          "RAG"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "HTTPBearer": [ ]
          }
        ]
      }
    },
    "/v1/RAG/delete": {
      "post": {
        "tags": [
          "RAG"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RAGFileDeleteRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RAGFileDeleteRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RAGFileDeleteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "HTTPBearer": [ ]
          }
        ]
      }
    },
    "/v1/RAG/status": {
      "post": {
        "tags": [
          "RAG"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RAGFileStatusRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RAGFileStatusRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RAGFileStatusRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "HTTPBearer": [ ]
          }
        ]
      }
    },
    "/version": {
      "get": {
        "tags": [
          "WebGateway.API"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ChatRequest": {
        "required": [
          "model",
          "messages"
        ],
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "stream": {
            "type": "boolean"
          },
          "temperature": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "float"
          },
          "top_p": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "float"
          },
          "frequency_penalty": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "float"
          },
          "presence_penalty": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "float"
          },
          "max_completion_tokens": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "reasoning_effort": {
            "type": [
              "null",
              "string"
            ]
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatRequestMessage"
            }
          },
          "stream_options": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ChatRequestStreamOptions"
              }
            ]
          },
          "tools": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/JsonObject"
            }
          }
        }
      },
      "ChatRequestMessage": {
        "required": [
          "role"
        ],
        "type": "object",
        "anyOf": [
          {
            "$ref": "#/components/schemas/ChatRequestMessageChatRequestMessageSystem"
          },
          {
            "$ref": "#/components/schemas/ChatRequestMessageChatRequestMessageDeveloper"
          },
          {
            "$ref": "#/components/schemas/ChatRequestMessageChatRequestMessageUser"
          },
          {
            "$ref": "#/components/schemas/ChatRequestMessageChatRequestMessageAssistant"
          },
          {
            "$ref": "#/components/schemas/ChatRequestMessageChatRequestMessageTool"
          }
        ],
        "discriminator": {
          "propertyName": "role",
          "mapping": {
            "system": "#/components/schemas/ChatRequestMessageChatRequestMessageSystem",
            "developer": "#/components/schemas/ChatRequestMessageChatRequestMessageDeveloper",
            "user": "#/components/schemas/ChatRequestMessageChatRequestMessageUser",
            "assistant": "#/components/schemas/ChatRequestMessageChatRequestMessageAssistant",
            "tool": "#/components/schemas/ChatRequestMessageChatRequestMessageTool"
          }
        }
      },
      "ChatRequestMessageChatRequestMessageAssistant": {
        "properties": {
          "role": {
            "enum": [
              "assistant"
            ],
            "type": "string"
          },
          "content": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/PolymorphicChatRequestMessageContent"
              }
            ]
          },
          "name": {
            "type": [
              "null",
              "string"
            ]
          },
          "refusal": {
            "type": [
              "null",
              "string"
            ]
          },
          "tool_calls": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/JsonObject"
            }
          }
        }
      },
      "ChatRequestMessageChatRequestMessageDeveloper": {
        "required": [
          "content"
        ],
        "properties": {
          "role": {
            "enum": [
              "developer"
            ],
            "type": "string"
          },
          "content": {
            "$ref": "#/components/schemas/PolymorphicChatRequestMessageContent"
          },
          "name": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "ChatRequestMessageChatRequestMessageSystem": {
        "required": [
          "content"
        ],
        "properties": {
          "role": {
            "enum": [
              "system"
            ],
            "type": "string"
          },
          "content": {
            "$ref": "#/components/schemas/PolymorphicChatRequestMessageContent"
          },
          "name": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "ChatRequestMessageChatRequestMessageTool": {
        "required": [
          "content",
          "tool_call_id"
        ],
        "properties": {
          "role": {
            "enum": [
              "tool"
            ],
            "type": "string"
          },
          "content": {
            "$ref": "#/components/schemas/PolymorphicChatRequestMessageContent"
          },
          "tool_call_id": {
            "type": "string"
          }
        }
      },
      "ChatRequestMessageChatRequestMessageUser": {
        "required": [
          "content"
        ],
        "properties": {
          "role": {
            "enum": [
              "user"
            ],
            "type": "string"
          },
          "content": {
            "$ref": "#/components/schemas/PolymorphicChatRequestMessageContent"
          },
          "name": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "ChatRequestStreamOptions": {
        "type": "object",
        "properties": {
          "include_usage": {
            "type": [
              "null",
              "boolean"
            ]
          }
        }
      },
      "JsonObject": {
        "type": "object"
      },
      "PolymorphicChatRequestMessageContent": {
        "type": "object"
      },
      "RAGAugmentationRequestWithoutTenant": {
        "type": "object",
        "properties": {
          "top_k": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "collection_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatRequestMessage"
            }
          }
        }
      },
      "RAGCompletionsRequest": {
        "required": [
          "model",
          "messages"
        ],
        "type": "object",
        "properties": {
          "top_k": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "collection_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "model": {
            "type": "string"
          },
          "stream": {
            "type": "boolean"
          },
          "temperature": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "float"
          },
          "top_p": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "float"
          },
          "frequency_penalty": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "float"
          },
          "presence_penalty": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "float"
          },
          "max_completion_tokens": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "reasoning_effort": {
            "type": [
              "null",
              "string"
            ]
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatRequestMessage"
            }
          },
          "stream_options": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ChatRequestStreamOptions"
              }
            ]
          },
          "tools": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/JsonObject"
            }
          }
        }
      },
      "RAGFileDeleteRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "application_id": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "instance_id": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "entity_id": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "RAGFileStatusRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "application_id": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "instance_id": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "entity_id": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      }
    },
    "securitySchemes": {
      "HTTPBearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "tags": [
    {
      "name": "Chat"
    },
    {
      "name": "Models"
    },
    {
      "name": "RAG"
    },
    {
      "name": "WebGateway.API"
    }
  ]
}