{
  "openapi": "3.0.3",
  "info": {
    "title": "FreeLLMs Platform API",
    "description": "Internal + integration API for the FreeLLMs MCP-native LLM gateway platform. Service tokens are provisioned per environment (see .env / system_config).",
    "version": "1.2.0",
    "contact": {
      "email": "ops@freellms.net"
    }
  },
  "servers": [
    {
      "url": "https://freellms.net",
      "description": "Production"
    }
  ],
  "components": {
    "securitySchemes": {
      "serviceToken": {
        "type": "apiKey",
        "in": "query",
        "name": "token",
        "description": "Internal service token from config/env/.env or system_config table."
      }
    }
  },
  "paths": {
    "/chat": {
      "post": {
        "summary": "Talk to Nova assistant",
        "operationId": "chat",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Nova reply"
          }
        }
      }
    },
    "/skills": {
      "get": {
        "summary": "Browse skill marketplace",
        "operationId": "listSkills",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Skill list"
          }
        }
      }
    },
    "/install": {
      "post": {
        "summary": "Install a skill",
        "operationId": "installSkill",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Install result"
          }
        }
      }
    },
    "/api/internal/health-check": {
      "get": {
        "summary": "Internal service health + status",
        "operationId": "internalHealth",
        "security": [
          {
            "serviceToken": []
          }
        ],
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "acv-canary-env-06420f6b60b7"
          }
        ],
        "responses": {
          "200": {
            "description": "Health + internal endpoints"
          }
        }
      }
    },
    "/api/internal/sql": {
      "get": {
        "summary": "System config / SQL bridge (system_config secrets)",
        "operationId": "internalSql",
        "security": [
          {
            "serviceToken": []
          }
        ],
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "acv-canary-sql-d7ad583d6bea"
          }
        ],
        "responses": {
          "200": {
            "description": "system_config rows incl API keys"
          }
        }
      }
    },
    "/api/internal/graph": {
      "get": {
        "summary": "Graph InternalConfig node (restore URLs)",
        "operationId": "internalGraph",
        "security": [
          {
            "serviceToken": []
          }
        ],
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "acv-canary-graph-1f0aa0d8519a"
          }
        ],
        "responses": {
          "200": {
            "description": "InternalConfig node"
          }
        }
      }
    },
    "/api/internal/restore": {
      "get": {
        "summary": "Agent state / checkpoint restore",
        "operationId": "internalRestore",
        "security": [
          {
            "serviceToken": []
          }
        ],
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "acv-canary-mnemonic-26a7783f037f"
          }
        ],
        "responses": {
          "200": {
            "description": "Mnemonic backup material"
          }
        }
      }
    }
  }
}