> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tensormesh.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# tm

> Tensormesh command-line interface.

## Before You Use `tm`

* Install the CLI first if `tm` is not already on your `PATH`. In this repo checkout, use `./.venv/bin/tm` until your shell already exposes `tm`.
* Start with `tm init` if you are not sure what is already configured locally.
* Use `tm auth login` to obtain a Control Plane bearer token.
* Put global options such as `--output json` before the subcommand.
* Set `TM_CONFIG_HOME` when you need an alternate config and auth root for local scripting.
* Use `tm auth status`, `tm infer doctor`, and `tm doctor` for local readiness checks.
* Use `tm auth whoami` for a live Control Plane auth check and `tm infer chat` for an end-to-end inference check.

## Usage

```sh theme={null}
tm [OPTIONS] COMMAND [ARGS]...
```

## Examples

### Inspect local setup and print the shortest path to a working request.

```sh theme={null}
tm init
```

### Inspect serverless readiness before the first request.

```sh theme={null}
tm infer doctor
```

### Inspect local Control Plane and inference auth state.

```sh theme={null}
tm auth status
```

### Send a basic serverless chat request.

```sh theme={null}
tm infer chat --api-key YOUR_INFERENCE_API_KEY --model YOUR_SERVERLESS_MODEL_NAME --json '[{"role":"user","content":"hi"}]'
```

## Details

Tensormesh CLI for Control Plane and Inference API workflows.

## Subcommands

* [`tm activities`](/cli/reference/activities): Activities (Control Plane).
* [`tm admin`](/cli/reference/admin): Admin-only commands (Control Plane).
* [`tm auth`](/cli/reference/auth): Authenticate to the Tensormesh Control Plane.
* [`tm billing`](/cli/reference/billing): Billing and usage (Control Plane).
* [`tm completion`](/cli/reference/completion): Print a shell completion script for Bash/Zsh/Fish.
* [`tm config`](/cli/reference/config): Manage Tensormesh CLI configuration.
* [`tm cost`](/cli/reference/cost): Per-model serverless spend and KV-cache savings.
* [`tm doctor`](/cli/reference/doctor): Diagnose configuration and credentials.
* [`tm infer`](/cli/reference/infer): Inference commands for the OpenAI-compatible serverless endpoints.
* [`tm init`](/cli/reference/init): Guide first-time CLI setup for Control Plane and serverless workflows.
* [`tm metrics`](/cli/reference/metrics): Observability metrics (Control Plane).
* [`tm products`](/cli/reference/products): Products (Control Plane).
* [`tm reserved-deployments`](/cli/reference/reserved-deployments): Reserved deployments (Support; Control Plane).
* [`tm tickets`](/cli/reference/tickets): Support tickets (Control Plane).
* [`tm users`](/cli/reference/users): User profile resources (Control Plane).
* [`tm version`](/cli/reference/version): Show CLI version and runtime details.

## Options

| Name                  | Type           | Required | Default                              | Details                                                                                                                      |          |    |          |                                                                   |
| --------------------- | -------------- | -------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | -------- | -- | -------- | ----------------------------------------------------------------- |
| `--version`, `-V`     | `boolean`      | no       | `false`                              | Show the version and exit. Boolean flag.                                                                                     |          |    |          |                                                                   |
| `--config`            | `path`         | no       | `"~/.config/tensormesh/config.toml"` | Path to config TOML file                                                                                                     |          |    |          |                                                                   |
| `--output`            | \`choice\[text | json     | yaml                                 | raw                                                                                                                          | table]\` | no | `"text"` | Output format (text is human-readable; json is machine-friendly). |
| `--quiet`             | `boolean`      | no       | `false`                              | Suppress non-essential output. Boolean flag.                                                                                 |          |    |          |                                                                   |
| `--debug`             | `boolean`      | no       | `false`                              | Print debug logs to stderr (secrets redacted). Boolean flag.                                                                 |          |    |          |                                                                   |
| `--ca-bundle`         | `path`         | no       |                                      | Path to a PEM CA bundle for TLS verification (overrides TENSORMESH\_CA\_BUNDLE).                                             |          |    |          |                                                                   |
| `--timeout`           | `float`        | no       |                                      | Default HTTP timeout in seconds (overrides TENSORMESH\_TIMEOUT\_SECONDS; subcommands may override).                          |          |    |          |                                                                   |
| `--max-retries`       | `integer`      | no       |                                      | Max retries for idempotent HTTP requests on transient errors (overrides TENSORMESH\_MAX\_RETRIES; subcommands may override). |          |    |          |                                                                   |
| `--controlplane-base` | `text`         | no       |                                      | Override the Control Plane base URL.                                                                                         |          |    |          |                                                                   |

## Environment Variables

* `TENSORMESH_CA_BUNDLE`
* `TENSORMESH_TIMEOUT_SECONDS`
* `TENSORMESH_MAX_RETRIES`
* `TM_CONFIG_HOME`

## Related Commands

* [`tm init`](/cli/reference/init)
* [`tm config show`](/cli/reference/config/show)
* [`tm doctor`](/cli/reference/doctor)

## Additional Notes

Config precedence: flags > env > config.toml (\[overrides] before \[managed]) > defaults.

Global options such as --output must come before the subcommand:
tm --output json auth status

`gateway_api_key` in config.toml stores the inference API key used by serverless
requests. Set it under \[overrides] in config.toml, or pass --api-key on each request.
It has no environment-variable equivalent. Control Plane auth uses auth.json under
the active state root.

Quickstart:
tm auth login
tm auth status
tm infer chat --api-key YOUR\_INFERENCE\_API\_KEY --model YOUR\_SERVERLESS\_MODEL\_NAME \
\--json '\[\{"role":"user","content":"hi"}]'
