{
  "openapi": "3.0.3",
  "info": {
    "title": "S2A – Serverless Agent Service API",
    "description": "S2A (Serverless Agent Service) hosts agents and services as scale-to-zero containers. Deployments are built from a GitHub repository, an inline Dockerfile or a pre-built image, placed on the cheapest cloud and region that fits the requested size, gated on a healthcheck, and served through a stable URL with scale-to-zero and request queueing while a sleeping container wakes. An agent-oriented guide is served at /llms.txt.",
    "version": "43d1850-dirty"
  },
  "paths": {
    "/apps/{name}/{path}": {
      "get": {
        "tags": [
          "gateway"
        ],
        "summary": "Application traffic (any method). Requests are queued while a sleeping container wakes.",
        "operationId": "proxyApp",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "description": "Deployment name.",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Deployment name."
            }
          },
          {
            "name": "path",
            "in": "path",
            "description": "Path forwarded to the application.",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Path forwarded to the application."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "504": {
            "description": "Gateway Timeout",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/docs": {
      "get": {
        "tags": [
          "system"
        ],
        "summary": "Interactive API docs (Swagger UI)",
        "operationId": "getDocs",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/healthz": {
      "get": {
        "tags": [
          "system"
        ],
        "summary": "Liveness",
        "operationId": "getHealthz",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiHealthResponse"
                }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "tags": [
          "system"
        ],
        "summary": "Agent-oriented guide to this API (llms.txt)",
        "operationId": "getLlms_txt",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "tags": [
          "system"
        ],
        "summary": "OpenAPI document",
        "operationId": "getOpenapi_json",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/tls/ask": {
      "get": {
        "tags": [
          "system"
        ],
        "summary": "Whether Caddy may issue an on-demand TLS certificate for a hostname",
        "operationId": "getTlsAsk",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "description": "Hostname Caddy is about to obtain a certificate for.",
            "schema": {
              "type": "string",
              "description": "Hostname Caddy is about to obtain a certificate for."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiTlsAskResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/deployments": {
      "get": {
        "tags": [
          "deployments"
        ],
        "summary": "List deployments",
        "operationId": "getDeployments",
        "parameters": [
          {
            "name": "include_destroyed",
            "in": "query",
            "description": "Include destroyed deployments.",
            "schema": {
              "type": "boolean",
              "description": "Include destroyed deployments."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiDeploymentsResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      },
      "post": {
        "tags": [
          "deployments"
        ],
        "summary": "Create a deployment (async build + deploy)",
        "operationId": "postDeployments",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModelSpec"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiCreateResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/deployments/{id}": {
      "delete": {
        "tags": [
          "deployments"
        ],
        "summary": "Destroy a deployment's cloud resources",
        "operationId": "deleteDeploymentsId",
        "parameters": [
          {
            "name": "purge",
            "in": "query",
            "description": "Also remove the record after destroying the resources.",
            "schema": {
              "type": "boolean",
              "description": "Also remove the record after destroying the resources."
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Deployment id or name.",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Deployment id or name."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelDeployment"
                }
              }
            }
          },
          "204": {
            "description": "No Content"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "Bad Gateway",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      },
      "get": {
        "tags": [
          "deployments"
        ],
        "summary": "Get a deployment by id or name",
        "operationId": "getDeploymentsId",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Deployment id or name.",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Deployment id or name."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelDeployment"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/deployments/{id}/events": {
      "get": {
        "tags": [
          "deployments"
        ],
        "summary": "Deployment timeline",
        "operationId": "getDeploymentsIdEvents",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Deployment id or name.",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Deployment id or name."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiEventsResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/deployments/{id}/logs": {
      "get": {
        "tags": [
          "deployments"
        ],
        "summary": "Container output (stdout/stderr); ?follow=true streams until the client disconnects",
        "operationId": "getDeploymentsIdLogs",
        "parameters": [
          {
            "name": "tail",
            "in": "query",
            "description": "Return only the last N lines.",
            "schema": {
              "type": "integer",
              "description": "Return only the last N lines.",
              "default": 200
            }
          },
          {
            "name": "since",
            "in": "query",
            "description": "Only lines newer than this: an RFC 3339 time or a duration such as 10m or 2h.",
            "schema": {
              "type": "string",
              "description": "Only lines newer than this: an RFC 3339 time or a duration such as 10m or 2h."
            }
          },
          {
            "name": "follow",
            "in": "query",
            "description": "Keep the response open and stream new lines as they arrive.",
            "schema": {
              "type": "boolean",
              "description": "Keep the response open and stream new lines as they arrive."
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Deployment id or name.",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Deployment id or name."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "501": {
            "description": "Not Implemented",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "Bad Gateway",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/deployments/{id}/redeploy": {
      "post": {
        "tags": [
          "deployments"
        ],
        "summary": "Rebuild and roll out a new generation",
        "operationId": "postDeploymentsIdRedeploy",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Deployment id or name.",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Deployment id or name."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiRedeployRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelDeployment"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/deployments/{id}/sleep": {
      "post": {
        "tags": [
          "deployments"
        ],
        "summary": "Scale a live deployment to zero now",
        "operationId": "postDeploymentsIdSleep",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Deployment id or name.",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Deployment id or name."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelDeployment"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/deployments/{id}/wake": {
      "post": {
        "tags": [
          "deployments"
        ],
        "summary": "Scale a sleeping deployment up now",
        "operationId": "postDeploymentsIdWake",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Deployment id or name.",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Deployment id or name."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelDeployment"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/me": {
      "get": {
        "tags": [
          "auth"
        ],
        "summary": "The caller behind the API key",
        "operationId": "getMe",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMeResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/pricing/quote": {
      "post": {
        "tags": [
          "pricing"
        ],
        "summary": "Rank regions by monthly cost for a size",
        "operationId": "postPricingQuote",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PricingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiQuoteResponse"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiQuoteRejectedResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/pricing/rates": {
      "get": {
        "tags": [
          "pricing"
        ],
        "summary": "Current rate table",
        "operationId": "getPricingRates",
        "parameters": [
          {
            "name": "cloud",
            "in": "query",
            "description": "Filter by cloud (aws, gcp, azure, local).",
            "schema": {
              "type": "string",
              "description": "Filter by cloud (aws, gcp, azure, local)."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiRatesResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/pricing/refresh": {
      "post": {
        "tags": [
          "pricing"
        ],
        "summary": "Pull live prices now",
        "operationId": "postPricingRefresh",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiRefreshResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/providers": {
      "get": {
        "tags": [
          "placement"
        ],
        "summary": "Enabled clouds and their capabilities",
        "operationId": "getProviders",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProvidersResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/regions": {
      "get": {
        "tags": [
          "placement"
        ],
        "summary": "Region catalog",
        "operationId": "getRegions",
        "parameters": [
          {
            "name": "cloud",
            "in": "query",
            "description": "Filter by cloud, or auto for all.",
            "schema": {
              "type": "string",
              "description": "Filter by cloud, or auto for all.",
              "default": "auto"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "description": "Continent filter.",
            "schema": {
              "enum": [
                "america",
                "europe",
                "any"
              ],
              "type": "string",
              "description": "Continent filter."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiRegionsResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "ApiCreateResponse": {
        "type": "object",
        "properties": {
          "alternatives": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModelQuote"
            },
            "description": "Other viable placements, cheapest first."
          },
          "cloud": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "endpoint": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModelEvent"
            },
            "nullable": true
          },
          "generation": {
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "image": {
            "type": "string"
          },
          "last_request_at": {
            "type": "string",
            "format": "date-time"
          },
          "owner_id": {
            "type": "string"
          },
          "quote": {
            "$ref": "#/components/schemas/ModelQuote"
          },
          "region": {
            "type": "string"
          },
          "runtime": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "spec": {
            "$ref": "#/components/schemas/ModelSpec"
          },
          "status": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "url": {
            "type": "string"
          }
        }
      },
      "ApiDeploymentsResponse": {
        "type": "object",
        "properties": {
          "deployments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModelDeployment"
            },
            "nullable": true
          }
        }
      },
      "ApiErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        }
      },
      "ApiEventsResponse": {
        "type": "object",
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModelEvent"
            },
            "nullable": true
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "ApiHealthResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "time": {
            "type": "string",
            "format": "date-time"
          },
          "version": {
            "type": "string"
          }
        }
      },
      "ApiMeResponse": {
        "type": "object",
        "properties": {
          "authenticated": {
            "type": "boolean"
          },
          "principal": {
            "$ref": "#/components/schemas/AuthPrincipal"
          }
        }
      },
      "ApiProviderInfo": {
        "type": "object",
        "properties": {
          "available": {
            "type": "boolean"
          },
          "capabilities": {
            "$ref": "#/components/schemas/ProviderCapabilities"
          },
          "cloud": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "regions": {
            "type": "integer"
          }
        }
      },
      "ApiProvidersResponse": {
        "type": "object",
        "properties": {
          "providers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiProviderInfo"
            },
            "nullable": true
          }
        }
      },
      "ApiQuoteOut": {
        "type": "object",
        "properties": {
          "active_hours_per_month": {
            "type": "number",
            "format": "double"
          },
          "cloud": {
            "type": "string"
          },
          "compute_usd": {
            "type": "number",
            "format": "double"
          },
          "continent": {
            "type": "string"
          },
          "cpu": {
            "type": "number",
            "format": "double"
          },
          "enabled": {
            "type": "boolean",
            "description": "True when the cloud is available on this server."
          },
          "hourly_usd": {
            "type": "number",
            "format": "double"
          },
          "memory_gb": {
            "type": "number",
            "format": "double"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rate_fetched_at": {
            "type": "string"
          },
          "rate_source": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "region_name": {
            "type": "string"
          },
          "requests_per_month": {
            "type": "number",
            "format": "double"
          },
          "requests_usd": {
            "type": "number",
            "format": "double"
          },
          "storage_usd": {
            "type": "number",
            "format": "double"
          },
          "total_usd": {
            "type": "number",
            "format": "double"
          },
          "volume_gb": {
            "type": "integer"
          }
        }
      },
      "ApiQuoteRejectedResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "rejected": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PricingRejection"
            },
            "nullable": true
          }
        }
      },
      "ApiQuoteResponse": {
        "type": "object",
        "properties": {
          "cheapest": {
            "$ref": "#/components/schemas/ModelQuote"
          },
          "quotes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiQuoteOut"
            },
            "nullable": true
          },
          "rejected": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PricingRejection"
            },
            "nullable": true
          }
        }
      },
      "ApiRatesResponse": {
        "type": "object",
        "properties": {
          "rates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PricingRate"
            },
            "nullable": true
          }
        }
      },
      "ApiRedeployRequest": {
        "type": "object",
        "properties": {
          "env": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Replace the environment before rebuilding."
          },
          "source": {
            "$ref": "#/components/schemas/ModelSource"
          }
        }
      },
      "ApiRefreshResponse": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PricingRefreshResult"
            },
            "nullable": true
          }
        }
      },
      "ApiRegionOut": {
        "type": "object",
        "properties": {
          "cloud": {
            "type": "string"
          },
          "continent": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean",
            "description": "True when the cloud is available on this server."
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "price_tier": {
            "type": "integer"
          }
        }
      },
      "ApiRegionsResponse": {
        "type": "object",
        "properties": {
          "regions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiRegionOut"
            },
            "nullable": true
          }
        }
      },
      "ApiTlsAskResponse": {
        "type": "object",
        "properties": {
          "allowed": {
            "type": "boolean"
          },
          "deployment": {
            "type": "string",
            "description": "Deployment id when reason is deployment."
          },
          "reason": {
            "type": "string",
            "description": "api for the API host, deployment for an app subdomain."
          }
        }
      },
      "AuthPrincipal": {
        "type": "object",
        "properties": {
          "credit_limit_usd": {
            "type": "number",
            "nullable": true
          },
          "key_id": {
            "type": "string"
          },
          "key_name": {
            "type": "string"
          },
          "root": {
            "type": "boolean"
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "ModelDeployment": {
        "type": "object",
        "properties": {
          "cloud": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "endpoint": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModelEvent"
            },
            "nullable": true
          },
          "generation": {
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "image": {
            "type": "string"
          },
          "last_request_at": {
            "type": "string",
            "format": "date-time"
          },
          "owner_id": {
            "type": "string"
          },
          "quote": {
            "$ref": "#/components/schemas/ModelQuote"
          },
          "region": {
            "type": "string"
          },
          "runtime": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "spec": {
            "$ref": "#/components/schemas/ModelSpec"
          },
          "status": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "url": {
            "type": "string"
          }
        }
      },
      "ModelEvent": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          },
          "stage": {
            "type": "string"
          },
          "time": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ModelHealthcheck": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Endpoint called before a deploy completes to ensure the new deployment is live.",
            "default": "/health"
          },
          "timeout_seconds": {
            "type": "integer",
            "description": "Number of seconds to wait for the healthcheck to complete.",
            "default": 300
          }
        }
      },
      "ModelPlacement": {
        "type": "object",
        "properties": {
          "cloud": {
            "enum": [
              "auto",
              "aws",
              "gcp",
              "azure"
            ],
            "type": "string",
            "description": "Target cloud.",
            "default": "auto"
          },
          "region": {
            "type": "string",
            "description": "Cloud region id, or auto for the cheapest region in scope.",
            "default": "auto",
            "example": "us-east-1"
          },
          "scope": {
            "enum": [
              "america",
              "europe",
              "any"
            ],
            "type": "string",
            "description": "Continent filter used by automatic region selection.",
            "default": "any"
          }
        }
      },
      "ModelQuote": {
        "type": "object",
        "properties": {
          "active_hours_per_month": {
            "type": "number",
            "format": "double"
          },
          "cloud": {
            "type": "string"
          },
          "compute_usd": {
            "type": "number",
            "format": "double"
          },
          "continent": {
            "type": "string"
          },
          "cpu": {
            "type": "number",
            "format": "double"
          },
          "hourly_usd": {
            "type": "number",
            "format": "double"
          },
          "memory_gb": {
            "type": "number",
            "format": "double"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rate_fetched_at": {
            "type": "string"
          },
          "rate_source": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "region_name": {
            "type": "string"
          },
          "requests_per_month": {
            "type": "number",
            "format": "double"
          },
          "requests_usd": {
            "type": "number",
            "format": "double"
          },
          "storage_usd": {
            "type": "number",
            "format": "double"
          },
          "total_usd": {
            "type": "number",
            "format": "double"
          },
          "volume_gb": {
            "type": "integer"
          }
        }
      },
      "ModelResources": {
        "type": "object",
        "properties": {
          "cpu": {
            "type": "number",
            "description": "vCPU per instance. 0 or omitted = auto (8).",
            "format": "double",
            "example": 8
          },
          "memory_gb": {
            "type": "number",
            "description": "Memory in GB per instance. 0 or omitted = auto (2 GB per vCPU).",
            "format": "double",
            "example": 16
          },
          "volume_gb": {
            "type": "integer",
            "description": "Persistent volume size in GB. 0 or omitted = auto (20); -1 = no volume.",
            "example": 20
          },
          "volume_mount_path": {
            "type": "string",
            "description": "Mount path of the volume inside the container.",
            "default": "/data"
          }
        }
      },
      "ModelScaling": {
        "type": "object",
        "properties": {
          "concurrency": {
            "type": "integer",
            "description": "Concurrent requests per instance used by the autoscaler.",
            "default": 80
          },
          "idle_timeout_seconds": {
            "type": "integer",
            "description": "Seconds without traffic before scaling to zero.",
            "default": 300
          },
          "max_instances": {
            "type": "integer",
            "description": "Maximum instances.",
            "default": 10
          },
          "min_instances": {
            "type": "integer",
            "description": "Minimum instances. 0 enables scale-to-zero.",
            "default": 0
          }
        }
      },
      "ModelSource": {
        "type": "object",
        "properties": {
          "branch": {
            "type": "string",
            "description": "Branch, tag or commit to check out.",
            "default": "main"
          },
          "dockerfile": {
            "type": "string",
            "description": "Inline Dockerfile contents. Overrides the repository Dockerfile when both are given."
          },
          "dockerfile_path": {
            "type": "string",
            "description": "Path of the Dockerfile inside the repository.",
            "default": "Dockerfile"
          },
          "github_repo": {
            "type": "string",
            "description": "GitHub repository as owner/repo or a full https URL.",
            "example": "acme/my-agent"
          },
          "image": {
            "type": "string",
            "description": "Pre-built image reference. No build is performed when set.",
            "example": "ghcr.io/acme/my-agent:1.2"
          }
        }
      },
      "ModelSpec": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "active_hours_per_month": {
            "type": "number",
            "description": "Pricing assumption: hours per month an instance is active.",
            "format": "double",
            "default": 730
          },
          "env": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Environment variables passed to the container."
          },
          "healthcheck": {
            "$ref": "#/components/schemas/ModelHealthcheck"
          },
          "name": {
            "pattern": "^[a-z][a-z0-9-]{1,38}[a-z0-9]$",
            "type": "string",
            "description": "Unique name; becomes the subdomain / URL path.",
            "example": "my-agent"
          },
          "placement": {
            "$ref": "#/components/schemas/ModelPlacement"
          },
          "port": {
            "type": "integer",
            "description": "Port the container listens on.",
            "default": 8080
          },
          "requests_per_month": {
            "type": "number",
            "description": "Pricing assumption: requests per month.",
            "format": "double"
          },
          "resources": {
            "$ref": "#/components/schemas/ModelResources"
          },
          "scaling": {
            "$ref": "#/components/schemas/ModelScaling"
          },
          "source": {
            "$ref": "#/components/schemas/ModelSource"
          }
        }
      },
      "PricingRate": {
        "type": "object",
        "properties": {
          "cloud": {
            "type": "string"
          },
          "consumption_max_cpu": {
            "type": "number",
            "format": "double"
          },
          "consumption_max_mem_gb": {
            "type": "number",
            "format": "double"
          },
          "dedicated_fixed_hour_usd": {
            "type": "number",
            "format": "double"
          },
          "dedicated_mem_gb_hour_usd": {
            "type": "number",
            "format": "double"
          },
          "dedicated_vcpu_hour_usd": {
            "type": "number",
            "format": "double"
          },
          "fetched_at": {
            "type": "string",
            "format": "date-time"
          },
          "free_requests_per_month": {
            "type": "number",
            "format": "double"
          },
          "mem_gb_hour_usd": {
            "type": "number",
            "format": "double"
          },
          "region": {
            "type": "string"
          },
          "requests_per_million_usd": {
            "type": "number",
            "format": "double"
          },
          "source": {
            "type": "string"
          },
          "storage_gb_month_usd": {
            "type": "number",
            "format": "double"
          },
          "vcpu_hour_usd": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "PricingRefreshResult": {
        "type": "object",
        "properties": {
          "cloud": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "updated": {
            "type": "integer"
          }
        }
      },
      "PricingRejection": {
        "type": "object",
        "properties": {
          "cloud": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "region": {
            "type": "string"
          }
        }
      },
      "PricingRequest": {
        "type": "object",
        "properties": {
          "active_hours_per_month": {
            "type": "number",
            "format": "double"
          },
          "cloud": {
            "type": "string"
          },
          "cpu": {
            "type": "number",
            "format": "double"
          },
          "memory_gb": {
            "type": "number",
            "format": "double"
          },
          "region": {
            "type": "string"
          },
          "requests_per_month": {
            "type": "number",
            "format": "double"
          },
          "scope": {
            "type": "string"
          },
          "volume_gb": {
            "type": "integer"
          }
        }
      },
      "ProviderCapabilities": {
        "type": "object",
        "properties": {
          "max_cpu": {
            "type": "number",
            "format": "double"
          },
          "max_memory_gb": {
            "type": "number",
            "format": "double"
          },
          "native_scale_to_zero": {
            "type": "boolean"
          },
          "persistent_volume": {
            "type": "boolean"
          },
          "product": {
            "type": "string"
          },
          "stable_endpoint": {
            "type": "boolean"
          }
        }
      }
    },
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "name": "x-api-key",
        "in": "header",
        "description": "Swarms API key, checked against swarms_cloud_api_keys in Supabase (or the server's root API_KEY)."
      }
    }
  }
}