Create a builder from your own code
curl --request POST \
--url https://{subdomain}.mihu.ai/api/v1/builders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "my-api",
"entrypoint": "python3 main.py",
"files": {
"main.py": "...source...",
"requirements.txt": "flask"
},
"port": 8000,
"env": {
"MY_FLAG": "1"
},
"resources": {
"cpu": 1,
"memory": 1,
"disk": 3
},
"job_type": "always_on",
"backup_interval_hours": 0
}
'import requests
url = "https://{subdomain}.mihu.ai/api/v1/builders"
payload = {
"name": "my-api",
"entrypoint": "python3 main.py",
"files": {
"main.py": "...source...",
"requirements.txt": "flask"
},
"port": 8000,
"env": { "MY_FLAG": "1" },
"resources": {
"cpu": 1,
"memory": 1,
"disk": 3
},
"job_type": "always_on",
"backup_interval_hours": 0
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'my-api',
entrypoint: 'python3 main.py',
files: {'main.py': '...source...', 'requirements.txt': 'flask'},
port: 8000,
env: {MY_FLAG: '1'},
resources: {cpu: 1, memory: 1, disk: 3},
job_type: 'always_on',
backup_interval_hours: 0
})
};
fetch('https://{subdomain}.mihu.ai/api/v1/builders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{subdomain}.mihu.ai/api/v1/builders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'my-api',
'entrypoint' => 'python3 main.py',
'files' => [
'main.py' => '...source...',
'requirements.txt' => 'flask'
],
'port' => 8000,
'env' => [
'MY_FLAG' => '1'
],
'resources' => [
'cpu' => 1,
'memory' => 1,
'disk' => 3
],
'job_type' => 'always_on',
'backup_interval_hours' => 0
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{subdomain}.mihu.ai/api/v1/builders"
payload := strings.NewReader("{\n \"name\": \"my-api\",\n \"entrypoint\": \"python3 main.py\",\n \"files\": {\n \"main.py\": \"...source...\",\n \"requirements.txt\": \"flask\"\n },\n \"port\": 8000,\n \"env\": {\n \"MY_FLAG\": \"1\"\n },\n \"resources\": {\n \"cpu\": 1,\n \"memory\": 1,\n \"disk\": 3\n },\n \"job_type\": \"always_on\",\n \"backup_interval_hours\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{subdomain}.mihu.ai/api/v1/builders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my-api\",\n \"entrypoint\": \"python3 main.py\",\n \"files\": {\n \"main.py\": \"...source...\",\n \"requirements.txt\": \"flask\"\n },\n \"port\": 8000,\n \"env\": {\n \"MY_FLAG\": \"1\"\n },\n \"resources\": {\n \"cpu\": 1,\n \"memory\": 1,\n \"disk\": 3\n },\n \"job_type\": \"always_on\",\n \"backup_interval_hours\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.mihu.ai/api/v1/builders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"my-api\",\n \"entrypoint\": \"python3 main.py\",\n \"files\": {\n \"main.py\": \"...source...\",\n \"requirements.txt\": \"flask\"\n },\n \"port\": 8000,\n \"env\": {\n \"MY_FLAG\": \"1\"\n },\n \"resources\": {\n \"cpu\": 1,\n \"memory\": 1,\n \"disk\": 3\n },\n \"job_type\": \"always_on\",\n \"backup_interval_hours\": 0\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Builder created successfully",
"data": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "lead-watcher",
"preview_url": "<string>",
"service_token": "<string>",
"entrypoint": "python3 main.py",
"port": 8000,
"auto_stop_interval": 0,
"backup_interval_hours": 0,
"review_passed": true,
"qa_passed": true,
"cost": {
"currency": "EUR",
"hourly_rate": 0.1965,
"runtime_hours": 1.5,
"cost": 0.29
},
"created_at": "2023-11-07T05:31:56Z"
}
}Builders
Create a builder from your own code
Deploys the supplied files to a cloud sandbox and starts your app. Returns the running builder with a public URL. To build from a description instead, use POST /api/v1/builder-agents.
POST
/
api
/
v1
/
builders
Create a builder from your own code
curl --request POST \
--url https://{subdomain}.mihu.ai/api/v1/builders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "my-api",
"entrypoint": "python3 main.py",
"files": {
"main.py": "...source...",
"requirements.txt": "flask"
},
"port": 8000,
"env": {
"MY_FLAG": "1"
},
"resources": {
"cpu": 1,
"memory": 1,
"disk": 3
},
"job_type": "always_on",
"backup_interval_hours": 0
}
'import requests
url = "https://{subdomain}.mihu.ai/api/v1/builders"
payload = {
"name": "my-api",
"entrypoint": "python3 main.py",
"files": {
"main.py": "...source...",
"requirements.txt": "flask"
},
"port": 8000,
"env": { "MY_FLAG": "1" },
"resources": {
"cpu": 1,
"memory": 1,
"disk": 3
},
"job_type": "always_on",
"backup_interval_hours": 0
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'my-api',
entrypoint: 'python3 main.py',
files: {'main.py': '...source...', 'requirements.txt': 'flask'},
port: 8000,
env: {MY_FLAG: '1'},
resources: {cpu: 1, memory: 1, disk: 3},
job_type: 'always_on',
backup_interval_hours: 0
})
};
fetch('https://{subdomain}.mihu.ai/api/v1/builders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{subdomain}.mihu.ai/api/v1/builders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'my-api',
'entrypoint' => 'python3 main.py',
'files' => [
'main.py' => '...source...',
'requirements.txt' => 'flask'
],
'port' => 8000,
'env' => [
'MY_FLAG' => '1'
],
'resources' => [
'cpu' => 1,
'memory' => 1,
'disk' => 3
],
'job_type' => 'always_on',
'backup_interval_hours' => 0
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{subdomain}.mihu.ai/api/v1/builders"
payload := strings.NewReader("{\n \"name\": \"my-api\",\n \"entrypoint\": \"python3 main.py\",\n \"files\": {\n \"main.py\": \"...source...\",\n \"requirements.txt\": \"flask\"\n },\n \"port\": 8000,\n \"env\": {\n \"MY_FLAG\": \"1\"\n },\n \"resources\": {\n \"cpu\": 1,\n \"memory\": 1,\n \"disk\": 3\n },\n \"job_type\": \"always_on\",\n \"backup_interval_hours\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{subdomain}.mihu.ai/api/v1/builders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my-api\",\n \"entrypoint\": \"python3 main.py\",\n \"files\": {\n \"main.py\": \"...source...\",\n \"requirements.txt\": \"flask\"\n },\n \"port\": 8000,\n \"env\": {\n \"MY_FLAG\": \"1\"\n },\n \"resources\": {\n \"cpu\": 1,\n \"memory\": 1,\n \"disk\": 3\n },\n \"job_type\": \"always_on\",\n \"backup_interval_hours\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.mihu.ai/api/v1/builders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"my-api\",\n \"entrypoint\": \"python3 main.py\",\n \"files\": {\n \"main.py\": \"...source...\",\n \"requirements.txt\": \"flask\"\n },\n \"port\": 8000,\n \"env\": {\n \"MY_FLAG\": \"1\"\n },\n \"resources\": {\n \"cpu\": 1,\n \"memory\": 1,\n \"disk\": 3\n },\n \"job_type\": \"always_on\",\n \"backup_interval_hours\": 0\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Builder created successfully",
"data": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "lead-watcher",
"preview_url": "<string>",
"service_token": "<string>",
"entrypoint": "python3 main.py",
"port": 8000,
"auto_stop_interval": 0,
"backup_interval_hours": 0,
"review_passed": true,
"qa_passed": true,
"cost": {
"currency": "EUR",
"hourly_rate": 0.1965,
"runtime_hours": 1.5,
"cost": 0.29
},
"created_at": "2023-11-07T05:31:56Z"
}
}Authorizations
Use a Bearer token to access these API endpoints. Example: "Bearer {your-token}"
Body
application/json
Builder name (lowercase letters, digits, dashes).
Example:
"my-api"
Command that starts your app. It must listen on 0.0.0.0 at port.
Example:
"python3 main.py"
Map of relative path → file contents. Include requirements.txt to pip-install before start.
Example:
{
"main.py": "...source...",
"requirements.txt": "flask"
}
Port your app listens on. Default 8000.
Example:
8000
Non-secret environment variables.
Example:
{ "MY_FLAG": "1" }
VM size. Defaults to 1 vCPU / 1 GB / 3 GB.
Show child attributes
Show child attributes
Available options:
always_on, one_time Example:
"always_on"
0 disables backups.
Example:
0
⌘I