Official Elixir SDK for the MIOSA API.
MIOSA provides cloud computers (Linux VMs with a full desktop) accessible via API. This SDK covers computer management, desktop control, file operations, and command execution. The desktop and exec primitives let your own AI agent (Claude, GPT, your own model, etc.) drive a MIOSA computer.
Installation
Add to your mix.exs:
defp deps do
[
{:miosa, "~> 0.1.0"}
]
endQuick Start
# Build a client
client = Miosa.client("msk_u_your_api_key")
# Create and start a computer
{:ok, computer} = Miosa.Computers.create(client, %{name: "my-workspace"})
:ok = Miosa.Computer.start(client, computer.id)
{:ok, computer} = Miosa.Computer.wait_until_running(client, computer.id)
# Control the desktop
{:ok, png} = Miosa.Desktop.screenshot(client, computer.id)
:ok = Miosa.Desktop.click(client, computer.id, 500, 300)
:ok = Miosa.Desktop.type(client, computer.id, "Hello, world!")
:ok = Miosa.Desktop.key(client, computer.id, "Return")
# Run commands
{:ok, result} = Miosa.Exec.bash(client, computer.id, "echo hello")
IO.puts(result.output)
# Upload and download files
:ok = Miosa.Files.upload(client, computer.id, "./local.txt", "/home/user/file.txt")
{:ok, content} = Miosa.Files.download(client, computer.id, "/home/user/file.txt")
# Drive the desktop yourself with your own AI agent — the SDK gives
# you the primitives (screenshot/click/type/key), you provide the loop:
{:ok, png} = Miosa.Desktop.screenshot(client, computer.id)
# ... pass `png` to your LLM, get back actions, replay via Miosa.Desktop ...
# Clean up
:ok = Miosa.Computer.stop(client, computer.id)
:ok = Miosa.Computer.destroy(client, computer.id)API Key
Get your API key from the MIOSA dashboard at https://app.miosa.ai/settings/api.
Keys have the format msk_u_... (user), msk_a_... (admin), or msk_p_... (platform).
Set via environment variable for safety:
client = Miosa.client(System.fetch_env!("MIOSA_API_KEY"))Modules
Miosa.Computers— Create, list, get, delete computersMiosa.Computer— Start, stop, restart, destroy a computer; wait for state transitionsMiosa.Sandboxes— Thin helper that creates lightweight code-exec computers (miosa-sandboxtemplate)Miosa.Deployments— Publish from a sandbox to a stable production URL; versions, rollback, custom domainsMiosa.Desktop— Screenshot, click, type, key, scroll, drag, windows, cursorMiosa.Exec— Run bash and Python inside a computerMiosa.Files— Upload, download, list, export, delete, write filesMiosa.Credits— Query credit balance, transactions, usageMiosa.Admin— Admin surface (/admin/*): users, tenants, credits, keys, Optimal model management (requiresmsk_a_/msk_p_key or admin JWT)Miosa.Databases— Managed Postgres databases: CRUD, start/stop/restart, credentials, logsMiosa.Storage— S3-compatible object storage: buckets, objects, presigned URLsMiosa.Volumes— Persistent block storage volumes: CRUDMiosa.FlatCustomDomains— Tenant-scoped custom domains across all computers/deploymentsMiosa.Functions— Edge functions: CRUD + synchronous invocationMiosa.CronJobs— Scheduled jobs: CRUD, pause/resume, run-now, execution historyMiosa.HealthChecks— Uptime monitors: CRUDMiosa.Webhooks— Outgoing webhooks: CRUD, test delivery, delivery historyMiosa.SandboxTemplates— Sandbox base images: CRUD, build-spec schema, validate, buildsMiosa.ApiKeys— Programmatic API key management: list, create, revokeMiosa.Tenant— Current tenant plan limits and live usage countersMiosa.Regions— Datacenter regions, compute sizes, pricing, community templatesMiosa.Settings— Tenant workspace config, branding, BYOK provider keysMiosa.Dashboard— Aggregated platform overview and health statusMiosa.Analytics— Admin-scoped overview and timeseries metricsMiosa.AuditLog— Admin-scoped event streamMiosa.Usage— Current period summary, per-session metering, report queriesMiosa.Channels— Notification channels (Slack, Discord, email): CRUD + enable/disableMiosa.Integrations— OAuth account-level integrations: GitHub, Slack, Linear, DiscordMiosa.ProjectIntegrations— Per-project provider keys injected as env vars into VMsMiosa.ProjectAuth— Built-in auth for generated apps inside sandboxes/deploymentsMiosa.ExternalKeys— BYOK encrypted per-user provider keys (Anthropic, OpenAI, etc.)Miosa.Mcp— Model Context Protocol JSON-RPC dispatch and SSE channelMiosa.Models— List available LLM models via the intelligence gatewayMiosa.Completions— OpenAI-compatible text and chat completions (streaming supported)Miosa.Embeddings— OpenAI-compatible embedding vectorsMiosa.ProviderDefaults— Admin: fleet-wide LLM provider routing defaults + per-tenant overridesMiosa.Benchmarks— Admin: trigger and inspect platform benchmark runsMiosa.CommandCenter— Read-only views of the Optimal AI agent fleet + SSE event streamMiosa.Community— Community template and agent catalog with install + rate actionsMiosa.Email— Admin email surface (sub-modules:Miosa.Email.Campaigns,Miosa.Email.Templates,Miosa.Email.Inbox)Miosa.BuilderSessions— Durable cross-device Builder UI session metadataMiosa.SnapshotsStandalone— Admin: fleet-wide snapshot indexMiosa.Computer.Terminal— PTY session create and resizeMiosa.Computer.Osa— In-VM OSA agent task dispatch, status, configureMiosa.Computer.AutoStop— Idle-timeout config read/updateMiosa.Computer.Inbox— Per-computer inbound-email inbox configMiosa.Computer.Env— Encrypted env-var CRUD (list, set, update, delete, bulk_set)Miosa.Computer.Logs— Log snapshot + SSE streamMiosa.Computer.Metrics— Time-series RAM/CPU/credit metricsMiosa.Computer.Ports— Per-port visibility CRUDMiosa.Computer.Volumes— Volume attachment managementMiosa.Sandbox.Terminal— Sandbox PTY session create and deleteMiosa.Sandbox.Events— Sandbox SSE event streamMiosa.Sandbox.Previews— Preview URL CRUD + share/revoke tokenMiosa.Sandbox.Env— Per-sandbox env-var readerMiosa.Sandbox.Tags— Sandbox tag replacementMiosa.Client— Low-level HTTP client (use directly for custom requests)Miosa.Types— All response struct typesMiosa.Error— Exception type raised/returned on errors
Summary
Functions
Creates a new MIOSA API client.
Functions
@spec client( String.t(), keyword() ) :: Miosa.Client.t()
Creates a new MIOSA API client.
This is the entry point for all SDK operations. The returned client is a plain struct — it is stateless and safe to share across processes.
Arguments
api_key— Your MIOSA API key. Must start with"msk_".
Options
:base_url— Override the API base URL. Defaults tohttps://api.miosa.ai/api/v1. Useful for local development with a self-hosted MIOSA instance.:timeout— Connection timeout in milliseconds. Defaults to30_000.:receive_timeout— Receive timeout for long-running requests. Defaults to60_000.:retry— Enable automatic retry on transient failures. Defaults tofalse.
Raises
ArgumentError— if the API key does not start with"msk_".
Example
client = Miosa.client("msk_u_abcdef123")
# Custom base URL for local dev
client = Miosa.client("msk_u_abcdef123", base_url: "http://localhost:4000/api/v1")