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

# sf serve

> Playground 推理服务的启动、列表、续期与停止

工作流讲解见 [Playground](/zh-Hans/guides/playground)。

## sf serve start

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf serve start <MODEL> [选项]
```

| 参数 / 选项       | 说明                                                    |
| ------------- | ----------------------------------------------------- |
| `MODEL`（必填）   | HF id / 共享盘绝对路径 / `run:<run_id>`（取该 run 的 hf\_export） |
| `-g, --gpus`  | 卡数 = 张量并行度（默认 1）                                      |
| `--ttl-hours` | 闲置 TTL（小时）；默认取服务端配置                                   |

## sf serve ls / extend / stop

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf serve ls                          # 我的服务：状态、端点、剩余 TTL
sf serve extend <SERVE_ID> --ttl-hours 4
sf serve stop <SERVE_ID>
```

<Warning>
  服务占真实 GPU 配额；TTL 到期自动停止释放卡。长时间使用请 `extend`，不用了尽早 `stop`。
</Warning>

服务是 OpenAI 兼容端点——`sf serve ls` 给出的地址可直接配给任何 OpenAI SDK 客户端。

## `sf serve`

Manage inference services

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf serve <subcommand>
```

| 命令                | 说明                                |
| ----------------- | --------------------------------- |
| `sf serve extend` | Extend an inference service's TTL |
| `sf serve ls`     | List my inference services        |
| `sf serve start`  | Start an inference service        |
| `sf serve stop`   | Stop an inference service         |

### `sf serve extend`

Extend an inference service's TTL

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf serve extend <RUN_ID> [options]
```

| 参数       | 说明     |
| -------- | ------ |
| `RUN_ID` | **必填** |

| 选项                  | 说明                                   |
| ------------------- | ------------------------------------ |
| `--hours` `<float>` | How much longer, in hours (默认 `1.0`) |

### `sf serve ls`

List my inference services

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf serve ls
```

除 `--help` 外没有其他选项。

### `sf serve start`

Start an inference service

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf serve start <MODEL> [options]
```

| 参数      | 说明                                                                      |
| ------- | ----------------------------------------------------------------------- |
| `MODEL` | An HF id / an absolute path on shared storage / run:\<run\_id> (**必填**) |

| 选项                      | 说明                                                 |
| ----------------------- | -------------------------------------------------- |
| `--gpus`, `-g` `<int>`  | How many cards (the tensor-parallel size) (默认 `1`) |
| `--ttl-hours` `<float>` | Idle TTL in hours (default: the server setting)    |

### `sf serve stop`

Stop an inference service

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf serve stop <RUN_ID>
```

| 参数       | 说明     |
| -------- | ------ |
| `RUN_ID` | **必填** |

除 `--help` 外没有其他选项。
