Create environment
Creates a VM, uploads the manifest, starts the agent, and assigns the task. Blocks until the VM is running or creation fails. The manifest and secrets are passed inline as byte strings; a future revision may add manifest-ref indirection.
GPU requests are validated at the API boundary (not just in the
CLI): negative gpus, a malformed gpu_profile, a profile with
gpus < 1, or a profile on a non-MIG gpu_kind each return 400
on the first failure. gpu_profile is lowercased on the way in.
A GPU request with no registered GPU host fails 503
(gpu workloads require a registered gpu host). manifest_inline
must be standard base64; a bad encoding is a 400. Secrets are
validated against the manifest before provisioning, and secret
values are redacted from error messages.
Placement is validated at the boundary too: a malformed
spec.labels key or value is a 400, and an unknown spec.host_id
is a 404 before any VM is created. A pin to a real but ineligible
host, and a label selector that matches no host, both fail 503 with
a message naming the gate that rejected them.
/v1/environmentsAuthorizationBearer token · headerrequiredfuse_sessionAPI key · cookierequiredapplication/jsontask_idstringrequiredspecobjectrequiredShow propertiesHide properties
cpusinteger<int32>ram_mbinteger<int32>storage_gbinteger<int32>gpusinteger<int32>gpu_kindstringgpu_profilestringimagestringregionstringhost_idstringlabelsobjectmax_runtime_secondsinteger<int64>idle_timeout_secondsinteger<int64>manifest_inlinestringsecretsobjectstartup_scriptstringfilesobjectstartup_script_timeout_secondsinteger<int64>gateway_urlstringgateway_tokenstringexposeExposeSpec[]Show propertiesHide properties
ExposeSpecportintegerrequiredasstringhealthcheckobjectShow propertiesHide properties
httpHealthcheckHTTPShow propertiesHide properties
portintegerrequiredpathstringexecstring[]interval_secondsinteger<int64>timeout_secondsinteger<int64>retriesintegerstart_period_secondsinteger<int64>desktopobjectShow propertiesHide properties
widthintegerrequiredheightintegerrequiredidstringrequiredstatestringrequiredprovisioningrunningdrainingdestroyingtask_idstringrequiredhost_idstringurlstringrequiredspecResourceSpecrequiredShow propertiesHide properties
cpusinteger<int32>ram_mbinteger<int32>storage_gbinteger<int32>gpusinteger<int32>gpu_kindstringgpu_profilestringimagestringregionstringhost_idstringlabelsobjectmax_runtime_secondsinteger<int64>idle_timeout_secondsinteger<int64>created_atstring<date-time>requiredupdated_atstring<date-time>requirederrorstringendpointsEndpoint[]Show propertiesHide properties
EndpointasstringurlstringrequiredportintegerrequiredhealthobjectShow propertiesHide properties
statestringrequiredstartingpassingfailingsincestring<date-time>failuresintegermessagestringerrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedmessagestringrequireddetailsobjecterrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedmessagestringrequireddetailsobjecterrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedmessagestringrequireddetailsobjecterrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedmessagestringrequireddetailsobjecterrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedmessagestringrequireddetailsobjectcurl -X POST "http://localhost:8080/v1/environments" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"task_id": "string",
"spec": {
"cpus": 0,
"ram_mb": 0,
"storage_gb": 0,
"gpus": 0,
"gpu_kind": "string",
"gpu_profile": "string",
"image": "string",
"region": "string",
"host_id": "string",
"labels": {},
"max_runtime_seconds": 0,
"idle_timeout_seconds": 0
},
"manifest_inline": "string",
"secrets": {},
"startup_script": "string",
"files": {},
"startup_script_timeout_seconds": 0,
"gateway_url": "string",
"gateway_token": "string",
"expose": [
{
"port": 0,
"as": "string"
}
],
"healthcheck": {
"http": {
"port": 0,
"path": "string"
},
"exec": [
"string"
],
"interval_seconds": 0,
"timeout_seconds": 0,
"retries": 0,
"start_period_seconds": 0
},
"desktop": {
"width": 0,
"height": 0
}
}'const response = await fetch("http://localhost:8080/v1/environments", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"task_id": "string",
"spec": {
"cpus": 0,
"ram_mb": 0,
"storage_gb": 0,
"gpus": 0,
"gpu_kind": "string",
"gpu_profile": "string",
"image": "string",
"region": "string",
"host_id": "string",
"labels": {},
"max_runtime_seconds": 0,
"idle_timeout_seconds": 0
},
"manifest_inline": "string",
"secrets": {},
"startup_script": "string",
"files": {},
"startup_script_timeout_seconds": 0,
"gateway_url": "string",
"gateway_token": "string",
"expose": [
{
"port": 0,
"as": "string"
}
],
"healthcheck": {
"http": {
"port": 0,
"path": "string"
},
"exec": [
"string"
],
"interval_seconds": 0,
"timeout_seconds": 0,
"retries": 0,
"start_period_seconds": 0
},
"desktop": {
"width": 0,
"height": 0
}
})
});import requests
response = requests.post(
"http://localhost:8080/v1/environments",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
json={
"task_id": "string",
"spec": {
"cpus": 0,
"ram_mb": 0,
"storage_gb": 0,
"gpus": 0,
"gpu_kind": "string",
"gpu_profile": "string",
"image": "string",
"region": "string",
"host_id": "string",
"labels": {},
"max_runtime_seconds": 0,
"idle_timeout_seconds": 0
},
"manifest_inline": "string",
"secrets": {},
"startup_script": "string",
"files": {},
"startup_script_timeout_seconds": 0,
"gateway_url": "string",
"gateway_token": "string",
"expose": [
{
"port": 0,
"as": "string"
}
],
"healthcheck": {
"http": {
"port": 0,
"path": "string"
},
"exec": [
"string"
],
"interval_seconds": 0,
"timeout_seconds": 0,
"retries": 0,
"start_period_seconds": 0
},
"desktop": {
"width": 0,
"height": 0
}
},
){
"id": "string",
"state": "provisioning",
"task_id": "string",
"host_id": "string",
"url": "string",
"spec": {
"cpus": 0,
"ram_mb": 0,
"storage_gb": 0,
"gpus": 0,
"gpu_kind": "string",
"gpu_profile": "string",
"image": "string",
"region": "string",
"host_id": "string",
"labels": {},
"max_runtime_seconds": 0,
"idle_timeout_seconds": 0
},
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z",
"error": "string",
"endpoints": [
{
"as": "string",
"url": "string",
"port": 0
}
],
"health": {
"state": "starting",
"since": "2024-01-01T00:00:00Z",
"failures": 0,
"message": "string"
}
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}