{
  "repo": "tidbcloud/aipower",
  "binary": "api",
  "binary_path": "cmd/api/main.go",
  "surface_kind": "mixed_service",
  "type": "mixed_service",
  "extensions": {},
  "services": [
    {
      "name": "AIPowerLifecycle",
      "type": "lifecycle",
      "methods": [
        {
          "name": "LoadFlags",
          "name_key": "AIPowerLifecycle.LoadFlags",
          "description": "Parse the api binary startup flags, including config-path."
        },
        {
          "name": "InitConfig",
          "name_key": "AIPowerLifecycle.InitConfig",
          "description": "Load aipower configuration from the configured file path."
        },
        {
          "name": "InitOpenAIClient",
          "name_key": "AIPowerLifecycle.InitOpenAIClient",
          "description": "Initialize the global OpenAI client from message-service config."
        },
        {
          "name": "InitRedisClient",
          "name_key": "AIPowerLifecycle.InitRedisClient",
          "description": "Initialize the global Redis client used for streamed completion status."
        },
        {
          "name": "ConnectMySQL",
          "name_key": "AIPowerLifecycle.ConnectMySQL",
          "description": "Connect GORM to the configured MySQL database."
        },
        {
          "name": "RunMigrate",
          "name_key": "AIPowerLifecycle.RunMigrate",
          "description": "Apply database migrations when server.runMigrate is enabled."
        },
        {
          "name": "InitMeasureReport",
          "name_key": "AIPowerLifecycle.InitMeasureReport",
          "description": "Initialize measure reporting and start the scheduled measure sender worker."
        },
        {
          "name": "SetupSentry",
          "name_key": "AIPowerLifecycle.SetupSentry",
          "description": "Initialize logger and Sentry integration."
        },
        {
          "name": "StartupTracing",
          "name_key": "AIPowerLifecycle.StartupTracing",
          "description": "Initialize Jaeger tracing."
        },
        {
          "name": "StartupMetrics",
          "name_key": "AIPowerLifecycle.StartupMetrics",
          "description": "Start the dedicated metrics HTTP server."
        },
        {
          "name": "StartupHTTP",
          "name_key": "AIPowerLifecycle.StartupHTTP",
          "description": "Register HTTP routes and start the dedicated HTTP API server."
        },
        {
          "name": "BuildGRPCServer",
          "name_key": "AIPowerLifecycle.BuildGRPCServer",
          "description": "Construct the gRPC server with default and unary error interceptors."
        },
        {
          "name": "RegisterGRPCServices",
          "name_key": "AIPowerLifecycle.RegisterGRPCServices",
          "description": "Register the ChatBotService implementation on the gRPC server."
        },
        {
          "name": "StartupGRPC",
          "name_key": "AIPowerLifecycle.StartupGRPC",
          "description": "Listen on the gRPC port, register reflection, and serve requests."
        }
      ]
    },
    {
      "name": "HealthAPI",
      "type": "http",
      "base_path": "/",
      "methods": [
        {
          "name": "Healthz",
          "name_key": "HealthAPI.Healthz",
          "method": "ANY",
          "path": "/healthz",
          "description": "Health check endpoint."
        }
      ]
    },
    {
      "name": "SwaggerAPI",
      "type": "http",
      "base_path": "/",
      "methods": [
        {
          "name": "SwaggerUI",
          "name_key": "SwaggerAPI.SwaggerUI",
          "method": "GET",
          "path": "/swagger/*any",
          "description": "Serve Swagger UI for the central HTTP API."
        }
      ]
    },
    {
      "name": "CentralAPI",
      "type": "http",
      "base_path": "/inner/aipower/api/v1",
      "methods": [
        {
          "name": "InteractBot",
          "name_key": "CentralAPI.InteractBot",
          "method": "POST",
          "path": "/inner/aipower/api/v1/orgs/:org_id/projects/:project_id/bot",
          "description": "HTTP bot interaction entrypoint backed by openaisvc.InteractBot."
        },
        {
          "name": "GetAPIKeyInfo",
          "name_key": "CentralAPI.GetAPIKeyInfo",
          "method": "GET",
          "path": "/inner/aipower/api/v1/api_key_info",
          "description": "Resolve organization IDs from an access key."
        },
        {
          "name": "GetClusterInfo",
          "name_key": "CentralAPI.GetClusterInfo",
          "method": "GET",
          "path": "/inner/aipower/api/v1/cluster_info",
          "description": "Return cluster details for the requested cluster ID."
        },
        {
          "name": "CheckAPIKeyPermission",
          "name_key": "CentralAPI.CheckAPIKeyPermission",
          "method": "POST",
          "path": "/inner/aipower/api/v1/api_key_permission_check",
          "description": "Check whether an API key has permission for a resource URI."
        },
        {
          "name": "CheckUserPermission",
          "name_key": "CentralAPI.CheckUserPermission",
          "method": "POST",
          "path": "/inner/aipower/api/v1/user_permission_check",
          "description": "Check whether a user or user token has permission for a resource URI."
        }
      ]
    },
    {
      "name": "MetricsAPI",
      "type": "http",
      "base_path": "/",
      "methods": [
        {
          "name": "Metrics",
          "name_key": "MetricsAPI.Metrics",
          "method": "ANY",
          "path": "/metrics",
          "description": "Prometheus metrics endpoint exposed by the dedicated metrics server."
        }
      ]
    },
    {
      "name": "ChatBotService",
      "package": "github.com/tidbcloud/aipower/idl/pbgen/proto/api",
      "type": "grpc",
      "methods": [
        {
          "name": "ChatBot",
          "name_key": "ChatBotService.ChatBot",
          "input": "ChatBotReq",
          "output": "ChatBotRsp",
          "description": "Generate or stream a chatbot completion."
        },
        {
          "name": "GetLatestPrompt",
          "name_key": "ChatBotService.GetLatestPrompt",
          "input": "GetLatestPromptReq",
          "output": "GetLatestPromptResp",
          "description": "Load the latest prompt template for an AI model and deployment."
        },
        {
          "name": "GetAllPromptByAIModel",
          "name_key": "ChatBotService.GetAllPromptByAIModel",
          "input": "GetAllPromptByAIModelReq",
          "output": "GetAllPromptByAIModelResp",
          "description": "List all stored prompts for an AI model and deployment."
        },
        {
          "name": "SavePrompt",
          "name_key": "ChatBotService.SavePrompt",
          "input": "SavePromptReq",
          "output": "SavePromptResp",
          "description": "Persist a prompt template."
        },
        {
          "name": "QueryCompletionByJobID",
          "name_key": "ChatBotService.QueryCompletionByJobID",
          "input": "QueryCompletionReq",
          "output": "QueryCompletionResp",
          "description": "Read a streamed completion result by job ID."
        }
      ]
    }
  ]
}
