> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.meshapi.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.meshapi.ai/_mcp/server.

# Using the Mesh CLI

Once the CLI is [installed](/cli/install), you're one API key away from your
first response. Commands are identical on macOS and Windows — the only
difference is how you paste (**⌘+V** on Mac, **right-click** in PowerShell).

## 1. Get your API key

This is a one-time step.

1. Go to [app.meshapi.ai](https://app.meshapi.ai) and sign in (or create an account).
2. In the left menu, click **API Keys → Create key** and name it anything.
3. Click the copy icon. The key starts with `rsk_`. Keep it private — treat it like a password.

## 2. First launch

1. In Terminal (Mac) or PowerShell (Windows), run:

```bash
meshapi
```

2. It asks for your key once. Paste it and press **Enter**.

Nothing appears on screen while you paste the key — that's normal, it's hidden
for security.

3. You land on the home screen, which shows your **version**, current folder (**cwd**), and the active **model**:

```
+ meshapi 0.5.2
cwd:    /private/tmp/mesh-demo
model:  openai/gpt-4o-mini
route:  off

type /help for commands, /exit to quit
```

## 3. Say hello

Type a message and press **Enter**:

```
hello
```

The answer streams in. The status line under every answer shows the **model
used**, **tokens in→out**, **cost**, and **time**:

```
Hello! How can I assist you today?
gpt-4o-mini · 2024-07-18 · 1979→10 tok · 2.4s
```

## 4. Switch models

Over 1000 models are available.

* Type `/model ` and start typing a name — a suggestion menu pops up as you type (e.g. `qw` shows all Qwen models). Pick with the arrow keys + **Enter**.
* Or type it in full:

```
/model openai/gpt-4o-mini
```

* To browse the full catalog with prices, type `/models` (or filter, e.g. `/models claude`). Prices are shown **per 1 million tokens**.

Don't want to pick manually? Turn on automatic routing with `/route auto` and
Mesh chooses the best model for each prompt. See
[Auto Routing](/auto-routing).

## 5. Let it write and run code

The CLI can create and run files for you. Try:

```
write a hello.py file that prints Hello Mesh, then run it
```

Before touching your computer, the CLI **asks permission** and shows exactly
what it wants to do:

```
○ approve tool call?  write_file: hello.py (19 chars)
→ /private/tmp/mesh-demo/hello.py

print('Hello Mesh')

y (yes) / a (always for write_file this session) / n (no) ›
```

Your three choices:

* **`y`** — yes, this once.
* **`a`** — yes, and don't ask again for this tool for the rest of the session.
* **`n`** — no.

Press `y` to write the file, then `y` again when it asks to run it. The CLI
runs the file and shows the output:

```
$ python3 hello.py
Hello Mesh
✓ exit 0
```

How much the CLI can do without asking depends on the current **permission
mode** — see [Commands & permission modes](/cli/commands#permission-modes).

## Next step

Learn the [commands and permission modes](/cli/commands) you'll use every day.