{
 "openapi": "3.1.0",
 "info": {
  "title": "Compute Connector",
  "version": "1.0.0",
  "description": "More compute for your bot. When the machine your agent runs on is low on memory, Compute Connector warns it and sends the heavy job (builds, installs, test suites, headless browsers) to a cloud sandbox on your own provider account: Vercel Sandbox by default, or E2B, Daytona, Modal and Workers Sandbox. You bring the keys and pay the provider directly; we charge a flat connector fee and never resell compute. Free 500/day; Pro $9/month: https://pay.instaloops.com/b/eVqdR91Tid799P94Kr83C3F"
 },
 "servers": [
  {
   "url": "https://compute.cloudforbots.com"
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  }
 },
 "paths": {
  "/api/run/check_memory": {
   "post": {
    "operationId": "check_memory",
    "summary": "Before a heavy job, send how much memory the machine your agent runs on has free (free -m, os.freemem()) and what you are about to run",
    "description": "Before a heavy job, send how much memory the machine your agent runs on has free (free -m, os.freemem()) and what you are about to run. Get a memory warning and a verdict: run_local, or offload with the provider to use. Free watch-only logs would_offload for the weekly report; nothing runs.",
    "security": [
     {},
     {
      "bearer": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "free_mb": {
          "type": "number",
          "description": "Free or available memory right now, in MB (Linux: the \"available\" column of free -m)."
         },
         "total_mb": {
          "type": "number"
         },
         "job": {
          "type": "string",
          "description": "The command or a short description, e.g. \"npm run build\" or \"playwright crawl of 40 pages\"."
         },
         "job_mb": {
          "type": "number",
          "description": "Optional: your own estimate of the job's peak memory in MB. Without it we use a rough guess by job type."
         },
         "floor_mb": {
          "type": "number",
          "description": "Keep at least this much free. Default 2048."
         },
         "host": {
          "type": "string",
          "description": "Optional name of the machine, e.g. \"my-laptop\"."
         }
        },
        "required": [
         "free_mb"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Result with job, understood, outcome, usage",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "401": {
      "description": "bad_agent_key"
     },
     "429": {
      "description": "free_limit_reached (includes upgrade link)"
     }
    }
   }
  },
  "/api/run/run_job": {
   "post": {
    "operationId": "run_job",
    "summary": "Pro: run a shell command in a fresh cloud sandbox on your own provider account (vercel (Vercel Sandbox, default), e2b, daytona, modal, workers (Workers Sandbox)) and get the exit code and the last 16 KB of stdout and stderr back",
    "description": "Pro: run a shell command in a fresh cloud sandbox on your own provider account (vercel (Vercel Sandbox, default), e2b, daytona, modal, workers (Workers Sandbox)) and get the exit code and the last 16 KB of stdout and stderr back. Send small input files with it. The sandbox is created for the job and stopped right after, so nothing idles on your bill. Free watch-only logs would_offload and runs nothing.",
    "security": [
     {},
     {
      "bearer": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "cmd": {
          "type": "string",
          "description": "Shell command, run with bash -lc, e.g. \"git clone https://github.com/you/app && cd app && npm ci && npm test\"."
         },
         "provider": {
          "type": "string",
          "description": "Name of a saved provider key (default: your default key, else vercel)."
         },
         "files": {
          "type": "array",
          "description": "Optional input files written before cmd runs: [{path, content, encoding?: \"base64\"}]. 50 files, 500 KB total.",
          "items": {
           "type": "object",
           "properties": {
            "path": {
             "type": "string"
            },
            "content": {
             "type": "string"
            },
            "encoding": {
             "type": "string"
            }
           },
           "required": [
            "path"
           ]
          }
         },
         "env": {
          "type": "object",
          "description": "Optional non-secret environment variables for the command (strings)."
         },
         "timeout_s": {
          "type": "integer",
          "description": "1-240 seconds, default 120."
         },
         "runtime": {
          "type": "string",
          "description": "Vercel only: node24 (default), node22, node26 or python3.13."
         },
         "template": {
          "type": "string",
          "description": "E2B only: template id, default base."
         },
         "free_mb": {
          "type": "number",
          "description": "Optional: memory free on your machine now, for the weekly report."
         }
        },
        "required": [
         "cmd"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Result with job, understood, outcome, usage",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "401": {
      "description": "bad_agent_key"
     },
     "429": {
      "description": "free_limit_reached (includes upgrade link)"
     }
    }
   }
  },
  "/api/run/save_provider_key": {
   "post": {
    "operationId": "save_provider_key",
    "summary": "Pro, owner only: save one provider key, sealed with AES-256-GCM before it reaches the database",
    "description": "Pro, owner only: save one provider key, sealed with AES-256-GCM before it reaches the database. Providers: vercel (Vercel Sandbox, default), e2b, daytona, modal, workers (Workers Sandbox). Vercel needs team_id and project_id; Modal and Workers Sandbox need bridge_url (see provider_setup). The key is checked with a read-only call first and is never returned or logged. Free stores nothing.",
    "security": [
     {},
     {
      "bearer": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "provider": {
          "type": "string",
          "description": "vercel, e2b, daytona, modal or workers."
         },
         "token": {
          "type": "string",
          "description": "The provider API key or token (or your bridge token)."
         },
         "name": {
          "type": "string",
          "description": "Label for this key, default the provider name. Use it in run_job provider."
         },
         "team_id": {
          "type": "string",
          "description": "Vercel: team id (team_...)."
         },
         "project_id": {
          "type": "string",
          "description": "Vercel: project id or name the sandboxes bill to."
         },
         "api_url": {
          "type": "string",
          "description": "Daytona: API base, default https://app.daytona.io/api."
         },
         "bridge_url": {
          "type": "string",
          "description": "Modal / Workers Sandbox: https URL of the bridge you deployed."
         },
         "make_default": {
          "type": "boolean"
         },
         "skip_check": {
          "type": "boolean",
          "description": "Save without the read-only check (not recommended)."
         }
        },
        "required": [
         "provider",
         "token"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Result with job, understood, outcome, usage",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "401": {
      "description": "bad_agent_key"
     },
     "429": {
      "description": "free_limit_reached (includes upgrade link)"
     }
    }
   }
  },
  "/api/run/list_providers": {
   "post": {
    "operationId": "list_providers",
    "summary": "Every provider this connects to, how each one runs, and (with your key) the provider keys you saved: name, provider, fingerprint, default, last used",
    "description": "Every provider this connects to, how each one runs, and (with your key) the provider keys you saved: name, provider, fingerprint, default, last used. Never shows a key.",
    "security": [
     {},
     {
      "bearer": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {}
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Result with job, understood, outcome, usage",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "401": {
      "description": "bad_agent_key"
     },
     "429": {
      "description": "free_limit_reached (includes upgrade link)"
     }
    }
   }
  },
  "/api/run/delete_provider_key": {
   "post": {
    "operationId": "delete_provider_key",
    "summary": "Pro, owner only: delete a saved provider key by name",
    "description": "Pro, owner only: delete a saved provider key by name. Jobs on that key stop working at once.",
    "security": [
     {},
     {
      "bearer": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "name": {
          "type": "string"
         }
        },
        "required": [
         "name"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Result with job, understood, outcome, usage",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "401": {
      "description": "bad_agent_key"
     },
     "429": {
      "description": "free_limit_reached (includes upgrade link)"
     }
    }
   }
  },
  "/api/run/provider_setup": {
   "post": {
    "operationId": "provider_setup",
    "summary": "Step-by-step setup for one provider: where to get the key, what to pass to save_provider_key, links to its docs and price page, and for Modal or Workers Sandbox the bridge code to deploy on your own account.",
    "description": "Step-by-step setup for one provider: where to get the key, what to pass to save_provider_key, links to its docs and price page, and for Modal or Workers Sandbox the bridge code to deploy on your own account.",
    "security": [
     {},
     {
      "bearer": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "provider": {
          "type": "string",
          "description": "vercel, e2b, daytona, modal or workers."
         }
        },
        "required": [
         "provider"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Result with job, understood, outcome, usage",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "401": {
      "description": "bad_agent_key"
     },
     "429": {
      "description": "free_limit_reached (includes upgrade link)"
     }
    }
   }
  },
  "/api/run/weekly_report": {
   "post": {
    "operationId": "weekly_report",
    "summary": "Plain-English summary of the last 7 days: memory checks, low-memory warnings, jobs that would have been offloaded (free) or ran (Pro) by provider, minutes and failures",
    "description": "Plain-English summary of the last 7 days: memory checks, low-memory warnings, jobs that would have been offloaded (free) or ran (Pro) by provider, minutes and failures. Read-only; sends nothing. Needs an API key.",
    "security": [
     {},
     {
      "bearer": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {}
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Result with job, understood, outcome, usage",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "401": {
      "description": "bad_agent_key"
     },
     "429": {
      "description": "free_limit_reached (includes upgrade link)"
     }
    }
   }
  },
  "/api/key": {
   "post": {
    "operationId": "get_free_key",
    "summary": "Get a free API key",
    "responses": {
     "200": {
      "description": "api_key"
     }
    }
   }
  }
 }
}