> ## 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 infer responses

> Call POST /v1/responses on serverless inference.

## When To Use This

Use `tm infer responses` when you want the `/v1/responses` endpoint from the CLI.

Provide the request body as JSON and either include `model` in the body or pass `--model` to override it.

## Usage

```sh theme={null}
tm infer responses [OPTIONS]
```

## Examples

### Send a serverless responses request.

```sh theme={null}
tm infer responses --api-key YOUR_INFERENCE_API_KEY --model YOUR_SERVERLESS_MODEL_NAME --json '{"input":"Say hello."}'
```

### Stream response output text over SSE and fail a stalled stream after 30 seconds of upstream silence.

```sh theme={null}
tm infer responses --stream --stream-idle-timeout 30 --api-key YOUR_INFERENCE_API_KEY --model YOUR_SERVERLESS_MODEL_NAME --json '{"input":"Stream a short reply."}'
```

## Options

| Name                    | Type                 | Required | Default        | Details                                                                        |
| ----------------------- | -------------------- | -------- | -------------- | ------------------------------------------------------------------------------ |
| `--surface`             | `choice[serverless]` | no       | `"serverless"` | Inference surface to target.                                                   |
| `--model`               | `text`               | no       |                | Model name to use. Overrides `model` in the JSON request body.                 |
| `--api-key`             | `text`               | no       |                | Inference API key (Authorization: Bearer ...).                                 |
| `--base-url`            | `text`               | no       |                | Override the base URL for the selected surface.                                |
| `--stream`              | `boolean`            | no       | `false`        | Stream tokens via SSE. Boolean flag.                                           |
| `--stream-idle-timeout` | `float`              | no       | `300.0`        | Maximum idle read timeout in seconds for --stream responses.                   |
| `--json`                | `text`               | no       |                | JSON request body or @file.json. When omitted, reads piped stdin if available. |
| `--file`                | `path`               | no       |                | Read JSON request body from file.                                              |
| `--timeout`             | `float`              | no       |                | HTTP connect timeout in seconds for the inference request.                     |

## Inherited Global 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).                                             |          |    |          |                                                                   |
| `--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.                                                                                         |          |    |          |                                                                   |

## Auth Scope

* inference-api-key

## Caveats

* `--model` overrides the `model` field inside the JSON request body.
* `--stream` currently supports only `--output text`.

## Related Commands

* [`tm infer completions`](/cli/reference/infer/completions)
* [`tm infer chat`](/cli/reference/infer/chat)
* [`tm infer models`](/cli/reference/infer/models)

## Parent Command

* [`tm infer`](/cli/reference/infer)
