> ## 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 or inference 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.

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

{/* Do not hand-edit. Update OVERRIDES / NOTES / HIDDEN_FLAGS in the generator. */}

<ParamField body="-F, --field" type="TEXT (repeatable)">
  Add a string field (key=value), parsed as JSON value
</ParamField>

<ParamField body="-H, --header" type="TEXT (repeatable)">
  Add a request header (key:value)
</ParamField>

<ParamField body="--input" type="TEXT">
  Read request body from file (use - for stdin)
</ParamField>

<ParamField body="-q, --jq" type="TEXT">
  Filter JSON output with a jq expression; implies --output json (or jsonl for streamed commands)
</ParamField>

<ParamField body="-X, --method" type="TEXT">
  HTTP method, defaults to GET or POST if fields are provided
</ParamField>

<ParamField body="-o, --output" type="TEXT" default="text">
  Output format

  One of: `text`, `json`, `jsonl`, `none`
</ParamField>

<ParamField body="--profile" type="TEXT">
  Use a specific stored profile for this command, overriding BASETEN\_PROFILE and the current profile
</ParamField>

<ParamField body="-f, --raw-field" type="TEXT (repeatable)">
  Add a raw string field (key=value)
</ParamField>

<ParamField body="-v, --verbose" type="BOOL">
  Enable verbose logging
</ParamField>

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

{/* Do not hand-edit. Update OVERRIDES / NOTES / HIDDEN_FLAGS in the generator. */}

<ParamField body="--chain-id" type="TEXT">
  Chain ID to target
</ParamField>

<ParamField body="--environment" type="TEXT">
  Environment name (e.g. production)
</ParamField>

<ParamField body="-F, --field" type="TEXT (repeatable)">
  Add a string field (key=value), parsed as JSON value
</ParamField>

<ParamField body="-H, --header" type="TEXT (repeatable)">
  Add a request header (key:value)
</ParamField>

<ParamField body="--input" type="TEXT">
  Read request body from file (use - for stdin)
</ParamField>

<ParamField body="-q, --jq" type="TEXT">
  Filter JSON output with a jq expression; implies --output json (or jsonl for streamed commands)
</ParamField>

<ParamField body="-X, --method" type="TEXT">
  HTTP method, defaults to GET or POST if fields are provided
</ParamField>

<ParamField body="--model-id" type="TEXT">
  Model ID to target
</ParamField>

<ParamField body="-o, --output" type="TEXT" default="text">
  Output format

  One of: `text`, `json`, `jsonl`, `none`
</ParamField>

<ParamField body="--profile" type="TEXT">
  Use a specific stored profile for this command, overriding BASETEN\_PROFILE and the current profile
</ParamField>

<ParamField body="-f, --raw-field" type="TEXT (repeatable)">
  Add a raw string field (key=value)
</ParamField>

<ParamField body="-v, --verbose" type="BOOL">
  Enable verbose logging
</ParamField>

### 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).
