> For the list of every page, fetch /llms.txt. The API contract is the OpenAPI file linked from the API reference.

# mdw command reference

Every command of the `mdw` command line and every flag it takes. [Client libraries and the CLI](/run-sandboxes/clients) shows how to install `mdw` and a full run.

This page is written by a test from the commands themselves, so it matches the `mdw` built from the same commit. Your copy prints the same text with `mdw <command> --help`. A flag is written with one dash here and also takes two: `-json` and `--json` are the same.

## mdw

```text
mdw is the command line for the Meadow API.

Usage: mdw [--json] [--base-url URL] <command> [arguments]
       mdw --version

Commands:
  keys           create | list | revoke
  provider-keys  set | list | delete
  projects       create | list | get | update | delete
  models         list | call
  sandboxes      create | list | get | delete | network
  exec           run a command in a sandbox (blocking, --stream or --background)
  execs          get | kill | stdin, for background commands
  cp             copy files or directories to and from a sandbox
  ssh            open an SSH session to a sandbox
  ports          print the address of an exposed port
  images         build | list | get | delete
  usage          usage and cost over a date range; "usage requests" lists single model calls
  mcp            serve the Model Context Protocol on stdin and stdout, for coding agents

Environment:
  MEADOW_API_KEY   required
  MEADOW_BASE_URL  optional, or pass --base-url: defaults to https://api.usemeadow.ai

Run "mdw <command> --help" for the flags of one command.
```

## Flags every command takes

```text
  -base-url string
    	Meadow API address
  -json
    	print JSON
```

## mdw keys create

```text
  -allowed-model value
    	model id the key may call; repeatable
  -expires-at string
    	RFC 3339 time the key stops working
  -expires-in duration
    	lifetime from now, such as 24h
  -limit-reset string
    	when the limits reset: daily, weekly or monthly (UTC); empty for never
  -max-requests int
    	request limit
  -max-tokens int
    	token limit
  -name string
    	key name
  -project string
    	project the key belongs to (required)
  -scope value
    	models, sandboxes or admin; repeatable
```

## mdw keys list

No flags of its own.

## mdw keys revoke

No flags of its own.

## mdw provider-keys set

```text
  -credentials-file string
    	JSON file with the vendor credential; - reads stdin (default "-")
  -project value
    	limit the credential to this project; repeatable
```

## mdw provider-keys list

No flags of its own.

## mdw provider-keys delete

No flags of its own.

## mdw projects create

```text
  -clear-webhook-url
    	remove the webhook address
  -name string
    	project name
  -routing-file string
    	JSON file with the routing defaults; - reads stdin
  -webhook-url string
    	address for sandbox events
```

## mdw projects list

No flags of its own.

## mdw projects get

No flags of its own.

## mdw projects update

```text
  -clear-webhook-url
    	remove the webhook address
  -name string
    	project name
  -routing-file string
    	JSON file with the routing defaults; - reads stdin
  -webhook-url string
    	address for sandbox events
```

## mdw projects delete

No flags of its own.

## mdw models list

No flags of its own.

## mdw models call

```text
  -format string
    	wire format: chat, responses or messages (default "chat")
  -max-tokens int
    	output token limit (default 1024)
  -model string
    	model id, such as claude-opus-5-5 or anthropic/claude-opus-5-5 (required)
  -provider value
    	allow only this provider; repeatable
  -provider-order value
    	try providers in this order; repeatable
  -stream
    	print the reply as it arrives
```

## mdw sandboxes create

```text
  -allow-cidr value
    	outbound CIDR to allow; repeatable
  -allow-domain value
    	outbound domain to allow; repeatable
  -block-network
    	block all outbound network
  -cpu float
    	cores
  -disk-mb int
    	disk in MB
  -env value
    	NAME=VALUE; repeatable
  -gpu value
    	GPU type in order of preference; repeatable
  -gpu-count int
    	number of GPUs (default 1)
  -idle-timeout int
    	terminate after this many idle seconds
  -image string
    	registry image, such as python:3.12-slim
  -image-id string
    	image built with "mdw images build"
  -label value
    	NAME=VALUE; repeatable
  -memory-mb int
    	memory in MB
  -name string
    	sandbox name
  -port value
    	port to expose; repeatable
  -provider value
    	allow only this sandbox provider; repeatable
  -provider-order value
    	sandbox providers to try, in order; repeatable
  -ssh
    	make the sandbox reachable over SSH
  -timeout int
    	longest lifetime in seconds
  -wait
    	wait until the sandbox is running (default true)
  -webhook-url string
    	address for this sandbox's events
```

## mdw sandboxes list

```text
  -label value
    	NAME=VALUE; repeatable
  -status string
    	creating, running, terminating, terminated or failed
```

## mdw sandboxes get

No flags of its own.

## mdw sandboxes delete

No flags of its own.

## mdw sandboxes network

```text
  -allow-cidr value
    	outbound CIDR to allow; repeatable
  -allow-domain value
    	outbound domain to allow; repeatable
  -block-network
    	block all outbound network
  -open
    	open the network: remove every rule
```

## mdw exec

```text
  -background
    	start the command and return its exec id
  -cwd string
    	working directory
  -env value
    	NAME=VALUE; repeatable
  -follow
    	with --background, print output until the command exits
  -stdin
    	with --background, keep stdin open for "mdw execs stdin"
  -stream
    	print output as it arrives
  -timeout int
    	kill the command after this many seconds
  -user string
    	user name or uid
```

## mdw execs get

```text
  -follow
    	print output until the command exits
  -stderr-offset int
    	read stderr from this byte
  -stdout-offset int
    	read stdout from this byte
  -wait int
    	hold up to this many seconds for new output
```

## mdw execs kill

No flags of its own.

## mdw execs stdin

```text
  -close
    	end the command's input after sending
  -data string
    	text to send; without it, mdw sends its own stdin
```

## mdw cp

```text
  -links
    	with -r from a sandbox, create the symlinks and hard links in the directory
  -r	copy a directory
```

## mdw ssh

No flags of its own.

## mdw ports

No flags of its own.

## mdw images build

```text
  -build-on value
    	provider to build on now; repeatable
  -dockerfile string
    	Dockerfile path; default is DIR/Dockerfile
  -name string
    	image name
  -no-wait
    	return once the build has started
  -rebuild
    	build again even when the image exists
```

## mdw images list

No flags of its own.

## mdw images get

No flags of its own.

## mdw images delete

No flags of its own.

## mdw usage

```text
  -bucket string
    	width of one point of the trend: day or hour (default "day")
  -from string
    	start of the range, included: a UTC date or an RFC 3339 time
  -group-by string
    	split the trend by model, provider, key, project or none (default "model")
  -key string
    	count only this key id
  -model string
    	count only this model
  -project string
    	count only this project id
  -provider string
    	count only this provider
  -to string
    	end of the range, excluded: a UTC date or an RFC 3339 time
```

## mdw usage requests

```text
  -cursor string
    	the next_cursor of the page before
  -from string
    	start of the range, included: a UTC date or an RFC 3339 time
  -key string
    	count only this key id
  -limit int
    	rows to print, from 1 to 200 (default 50)
  -model string
    	count only this model
  -project string
    	count only this project id
  -provider string
    	count only this provider
  -to string
    	end of the range, excluded: a UTC date or an RFC 3339 time
```

## mdw mcp

No flags of its own.