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

# baseten api

> Make raw API requests

Make raw HTTP requests to Baseten management, inference, or sandbox APIs.

The HTTP method defaults to GET, or POST when `--field`, `--raw-field`, or `--input` is provided. JSON responses are pretty-printed by default; non-JSON responses are streamed raw. Use `--jq` to filter JSON responses. Pass `--verbose` to log the request URL, the response status, and the response headers to stderr.

## management

```sh theme={"system"}
baseten api management [OPTIONS] <api-path>
```

Make raw HTTP requests to the Baseten management API (api.baseten.co).

Paths are relative to /v1/, so 'baseten api management models' requests /v1/models.

### Options

**-F, --field** `TEXT (repeatable)`

Add a string field (key=value), parsed as JSON value

**-H, --header** `TEXT (repeatable)`

Add a request header (key:value)

**--input** `TEXT`

Read request body from file (use - for stdin)

**-q, --jq** `TEXT`

Filter JSON output with a jq expression; implies `--output` json (or jsonl for streamed commands)

**-X, --method** `TEXT`

HTTP method, defaults to GET or POST if fields are provided

**-o, --output** `TEXT` (default: text)

Output format

One of: `text`, `json`, `jsonl`, `none`

**--profile** `TEXT`

Use a specific stored profile for this command, overriding BASETEN\_PROFILE and the current profile

**-f, --raw-field** `TEXT (repeatable)`

Add a raw string field (key=value)

**-v, --verbose** `BOOL`

Enable verbose logging

### Examples

GET a management resource

```sh theme={"system"}
baseten api management models
```

POST a management resource with fields

```sh theme={"system"}
baseten api management models --field name=my-model
```

### Filter output with `--jq`

List model IDs from /v1/models

```sh theme={"system"}
baseten api management models --jq '.models[].id'
```

### Output

**Text mode (`--output text`):** The HTTP response body, passed through verbatim. JSON responses are pretty-printed; non-JSON responses are streamed raw to stdout.

**JSON mode (`--output json`):** payload type `cmd.JSONUndefined`.

Shape depends on the requested endpoint. See the management API OpenAPI spec at [https://api.baseten.co/v1/spec](https://api.baseten.co/v1/spec).

## inference

```sh theme={"system"}
baseten api inference [OPTIONS] <api-path>
```

Make raw HTTP requests to a Baseten inference endpoint.

Requires either `--model-id` or `--chain-id` to identify the target. Use `--environment` to target a specific environment (e.g. production).

### Options

**--chain-id** `TEXT`

Chain ID to target

**--environment** `TEXT`

Environment name (e.g. production)

**-F, --field** `TEXT (repeatable)`

Add a string field (key=value), parsed as JSON value

**-H, --header** `TEXT (repeatable)`

Add a request header (key:value)

**--input** `TEXT`

Read request body from file (use - for stdin)

**-q, --jq** `TEXT`

Filter JSON output with a jq expression; implies `--output` json (or jsonl for streamed commands)

**-X, --method** `TEXT`

HTTP method, defaults to GET or POST if fields are provided

**--model-id** `TEXT`

Model ID to target

**-o, --output** `TEXT` (default: text)

Output format

One of: `text`, `json`, `jsonl`, `none`

**--profile** `TEXT`

Use a specific stored profile for this command, overriding BASETEN\_PROFILE and the current profile

**-f, --raw-field** `TEXT (repeatable)`

Add a raw string field (key=value)

**-v, --verbose** `BOOL`

Enable verbose logging

### Examples

POST a predict body to a model

```sh theme={"system"}
baseten api inference production/predict --model-id <model-id> --field prompt=hello
```

### Filter output with `--jq`

Filter a JSON predict response

```sh theme={"system"}
baseten api inference production/predict --model-id <model-id> --field prompt=hello --jq '.result'
```

### Output

**Text mode (`--output text`):** The inference endpoint's response body, passed through verbatim. JSON responses are pretty-printed; non-JSON responses are streamed raw.

**JSON mode (`--output json`):** payload type `cmd.JSONUndefined`.

Shape depends on the model and endpoint. See the inference API OpenAPI spec at [https://api.baseten.co/inference-spec](https://api.baseten.co/inference-spec).

## sandbox

```sh theme={"system"}
baseten api sandbox [OPTIONS] <api-path>
```

> [!NOTE]
>
> PRE-RELEASE: Sandbox commands are not GA yet. Their arguments, flags, and output may change.

Make raw HTTP requests to a sandbox's own API, which runs processes and manages files inside the sandbox.

Paths are relative to `--sandbox-url`, the sandbox's URL as shown by `baseten sandbox describe`, so `baseten api sandbox process --sandbox-url <url>` requests `<url>/process`.

### Options

**-F, --field** `TEXT (repeatable)`

Add a string field (key=value), parsed as JSON value

**-H, --header** `TEXT (repeatable)`

Add a request header (key:value)

**--input** `TEXT`

Read request body from file (use - for stdin)

**-q, --jq** `TEXT`

Filter JSON output with a jq expression; implies `--output` json (or jsonl for streamed commands)

**-X, --method** `TEXT`

HTTP method, defaults to GET or POST if fields are provided

**-o, --output** `TEXT` (default: text)

Output format

One of: `text`, `json`, `jsonl`, `none`

**--profile** `TEXT`

Use a specific stored profile for this command, overriding BASETEN\_PROFILE and the current profile

**-f, --raw-field** `TEXT (repeatable)`

Add a raw string field (key=value)

**--sandbox-url** `TEXT` *required*

Sandbox URL to target, as shown by 'baseten sandbox describe'

**-v, --verbose** `BOOL`

Enable verbose logging

### Examples

List processes in a sandbox, looking up its URL by name

```sh theme={"system"}
baseten api sandbox process --sandbox-url "$(baseten sandbox describe --name my-sandbox --jq .url)"
```

### Filter output with `--jq`

Filter a JSON sandbox API response

```sh theme={"system"}
baseten api sandbox process --sandbox-url "$(baseten sandbox describe --name my-sandbox --jq .url)" --jq '.items[].pid'
```

### Output

**Text mode (`--output text`):** The sandbox API's response body, passed through verbatim. JSON responses are pretty-printed; non-JSON responses are streamed raw.

**JSON mode (`--output json`):** payload type `cmd.JSONUndefined`.

Shape depends on the requested endpoint.
