{
  "repo": "tidbcloud/inference-service",
  "binary": "server",
  "binary_path": "cmd/server/main.go",
  "surface_kind": "mixed_service",
  "type": "mixed_service",
  "services": [
    {
      "name": "InferenceServiceLifecycle",
      "package": "main",
      "methods": [
        {
          "name": "Startup",
          "name_key": "Runtime InferenceServiceLifecycle.Startup",
          "input": "cobra root command + config file path",
          "output": "running HTTP API server + metrics server"
        },
        {
          "name": "Setup",
          "name_key": "Runtime InferenceServiceLifecycle.Setup",
          "input": "global config",
          "output": "initialized BedrockService + UsageService"
        },
        {
          "name": "ServeHTTP",
          "name_key": "Runtime InferenceServiceLifecycle.ServeHTTP",
          "input": "gin router + http.Server",
          "output": "serving HTTP API until SIGINT/SIGTERM"
        },
        {
          "name": "StartMetricsServer",
          "name_key": "Runtime InferenceServiceLifecycle.StartMetricsServer",
          "input": "metrics port",
          "output": "HTTP /metrics endpoint"
        }
      ]
    },
    {
      "name": "InferenceHTTP",
      "methods": [
        {
          "name": "POST /api/v1/inference/embeddings/{tenantId}",
          "name_key": "HTTP POST /api/v1/inference/embeddings/:tenantId",
          "input": "tenantId path + EmbeddingRequest JSON",
          "output": "EmbeddingResponse",
          "path": "/api/v1/inference/embeddings/:tenantId"
        },
        {
          "name": "GET /api/v1/inference/quota_usage/{tenantId}",
          "name_key": "HTTP GET /api/v1/inference/quota_usage/:tenantId",
          "input": "tenantId path",
          "output": "QuotaUsageResponse",
          "path": "/api/v1/inference/quota_usage/:tenantId"
        },
        {
          "name": "GET /api/v1/inference/quota_usage",
          "name_key": "HTTP GET /api/v1/inference/quota_usage",
          "input": "none",
          "output": "AllQuotaUsageResponse",
          "path": "/api/v1/inference/quota_usage"
        },
        {
          "name": "GET /healthz",
          "name_key": "HTTP GET /healthz",
          "input": "none",
          "output": "{\"status\":\"ok\"}",
          "path": "/healthz"
        },
        {
          "name": "GET /version",
          "name_key": "HTTP GET /version",
          "input": "none",
          "output": "build info JSON",
          "path": "/version"
        },
        {
          "name": "GET /swagger/*any",
          "name_key": "HTTP GET /swagger/*any",
          "input": "swagger asset path",
          "output": "Swagger UI asset",
          "path": "/swagger/*any"
        },
        {
          "name": "GET /metrics",
          "name_key": "HTTP GET /metrics",
          "input": "none",
          "output": "Prometheus metrics",
          "path": "/metrics"
        }
      ]
    }
  ],
  "extensions": {
    "notes": [
      "The binary starts two HTTP servers: the main Gin API server on Server.HTTPListenAddr and a separate metrics server on :Server.MetricsPort.",
      "Authentication is local middleware only: service and management API keys are validated from config/env when configured, otherwise the routes run without auth enforcement.",
      "Usage persistence is not in the request path; it is saved periodically every 30 seconds and again during graceful shutdown."
    ]
  }
}
