OpenComputers lets you register physical or virtual machines you already own (Mac, Linux, Windows) and control them through MIOSA’s API — run commands, manage files, expose HTTP tunnels, dispatch AI agents, build inference clusters, and manage secrets.
Base path: /api/v1/opencomputers
Verbs supported: GET (list/show), POST (register/create/exec/dispatch), PATCH (update tags/tunnels), DELETE (revoke/cancel).
Hosts
List hosts
GET /api/v1/opencomputers/hosts
| Parameter | Type | Description |
|---|---|---|
page | integer | Page number (default: 1) |
per_page | integer | Items per page (default: 20, max: 100) |
{
"data": [
{
"id": "host_abc123",
"name": "my-mac",
"region": "us-east",
"status": "online",
"tenant_id": "t_abc",
"labels": { "env": "prod" },
"created_at": "2026-01-01T00:00:00Z",
"updated_at": "2026-01-01T00:00:00Z"
}
],
"meta": { "total": 1, "page": 1, "per_page": 20 }
} Host statuses: pending | online | offline | error | revoked
Register a host
POST /api/v1/opencomputers/hosts
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Display name for the host |
region | string | No | Region label |
labels | object | No | Key-value metadata |
{
"id": "host_abc123",
"name": "my-mac",
"host_key": "hk_xxxxxxxxxxxxxxxx",
"status": "pending",
"tenant_id": "t_abc",
"labels": {},
"created_at": "2026-01-01T00:00:00Z",
"updated_at": "2026-01-01T00:00:00Z"
} Get a host
GET /api/v1/opencomputers/hosts/{id}
Revoke a host
DELETE /api/v1/opencomputers/hosts/{id}
Returns 204 No Content. The host agent will no longer be able to authenticate.
Host event stream (SSE)
GET /api/v1/opencomputers/hosts/{id}/events
Streams real-time lifecycle events from the host as Server-Sent Events.
event: status_change
data: {"type":"status_change","host_id":"host_abc","data":{"status":"online"},"timestamp":"..."} Jobs
Run shell commands on a registered host and retrieve output.
Run a job
POST /api/v1/opencomputers/hosts/{id}/exec
| Field | Type | Required | Description |
|---|---|---|---|
command | string | Yes | Command to execute |
args | string[] | No | Arguments (passed separately from shell expansion) |
env | string[] | No | Environment variables in KEY=VALUE format |
cwd | string | No | Working directory |
timeout | integer | No | Timeout in seconds (default: 60) |
{
"id": "job_xyz",
"host_id": "host_abc123",
"status": "completed",
"command": "npm test",
"args": [],
"exit_code": 0,
"stdout": "All tests passed.\n",
"stderr": "",
"created_at": "2026-01-01T00:00:00Z",
"updated_at": "2026-01-01T00:00:00Z",
"completed_at": "2026-01-01T00:00:05Z"
} Job statuses: queued | running | completed | failed | cancelled
List jobs
GET /api/v1/opencomputers/hosts/{id}/exec
Get a job
GET /api/v1/opencomputers/hosts/{id}/exec/{job_id}
Stream job output (SSE)
GET /api/v1/opencomputers/hosts/{id}/exec/{job_id}/stream
Streams stdout/stderr in real time while the job is running.
Cancel a job
DELETE /api/v1/opencomputers/hosts/{id}/exec/{job_id}
Returns 204 No Content.
File System
Manage files and directories on a registered host.
| Endpoint | Method | Description |
|---|---|---|
/opencomputers/hosts/{id}/fs/list | GET | List directory (?path=) |
/opencomputers/hosts/{id}/fs/stat | GET | Stat a path (?path=) |
/opencomputers/hosts/{id}/fs/download | GET | Download a file (?path=) |
/opencomputers/hosts/{id}/fs/upload | POST | Upload a file (multipart, ?path=) |
/opencomputers/hosts/{id}/fs/delete | DELETE | Delete file/dir (?path=) |
/opencomputers/hosts/{id}/fs/mkdir | POST | Create directory ({"path":"..."}) |
List response:
{
"path": "/home/user/projects",
"entries": [
{
"name": "my-app",
"path": "/home/user/projects/my-app",
"size": 0,
"is_dir": true,
"modified_at": "2026-01-01T00:00:00Z"
}
]
} Terminal
Issue a terminal ticket
POST /api/v1/opencomputers/hosts/{id}/terminal/ticket
Returns a short-lived WebSocket authentication ticket. Connect to ws_url immediately using the ticket as a query parameter.
{
"ticket": "tk_abc123",
"ws_url": "wss://api.miosa.ai/opencomputers/ws/terminal?ticket=tk_abc123",
"expires_at": "2026-01-01T00:00:30Z"
} Desktop (VNC)
Issue a desktop ticket
POST /api/v1/opencomputers/hosts/{id}/desktop/ticket
Same shape as the terminal ticket. Connect to ws_url with the ticket to
start a VNC session.
Tunnels
Expose local ports on the host over MIOSA-managed public URLs.
List tunnels
GET /api/v1/opencomputers/hosts/{id}/tunnels
Create a tunnel
POST /api/v1/opencomputers/hosts/{id}/tunnels
| Field | Type | Required | Description |
|---|---|---|---|
target_port | integer | Yes | Local port to expose |
auth_mode | string | No | public | tenant_only | password (default: public) |
slug | string | No | Custom slug for the public URL |
{
"id": "tun_abc",
"host_id": "host_abc123",
"slug": "my-app-dev",
"target_port": 3000,
"auth_mode": "public",
"public_url": "https://api.miosa.ai/t/my-app-dev",
"enabled": true,
"created_at": "2026-01-01T00:00:00Z",
"updated_at": "2026-01-01T00:00:00Z"
} Get / Update / Delete a tunnel
GET /api/v1/opencomputers/hosts/{id}/tunnels/{tunnel_id}
PATCH /api/v1/opencomputers/hosts/{id}/tunnels/{tunnel_id}
| Field | Type | Description |
|---|---|---|
target_port | integer | Change target port |
auth_mode | string | Change auth mode |
enabled | boolean | Enable or disable the tunnel |
DELETE /api/v1/opencomputers/hosts/{id}/tunnels/{tunnel_id} — 204 No Content
Agents
Dispatch an AI agent to complete a task autonomously on the host.
Dispatch an agent
POST /api/v1/opencomputers/hosts/{id}/agent/dispatch
| Field | Type | Required | Description |
|---|---|---|---|
task | string | Yes | Natural-language task description |
model_id | string | No | Override the default model |
max_turns | integer | No | Maximum conversation turns (default: 20) |
context | object | No | Additional context key-value pairs |
{
"id": "sess_abc",
"host_id": "host_abc123",
"task": "Run the test suite and fix any failing tests",
"status": "pending",
"max_turns": 20,
"turns_used": 0,
"created_at": "2026-01-01T00:00:00Z",
"updated_at": "2026-01-01T00:00:00Z",
"completed_at": null,
"error": null
} Session statuses: pending | running | completed | failed | cancelled
List / Get sessions
GET /api/v1/opencomputers/hosts/{id}/agent/sessions
GET /api/v1/opencomputers/hosts/{id}/agent/sessions/{session_id}
Stream agent events (SSE)
GET /api/v1/opencomputers/hosts/{id}/agent/sessions/{session_id}/stream
Cancel a session
DELETE /api/v1/opencomputers/hosts/{id}/agent/sessions/{session_id} — 204 No Content
Inference Clusters
Group multiple hosts to serve an LLM over an OpenAI-compatible endpoint.
List clusters
GET /api/v1/opencomputers/clusters
Create a cluster
POST /api/v1/opencomputers/clusters
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Cluster name |
model | string | Yes | Model to serve (e.g. llama3:70b) |
host_ids | string[] | Yes | IDs of hosts in the cluster |
{
"id": "cl_abc",
"name": "my-cluster",
"model": "llama3:70b",
"slug": "my-cluster",
"status": "active",
"host_ids": ["host_abc123"],
"inference_url": "https://api.miosa.ai/inference/my-cluster/v1",
"created_at": "2026-01-01T00:00:00Z",
"updated_at": "2026-01-01T00:00:00Z"
} The inference_url is OpenAI-compatible:
POST {inference_url}/chat/completions Get / Start / Stop / Delete
GET /api/v1/opencomputers/clusters/{id}
POST /api/v1/opencomputers/clusters/{id}/start
POST /api/v1/opencomputers/clusters/{id}/stop
DELETE /api/v1/opencomputers/clusters/{id} — 204 No Content
Secrets
Store encrypted key-value secrets accessible to the host agent at runtime.
Tenant-scoped secrets
| Endpoint | Method | Description |
|---|---|---|
/opencomputers/secrets | GET | List tenant secrets |
/opencomputers/secrets | POST | Create a secret |
/opencomputers/secrets/{id} | PATCH | Update value or description |
/opencomputers/secrets/{id} | DELETE | Delete a secret |
Host-scoped secrets
| Endpoint | Method | Description |
|---|---|---|
/opencomputers/hosts/{id}/secrets | GET | List host secrets |
/opencomputers/hosts/{id}/secrets | POST | Create a host secret |
/opencomputers/hosts/{id}/secrets/{secret_id} | DELETE | Delete a host secret |
Create request:
{ "name": "GITHUB_TOKEN", "value": "ghp_xxx", "description": "CI token" } Response (value is never returned):
{
"id": "sec_abc",
"name": "GITHUB_TOKEN",
"description": "CI token",
"host_id": null,
"tenant_id": "t_abc",
"created_at": "2026-01-01T00:00:00Z",
"updated_at": "2026-01-01T00:00:00Z"
} SDK Examples
Common Errors
| Status | Code | Cause |
|---|---|---|
| 404 | NOT_FOUND | Host or resource does not exist in this tenant |
| 403 | FORBIDDEN | Authenticated but not authorized |
| 400 | INVALID_ID | Path parameter is not a valid ID |
| 409 | — | Host is offline; command cannot be dispatched |
| 502 | — | Host agent is unreachable |
See also
- Computers API — managed MIOSA VMs vs. BYOC hosts
- Exec API — exec on managed computers
- Regions — region slugs accepted on host creation
- Error Codes — complete error code reference