{
  "components": {
    "schemas": {
      "Candidate": {
        "additionalProperties": true,
        "properties": {
          "content": {
            "$ref": "#/components/schemas/Content"
          },
          "finishReason": {
            "type": "string"
          },
          "index": {
            "type": "integer"
          },
          "safetyRatings": {
            "items": {
              "type": "object"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "Content": {
        "additionalProperties": true,
        "properties": {
          "parts": {
            "items": {
              "$ref": "#/components/schemas/Part"
            },
            "type": "array"
          },
          "role": {
            "enum": [
              "user",
              "model",
              "system",
              "assistant"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "ErrorResponse": {
        "properties": {
          "error": {
            "properties": {
              "code": {
                "type": "integer"
              },
              "message": {
                "type": "string"
              },
              "status": {
                "type": "string"
              }
            },
            "type": "object"
          }
        },
        "type": "object"
      },
      "GenerateContentRequest": {
        "properties": {
          "cachedContent": {
            "description": "可选的缓存内容 ID",
            "type": "string"
          },
          "contents": {
            "description": "对话内容，必填",
            "items": {
              "$ref": "#/components/schemas/Content"
            },
            "type": "array"
          },
          "generationConfig": {
            "$ref": "#/components/schemas/GenerationConfig"
          },
          "safetySettings": {
            "items": {
              "$ref": "#/components/schemas/SafetySetting"
            },
            "type": "array"
          },
          "systemInstruction": {
            "$ref": "#/components/schemas/Content"
          },
          "toolConfig": {
            "description": "可选工具配置",
            "type": "object"
          },
          "tools": {
            "description": "模型可使用的可选工具",
            "items": {
              "$ref": "#/components/schemas/Tool"
            },
            "type": "array"
          }
        },
        "required": [
          "contents"
        ],
        "type": "object"
      },
      "GenerateContentResponse": {
        "additionalProperties": true,
        "properties": {
          "candidates": {
            "items": {
              "$ref": "#/components/schemas/Candidate"
            },
            "type": "array"
          },
          "modelVersion": {
            "type": "string"
          },
          "responseId": {
            "type": "string"
          },
          "usageMetadata": {
            "$ref": "#/components/schemas/UsageMetadata"
          }
        },
        "type": "object"
      },
      "GenerationConfig": {
        "type": "object"
      },
      "Part": {
        "additionalProperties": true,
        "properties": {
          "inline_data": {
            "description": "多模态内容的内联二进制数据。",
            "type": "object"
          },
          "text": {
            "description": "生成或输入的文本内容。",
            "type": "string"
          },
          "thoughtSignature": {
            "description": "提供商生成的思考签名元数据。",
            "type": "string"
          }
        },
        "type": "object"
      },
      "SafetySetting": {
        "type": "object"
      },
      "Tool": {
        "type": "object"
      },
      "UsageMetadata": {
        "additionalProperties": true,
        "properties": {
          "candidatesTokenCount": {
            "type": "integer"
          },
          "promptTokenCount": {
            "type": "integer"
          },
          "totalTokenCount": {
            "type": "integer"
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "bearerFormat": "API Key",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "用于原生 generateContent 请求的 AIsa Gemini 兼容 API。",
    "title": "Gemini-compatible Generate Content API",
    "version": "v1beta"
  },
  "openapi": "3.0.3",
  "paths": {
    "/models/{model}:generateContent": {
      "post": {
        "operationId": "generateContent",
        "parameters": [
          {
            "description": "要使用的 AIsa 模型 ID，例如：gemini-3.5-flash。",
            "in": "path",
            "name": "model",
            "required": true,
            "schema": {
              "example": "gemini-3.5-flash",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateContentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateContentResponse"
                }
              }
            },
            "description": "内容生成成功"
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error response"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "使用兼容 Gemini 的 AIsa 模型生成内容"
      }
    }
  },
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "servers": [
    {
      "description": "Gemini-compatible API base URL",
      "url": "https://api.aisa.one/v1beta"
    }
  ]
}
