# 机器与集群

Source: https://bflops.com/docs/api/machines

以你自己的价格，列出现在可以租用的 GPU 机器和集群。



## 列出机器 [#list-machines]

<Endpoint method="GET" path="/api/v1/machines" />

现在空闲的机器，按每 GPU 小时价格从低到高排列。所有筛选条件都是可选的，放在查询参数中。

| 参数          | 筛选内容                                                   | 示例                    |
| ----------- | ------------------------------------------------------ | --------------------- |
| `model`     | GPU 型号，与列表一致                                           | `RTX 4090`、`H100 SXM` |
| `gpus`      | 一次租用的 GPU 数量：1、2、4 或 8                                 | `8`                   |
| `kind`      | `on_demand`（默认）或 `interruptible`                       | `interruptible`       |
| `min`、`max` | 每 GPU 小时价格，美元                                          | `max=1.5`             |
| `mem`       | 每块 GPU 显存至少多少 GB                                       | `80`                  |
| `rel`       | 可靠性至少多少，百分比                                            | `95`                  |
| `net`       | 下行网络至少多少 Gbps                                          | `1`                   |
| `country`   | 两个字母的国家代码                                              | `DE`                  |
| `q`         | GPU、城市或国家中包含的词                                         | `frankfurt`           |
| `sort`      | `price`、`value`（每 GB）、`vram`、`network` 或 `reliability` | `vram`                |
| `limit`     | 数量，1 到 200；默认 50                                       | `10`                  |

无法解析的值会被忽略，不会报错。

```bash
curl "https://bflops.com/api/v1/machines?gpus=8&mem=80&limit=2" \
  -H "Authorization: Bearer $BFLOPS_KEY"
```

```json title="200"
{
  "data": [
    {
      "id": "s4821",
      "gpu_model": "H100 SXM",
      "vram_gb": 80,
      "gpus_total": 8,
      "gpus_free": 8,
      "gpu_counts": [8],
      "kind": "on_demand",
      "country": "US",
      "per_gpu_hour_usd": "2.19",
      "specs": {
        "cpu_cores": 104,
        "ram_gb": 1000,
        "disk_gb": 2000,
        "down_mbps": 8000,
        "up_mbps": 8000,
        "reliability": 99.4,
        "cuda": "12.8",
        "nvlink": true,
        "city": "Dallas"
      }
    }
  ],
  "total": 14,
  "models": [
    {
      "gpu_model": "H100 SXM",
      "vram_gb": 80,
      "from_per_gpu_hour_usd": "2.19",
      "gpus_free": 112,
      "machines": 14
    }
  ],
  "countries": ["DE", "US"]
}
```

* `gpu_counts` 列出一次租用可以使用的 GPU 数量。很多机器只能整台租用。
* `total` 是所有匹配项的数量；`data` 最多包含 `limit` 项。
* 机器没有报告的配置为 `null`。

## 一台机器 [#one-machine]

<Endpoint method="GET" path="/api/v1/machines/{id}" />

返回 `{ "machine": { ... } }`，格式同上；机器被租走或下线后返回 `404` `not_found`。

## 列出集群 [#list-clusters]

<Endpoint method="GET" path="/api/v1/clusters" />

```json title="200"
{
  "data": [
    {
      "id": "c207",
      "gpu_model": "H100 SXM",
      "vram_gb": 80,
      "nodes": 2,
      "gpus_per_node": 8,
      "gpus": 16,
      "interconnect": "infiniband",
      "link_rate": "400 Gb/s",
      "country": "US",
      "per_gpu_hour_usd": "2.39",
      "per_hour_usd": "38.24",
      "specs": {
        "cpu_cores": 104,
        "ram_gb": 1000,
        "disk_gb": 2000,
        "down_mbps": 8000,
        "up_mbps": 8000,
        "reliability": 99.1,
        "cuda": "12.8",
        "nvlink": true,
        "city": "Dallas"
      }
    }
  ]
}
```

`specs` 是每个节点的配置。你首次充值 7 天后，并且花费满 $50，集群才会对账户开放。参见[租用集群](/docs/clusters)。

## 一个集群 [#one-cluster]

<Endpoint method="GET" path="/api/v1/clusters/{id}" />

返回 `{ "cluster": { ... } }`，或 `404` `not_found`。

## 下一步 [#next]

[获取报价](/docs/api/quotes)
