{
  "openapi": "3.0.3",
  "info": {
    "title": "OpenAI Chat API",
    "version": "1.0.0",
    "description": "OpenAI Chat Completion API including Image Analysis, Streaming, Function Calling, and Logprobs."
  },
  "servers": [
    {
      "url": "https://api.aisa.one/v1"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key"
      }
    }
  },
  "paths": {
    "/chat/completions": {
      "post": {
        "summary": "Create chat completion",
        "description": "Generate chat responses with support for images, streaming, function calling, and logprobs.",
        "operationId": "createChatCompletion",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "example": "gpt-4.1"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "type": "string",
                          "example": "user"
                        },
                        "content": {
                          "description": "Can be a text string or an array (for image inputs).",
                          "oneOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string"
                                  },
                                  "text": {
                                    "type": "string"
                                  },
                                  "image_url": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  },
                  "stream": {
                    "type": "boolean",
                    "example": false
                  },
                  "logprobs": {
                    "type": "boolean"
                  },
                  "top_logprobs": {
                    "type": "integer"
                  },
                  "functions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "parameters": {
                          "type": "object",
                          "properties": {}
                        }
                      }
                    }
                  },
                  "function_call": {
                    "oneOf": [
                      {
                        "type": "string",
                        "example": "auto"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          }
                        }
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful completion"
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Examples"
    }
  ]
}