> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/clore.ai/clore.ai-eng-zh/mian-xiang-zhu-ji/api.md).

# API

> 💡 **Python 开发者：** 使用官方 [clore-ai Python SDK](/clore.ai/clore.ai-eng-zh/kai-fa-zhe/python-sdk.md) ，而不是直接调用原始 API。它会自动处理身份验证、速率限制、重试和错误处理。
>
> **快速开始：** `pip install clore-ai` — 请参见 [Python SDK 文档](/clore.ai/clore.ai-eng-zh/kai-fa-zhe/python-sdk.md) 并且 [CLI 参考](/clore.ai/clore.ai-eng-zh/kai-fa-zhe/cli-guide.md).

> 🧭 更喜欢可浏览的参考？请在以下地址打开交互式 API 文档： [clore.ai/api-docs](https://clore.ai/api-docs)。本页所有端点的基础 URL： `https://api.clore.ai/v1/`.

<div data-full-width="true"><figure><img src="https://1308073318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbyNlC5NV8aIpXnc76G7w%2Fuploads%2FoEhopGeayaKnbuDjgTEs%2FCLORE%20Docs%20API%20Page.png?alt=media&amp;token=a0adf6bb-1fde-4f1b-8236-dff2563ffbfd" alt=""><figcaption></figcaption></figure></div>

### 简介 <a href="#introduction" id="introduction"></a>

[CLORE.AI](http://clore.ai/) API 可用于自动化将你的工作负载部署到 [CLORE.AI](http://clore.ai/)

首先你需要获取一个 API 密钥\
![alt text](https://clore.ai/assets/html/api-export1.png)\
![alt text](https://clore.ai/assets/html/api-export2.png)

***

### API 响应 <a href="#api-responses" id="api-responses"></a>

响应以 JSON 格式返回，可能包含不同的字段

始终返回的字段是 code，用于表示状态

**code 字段**

| code | 描述              |
| ---- | --------------- |
| `0`  | 正常              |
| `1`  | 数据库错误           |
| `2`  | 无效输入数据          |
| `3`  | 无效 API 令牌       |
| `4`  | 无效端点            |
| `5`  | 已超过每秒 1 次请求限制   |
| `6`  | 错误详见 `error` 字段 |

***

### 端点 <a href="#endpoints" id="endpoints"></a>

#### 1. `wallets` <a href="#id-1-wallets" id="id-1-wallets"></a>

**关于**

返回钱包和余额

**请求头**

| 字段     | 类型    | 必填 | 描述     |
| ------ | ----- | -- | ------ |
| `auth` | `字符串` | 是  | API 令牌 |

**输出**

| 字段        | 类型      | 描述   |
| --------- | ------- | ---- |
| `code`    | `整数`    | 状态码  |
| `wallets` | `字符串数组` | 钱包数组 |

**示例**

**输入：**

```
curl -XGET -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' 'https://api.clore.ai/v1/wallets'
```

**输出：**

```
{
  "wallets": [
    {
      "name": "bitcoin",
      "deposit": "tb1q6erw7v02t7hakgmlcl4wfnlykzqj05alndruwr",
      "balance": 0.00153176,
      "withdrawal_fee": 0.0001
    }
  ],
  "code": 0
}
```

#### 2. `my_servers` <a href="#id-2-my_servers" id="id-2-my_servers"></a>

**关于**

返回你正在向市场提供的服务器 [clore.ai](http://clore.ai/) 市场

**请求头**

| 字段     | 类型    | 必填 | 描述     |
| ------ | ----- | -- | ------ |
| `auth` | `字符串` | 是  | API 令牌 |

**输出**

| 字段                                    | 类型      | 描述                                            |
| ------------------------------------- | ------- | --------------------------------------------- |
| `code`                                | `整数`    | 状态码                                           |
| `limit`                               | `整数`    | 你最多可拥有的服务器数量                                  |
| `服务器`                                 | `字符串数组` | 服务器数组                                         |
| `servers[x].name`                     | `字符串`   | 用户选择的服务器名称                                    |
| `servers[x].connected`                | `字符串`   | 服务器是否曾连接到 [clore.ai](http://clore.ai/)        |
| `servers[x].visibility`               | `字符串`   | 在市场中的可见性                                      |
| `servers[x].pricing`                  | `字符串数组` | 按需每日价格                                        |
| `servers[x].online`                   | `布尔值`   | 服务器是否在线                                       |
| `servers[x].min_spot_pricing`         | `字符串数组` | 用于现货市场出租的最低每日价格                               |
| `servers[x].init_token`               | `字符串`   | 机器注册令牌，仅在机器初始化之前返回—— **请将其视为凭据**，它会将机器注册到你的账户 |
| `servers[x].specs`                    | `字符串数组` | 服务器规格                                         |
| `servers[x].remaining_time`           | `整数`    | 最新活跃订单的租赁结束时间（毫秒级 Unix 时间戳）                   |
| `servers[x].rental_state`             | `字符串`   | GPU 租赁汇总状态： `无`, `部分`，或 `全部`                  |
| `servers[x].rented_gpus`              | `整数`    | 当前在活跃订单中已租用的 GPU                              |
| `servers[x].total_gpus`               | `整数`    | 服务器上的 GPU 总数                                  |
| `servers[x].rented_price_by_currency` | `对象`    | 以货币为键的活跃订单价格总和                                |
| `servers[x].update_channel`           | `字符串`   | 托管代理更新通道： `稳定版` 或 `测试版`                       |
| `servers[x].requested_channel`        | `字符串`   | 从网页界面请求的通道切换（仅在请求时出现）                         |
| `servers[x].target_backend_version`   | `整数`    | 当前通道目标的后端版本                                   |

> 租赁状态字段（`remaining_time`, `rental_state`, `rented_gpus`, `total_gpus`, `rented_price_by_currency`）仅在服务器存在活跃订单时才会出现。

**示例**

**输入：**

```
curl -XGET -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' 'https://api.clore.ai/v1/my_servers'
```

**输出：**

```
{
  "servers": [
    {
      "name": "Michael",
      "connected": false,
      "visibility": "hidden",
      "pricing": { "bitcoin": 0, "usd": 0 },
      "online": false,
      "min_spot_pricing": { "bitcoin": 0, "usd": 0 },
      "init_token": "qnwVIMsZPjUWS7jw6gAbTOeoGQNgTH9XVxJaiCEbG0OlmfjF"
    },
    {
      "name": "Jan Vykydal",
      "connected": true,
      "visibility": "public",
      "pricing": { "bitcoin": 0.00010337, "usd": 0 },
      "online": false,
      "min_spot_pricing": { "bitcoin": 0.00005168, "usd": 0 },
      "specs": {
        "mb": "Z590 GAMING X",
        "cpu": "Intel Core i9-11900",
        "cpus": "8/16",
        "ram": 64,
        "disk": "NVMe 512GB",
        "disk_speed": 2000,
        "gpu": "1x GeForce GTX 1080 Ti",
        "gpuram": 11,
        "net": {
          "down":119.61,
          "up":25.24
        }
      }
    }
  ],
  "limit": 16,
  "code": 0
}
```

定价中的 USD 值 `定价` 对象反映的是主机启用的基于 USD 的定价模式。

#### 3. `server_config` <a href="#id-3-server_config" id="id-3-server_config"></a>

**关于**

获取特定服务器的配置

**请求头**

| 字段             | 类型    | 必填 | 描述                     |
| -------------- | ----- | -- | ---------------------- |
| `auth`         | `字符串` | 是  | API 令牌                 |
| `Content-type` | `字符串` | 是  | 必须是 `application/json` |

**请求体**

| 字段            | 类型    | 必填 | 描述    |
| ------------- | ----- | -- | ----- |
| `server_name` | `字符串` | 是  | 服务器名称 |

**输出**

| 字段                      | 类型            | 描述                                                                           |
| ----------------------- | ------------- | ---------------------------------------------------------------------------- |
| `code`                  | `整数`          | 状态码                                                                          |
| `creation_completed`    | `布尔值`         | 服务器创建是否完成                                                                    |
| `config`                | `字符串数组`       | 服务器配置                                                                        |
| `config.name`           | `字符串`         | 用户选择的服务器名称                                                                   |
| `config.connected`      | `布尔值`         | 服务器是否曾连接到 [clore.ai](http://clore.ai/)                                       |
| `config.visibility`     | `字符串`         | 在市场中的可见性                                                                     |
| `config.pricing`        | `字符串数组`       | 按需每日价格                                                                       |
| `config.spot_pricing`   | `字符串数组`       | 用于现货市场出租的最低每日价格                                                              |
| `config.mrl`            | `整数`          | 最大租赁时长（小时）                                                                   |
| `config.online`         | `布尔值`         | 服务器是否在线                                                                      |
| `config.initialized`    | `布尔值`         | 服务器是否曾连接到 [clore.ai](http://clore.ai/)                                       |
| `config.id`             | `整数`          | 服务器唯一 ID                                                                     |
| `config.rental_status`  | `整数`          | 0 - 未租用 \| 1 - 在现货市场出租 \| 2 - 按需出租 \| 3 - 固定 USD 租赁                          |
| `config.specs`          | `字符串数组`       | 服务器规格                                                                        |
| `config.background_job` | `对象`          | 未租用时的后台任务： `image`, `command`, `env`, `times_updated`                        |
| `config.autoprice`      | `对象` \| `字符串` | 按货币的自动定价配置（旧版字符串值 `"pow"` / `"usd"` 也可能出现）                                   |
| `config.usd_pricing`    | `对象`          | USD 价格目标——仅在启用 USD 自动定价时出现                                                   |
| `config.tenants`        | `对象数组`        | 服务器上的活跃订单： `rental_type`, `currency`, `price`, `remaining_time`, `gpu_count` |

> `server_config` 还返回与 `my_servers`: `remaining_time`, `rental_state`, `rented_gpus`, `total_gpus`, `rented_price_by_currency`, `update_channel`, `requested_channel`, `target_backend_version`相同的租赁状态和更新通道字段。在这两个端点中，租赁状态字段仅在服务器存在活跃订单时才会出现。

**示例**

**输入：**

```
curl -XGET -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "server_name":"Jan Vykydal"
}' 'https://api.clore.ai/v1/server_config'
```

**输出：**

```
{
  "config": {
    "name": "Jan Vykydal",
    "connected": true,
    "visibility": "public",
    "pricing": { "bitcoin": 0.00010337, "usd": 0 },
    "spot_pricing": { "bitcoin": 0.00005168, "usd": 0 },
    "mrl": 72,
    "online": false,
    "initialized": true,
    "id": 4,
    "rental_status": 0,
    "specs": {
      "mb": "Z590 GAMING X",
      "cpu": "Intel Core i9-11900",
      "cpus": "8/16",
      "ram": 64,
      "disk": "NVMe 512GB",
      "disk_speed": 2000,
      "gpu": "1x GeForce GTX 1080 Ti",
      "gpuram": 11,
      "net": {
        "down":119.61,
        "up":25.24
      }
    },
    "background_job": {
      "times_updated": 1,
      "image": "cloreai/ubuntu20.04-jupyter",
      "command": "",
      "env": []
    }
  },
  "creation_completed": true,
  "code": 0
}
```

定价中的 USD 值 `定价` 对象反映的是主机启用的基于 USD 的定价模式。

#### 4. `市场` <a href="#id-4-marketplace" id="id-4-marketplace"></a>

**关于**

获取市场

**请求头**

| 字段     | 类型    | 必填 | 描述     |
| ------ | ----- | -- | ------ |
| `auth` | `字符串` | 是  | API 令牌 |

**输出**

| 字段                              | 类型            | 描述                                                                         |
| ------------------------------- | ------------- | -------------------------------------------------------------------------- |
| `code`                          | `整数`          | 状态码                                                                        |
| `my_servers`                    | `字符串数组`       | 你正在向其提供的服务器 ID 数组 [clore.ai](http://clore.ai/) （不可租赁）                      |
| `服务器`                           | `字符串数组`       | 市场上的公开服务器数组                                                                |
| `servers[x].id`                 | `整数`          | 服务器唯一 ID                                                                   |
| `servers[x].owner`              | `整数`          | 所有者唯一 ID                                                                   |
| `servers[x].mrl`                | `整数`          | 最大租赁时长（小时）                                                                 |
| `servers[x].price.on_demand`    | `字符串数组`       | 按需每日价格                                                                     |
| `servers[x].price.spot`         | `字符串数组`       | 现货市场最低每日价格                                                                 |
| `servers[x].rented`             | `布尔值`         | 服务器是否按需出租                                                                  |
| `servers[x].specs`              | `字符串数组`       | 服务器规格                                                                      |
| `servers[x].partial_gpu_rental` | `对象` \| `布尔值` | `false` 当不支持部分租赁时为 false，否则 `{ total_gpus, available_gpus, free_indices }` |

> `price.on_demand` 并且 `price.spot` 仅包含各服务器实际接受的货币——如果某服务器没有某货币的价格，就无法使用该货币租赁它。

**示例**

获取市场

**输入：**

```
curl -XGET -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' 'https://api.clore.ai/v1/marketplace'
```

**输出：**

```
{
  "servers": [
    {
      "id": 6,
      "owner": 4,
      "mrl": 73,
      "price": { "on_demand": { "bitcoin": 0.00001 },
      "spot": { "bitcoin": 0.000001 }},
      "rented": false,
      "specs": {
        "mb": "Z590 GAMING X",
        "cpu": "11th Gen Intel(R) Core(TM) i9-11900 @ 2.50GHz",
        "cpus": "8/16",
        "ram": 62.67348861694336,
        "disk": "NVMe disk 247.3623046875GB",
        "disk_speed": 0,
        "gpu": "1x NVIDIA GeForce GTX 1080 Ti",
        "gpuram": 11,
        "net": {
          "up": 26.38,
          "down": 118.42,
          "cc": "CZ"
        }
      }
    }
  ],
  "my_servers": [1, 2, 4],
  "code": 0
}
```

#### 5. `my_orders` <a href="#id-5-my_orders" id="id-5-my_orders"></a>

**关于**

获取你的订单

**请求头**

| 字段     | 类型    | 必填 | 描述     |
| ------ | ----- | -- | ------ |
| `auth` | `字符串` | 是  | API 令牌 |

**查询字符串**

| 字段                 | 类型    | 必填 | 描述            |
| ------------------ | ----- | -- | ------------- |
| `return_completed` | `布尔值` | 否  | 返回已完成（已过期）的订单 |

**输出**

| 字段                       | 类型      | 描述                                               |
| ------------------------ | ------- | ------------------------------------------------ |
| `code`                   | `整数`    | 状态码                                              |
| `limit`                  | `整数`    | 活跃订单最大数量                                         |
| `订单`                     | `字符串数组` | 订单数组                                             |
| `orders[x].id`           | `整数`    | 订单唯一 ID                                          |
| `orders[x].fee`          | `浮点数`   | 支付给……的费用（%） [clore.ai](http://clore.ai/)         |
| `orders[x].creation_fee` | `浮点数`   | 支付给……的创建费 [clore.ai](http://clore.ai/)           |
| `orders[x].price`        | `浮点数`   | 订单每日价格（成本）                                       |
| `orders[x].mrl`          | `整数`    | 订单最长租赁时长（秒）                                      |
| `orders[x].image`        | `字符串`   | 使用的 Docker 镜像                                    |
| `orders[x].currency`     | `字符串`   | 用于计费的货币                                          |
| `orders[x].spend`        | `浮点数`   | 实际已扣金额：累计租赁价值加上租客基础费用（扣除 PoH 后）及任何额外费用；不包含一次性创建费 |
| `orders[x].gpu_count`    | `整数`    | 订单占用的 GPU 数量（按需订单；除非是部分租赁，否则等于该机器的总 GPU 数）       |
| `orders[x].ct`           | `整数`    | 创建时间（UNIX 时间）                                    |
| `orders[x].p`            | `整数`    | 当前使用的代理集群                                        |
| `orders[x].specs`        | `字符串数组` | 服务器规格                                            |
| `orders[x].si`           | `整数`    | 服务器唯一 ID                                         |
| `orders[x].pub_cluster`  | `字符串数组` | 带转发端口的公开端点                                       |
| `orders[x].tcp_ports`    | `字符串数组` | TCP 端口转发                                         |
| `orders[x].http_port`    | `字符串`   | 通过 HTTPS 代理转发的容器端口                               |
| `orders[x].spot`         | `布尔值`   | 表明这是现货订单                                         |
| `orders[x].expired`      | `布尔值`   | 表明订单已过期                                          |

**输入：**

```
curl -XGET -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' 'https://api.clore.ai/v1/my_orders?return_completed=true'
```

**输出：**

```
{
  "orders": [
    {
      "id": 38,
      "fee": 5,
      "creation_fee": 3e-7,
      "price": 0.00001,
      "mrl": 262800,
      "image": "cloreai/ubuntu20.04-jupyter",
      "currency": "bitcoin",
      "spend": 6.944444444444445e-9,
      "ct": 1667401396,
      "p": 1,
      "specs": {
        "mb": "Z590 GAMING X",
        "cpu": "11th Gen Intel(R) Core(TM) i9-11900 @ 2.50GHz",
        "cpus": "8/16",
        "ram": 62.67348861694336,
        "disk": "NVMe disk 247.3623046875GB",
        "disk_speed": 2000,
        "gpu": "1x NVIDIA GeForce GTX 1080 Ti",
        "gpuram": 11,
        "net": {
          "up": 26.38,
          "down": 118.42,
        }
      },
      "si": 6,
      "pub_cluster": [ "n1.c1.clorecloud.net", "n2.c1.clorecloud.net" ],
      "tcp_ports": [ "22:10000" ],
      "http_port": "8888"
    },{
      "id": 36,
      "fee": 2.5,
      "creation_fee": 1e-7,
      "price": 0.00001,
      "mrl": 262800,
      "image": "cloreai/ubuntu20.04-jupyter",
      "currency": "bitcoin",
      "spend": 1.3888888888888888e-7,
      "ct": 1667248597,
      "specs": {
        "mb": "Z590 GAMING X",
        "cpu": "11th Gen Intel(R) Core(TM) i9-11900 @ 2.50GHz",
        "cpus": "8/16",
        "ram": 62.67348861694336,
        "disk": "NVMe disk 247.3623046875GB",
        "disk_speed": 2000,
        "gpu": "1x NVIDIA GeForce GTX 1080 Ti",
        "gpuram": 11,
        "net": {
          "up": 26.38,
          "down": 118.42,
        }
      },
      "si": 6,
      "spot": true,
      "expired": true,
      "tcp_ports": []
    }
  ],
  "limit": 13,
  "code": 0
}
```

#### 6. `spot_marketplace` <a href="#id-6-spot_marketplace" id="id-6-spot_marketplace"></a>

**关于**

获取特定服务器的现货市场

**请求头**

| 字段     | 类型    | 必填 | 描述     |
| ------ | ----- | -- | ------ |
| `auth` | `字符串` | 是  | API 令牌 |

**查询字符串**

| 字段   | 类型   | 必填 | 描述       |
| ---- | ---- | -- | -------- |
| `市场` | `整数` | 是  | 服务器唯一 ID |

**输出**

| 字段                             | 类型    | 描述                |
| ------------------------------ | ----- | ----------------- |
| `code`                         | `整数`  | 状态码               |
| `存在`                           | `布尔值` | 验证市场是否存在          |
| `市场`                           | `对象`  | 市场                |
| `market.offers`                | `数组`  | 该服务器的租赁报价         |
| `market.offers[x].offer_id`    | `整数`  | 唯一报价 ID           |
| `market.offers[x].bid`         | `浮点数` | 按天报价价格（以报价所用货币计）  |
| `market.offers[x].currency`    | `字符串` | 报价所用货币            |
| `market.offers[x].active`      | `布尔值` | 此报价当前正在使用         |
| `market.offers[x].my`          | `布尔值` | 此报价归我所有           |
| `market.server`                | `对象`  | 服务器信息             |
| `market.server.min_pricing`    | `对象`  | 按每种可接受货币计算的最低日报价  |
| `market.server.mrl`            | `整数`  | 最大租赁时长，单位为 **小时** |
| `market.server.visibility`     | `字符串` | 只有在可见性为公开时才能创建报价  |
| `market.server.online`         | `布尔值` | 服务器在线             |
| `market.currency_rates_in_usd` | `对象`  | 用于跨货币比较报价的实时美元汇率  |

> 报价可以使用服务器接受的任何货币；竞争报价会按其 **美元价值** （使用 `currency_rates_in_usd`），而不是面值。
>
> ⚠️ **2026年8月已更改：** `market.server.mrl` 现在以 **小时** （之前是秒）。一个值为 `262800` 现在显示为 `73`.

**输入：**

```
curl -XGET -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' 'https://api.clore.ai/v1/spot_marketplace?market=6'
```

**输出：**

```
{
  "market": {
    "offers": [
      {
        "offer_id": 39,
        "bid": 0.0000042,
        "active": true,
        "my": true,
        "currency": "bitcoin"
      }
    ],
    "server": {
      "min_pricing": {
        "bitcoin": 0.000001
      },
      "mrl": 73,
      "visibility": "public",
      "online": true
    },
    "currency_rates_in_usd": {
      "bitcoin": 110000,
      "CLORE-Blockchain": 0.0045,
      "USD-Blockchain": 1
    }
  },
  "exists": true,
  "code": 0
}
```

#### 7. `set_server_settings` <a href="#id-7-set_server_settings" id="id-7-set_server_settings"></a>

**关于**

配置你所提供服务器的设置 [clore.ai](http://clore.ai/) 市场

**请求头**

| 字段             | 类型    | 必填 | 描述                     |
| -------------- | ----- | -- | ---------------------- |
| `auth`         | `字符串` | 是  | API 令牌                 |
| `Content-type` | `字符串` | 是  | 必须是 `application/json` |

**请求体**

| 字段                           | 类型    | 必填  | 描述                                                                                                |
| ---------------------------- | ----- | --- | ------------------------------------------------------------------------------------------------- |
| `名称`                         | `字符串` | 是   | 用户选择的服务器名称                                                                                        |
| `可用性`                        | `布尔值` | 是   | 服务器是否可被租用                                                                                         |
| `mrl`                        | `整数`  | 是   | 服务器最大租赁时长，单位为 **小时** （6 到 3000）                                                                   |
| `bitcoin_on_demand`          | `浮点数` | 是   | 按天计的 BTC 即时价格                                                                                     |
| `bitcoin_spot`               | `浮点数` | 是   | 按天计的 BTC 现货最低价格                                                                                   |
| `CLORE-Blockchain_on_demand` | `浮点数` | 否   | 按天计的 CLORE 即时价格                                                                                   |
| `CLORE-Blockchain_spot`      | `浮点数` | 否   | 按天计的 CLORE 现货最低价格                                                                                 |
| `USD-Blockchain_on_demand`   | `浮点数` | 否   | 按天计的 USD 即时价格                                                                                     |
| `USD-Blockchain_spot`        | `浮点数` | 否   | 按天计的 USD 现货最低价格                                                                                   |
| `enabled-bitcoin`            | `布尔值` | 否\* | 该服务器接受比特币                                                                                         |
| `enabled-CLORE-Blockchain`   | `布尔值` | 否\* | 该服务器接受 CLORE                                                                                      |
| `enabled-USD-Blockchain`     | `布尔值` | 否\* | 该服务器接受 USD 稳定币                                                                                    |
| `autoprice`                  | `对象`  | 否   | 按货币自动定价：设置一个货币键（`bitcoin`, `CLORE-Blockchain`）为 `"usd"` 用于基于 USD 的自动定价，或 `false` 用于固定定价           |
| `usd_pricing`                | `对象`  | 否   | 每种货币的 USD 价格目标，例如 `{ "bitcoin": { "on_demand": 10, "spot": 5 } }` — 仅用于具有 `autoprice` 设置为 `"usd"` |

> \* **可接受货币列表会根据 `enabled-*` 标志在每次调用时重新构建。** 没有其 `enabled-<currency>: true` 标志（或没有有效价格）的货币会从服务器可接受货币中移除——省略所有标志会使服务器在任何货币下都无法出租。始终为 `enabled-<currency>: true` 你希望继续接受的每种货币发送。
>
> 每种货币的日价格有上限：0.000001–0.015 BTC，0.1–600,000 CLORE，0.1–1,000 USD。
>
> 当某种货币以 USD 自动定价时，其显示的加密货币价格会根据 `usd_pricing` 按实时汇率（约每 10 分钟重新计算一次）以及任何 `<currency>_on_demand` / `<currency>_spot` 发送给它的值会被忽略。 `usd_pricing` 目标是整台服务器的美元/天数值，并按 USD 范围（0.1–1,000）进行验证；超出范围的值会被钳制到最近边界。

**输出**

| 字段     | 类型   | 描述  |
| ------ | ---- | --- |
| `code` | `整数` | 状态码 |

**示例**

让我们为从当前钱包发送的交易创建发送证明。

**输入：**

```
curl -XPOST -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "name": "Jan Vykydal",
    "availability":true,
    "mrl":96,
    "enabled-bitcoin":true,
    "bitcoin_on_demand":0.0001,
    "bitcoin_spot":0.00000113
}' 'https://api.clore.ai/v1/set_server_settings'
```

**输出：**

```
{
  "code": 0
}
```

#### 8. `set_spot_price` <a href="#id-8-set_spot_price" id="id-8-set_spot_price"></a>

**关于**

设置你的现货市场报价的每日价格

**请求头**

| 字段             | 类型    | 必填 | 描述                     |
| -------------- | ----- | -- | ---------------------- |
| `auth`         | `字符串` | 是  | API 令牌                 |
| `Content-type` | `字符串` | 是  | 必须是 `application/json` |

**请求体**

| 字段              | 类型    | 必填 | 描述       |
| --------------- | ----- | -- | -------- |
| `order_id`      | `整数`  | 是  | 唯一报价 ID  |
| `desired_price` | `浮点数` | 是  | 你报价的每日价格 |

> **低于服务器当前现货底价的价格** 会被拒绝，并附带当前最低价：
>
> ```
> { "error": "amount_too_low", "min_price": 0.0000012, "code": 6 }
> ```

**示例**

让我们尝试更新现货市场价格

**输入1（降价幅度过大）：**

```
curl -XPOST -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "order_id":39,
    "desired_price":0.00000200
}' 'https://api.clore.ai/v1/set_spot_price'
```

**可能的输出1（降价幅度过大）：**\
你最多可以将现货市场报价价格下调 0.00000100 ₿

| 字段         | 类型    | 描述                |
| ---------- | ----- | ----------------- |
| `code`     | `整数`  | 状态码               |
| `error`    | `字符串` | 错误描述字段            |
| `max_step` | `浮点数` | 你当前可以将价格下调到的最低可能值 |

```
{
    "error":"exceeded_max_step",
    "max_step":0.0000032,
    "code":6
}
```

**输入2（有效的降价幅度）：**

```
curl -XPOST -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "order_id":39,
    "desired_price":0.00000320
}' 'https://api.clore.ai/v1/set_spot_price'
```

**可能的输出2（有效的降价幅度）：**

```
{
    "code": 0
}
```

**输入3（发送输入2后进一步降价）：**

```
curl -XPOST -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "order_id":39,
    "desired_price":0.00000220
}' 'https://api.clore.ai/v1/set_spot_price
```

**可能的输出3（发送输入2后进一步降价）：**\
你每 600 秒只能下调一次现货价格

| 字段                 | 类型    | 描述               |
| ------------------ | ----- | ---------------- |
| `code`             | `整数`  | 状态码              |
| `error`            | `字符串` | 错误描述字段           |
| `time_to_lowering` | `浮点数` | 距离下次可以降价的剩余时间（秒） |

```
{
    "error":"can_lower_every_600_seconds",
    "time_to_lowering":513,
    "code":6
}
```

#### 9. `cancel_order` <a href="#id-9-cancel_order" id="id-9-cancel_order"></a>

**关于**

取消一个活跃订单或现货报价

**请求头**

| 字段             | 类型    | 必填 | 描述                     |
| -------------- | ----- | -- | ---------------------- |
| `auth`         | `字符串` | 是  | API 令牌                 |
| `Content-type` | `字符串` | 是  | 必须是 `application/json` |

**请求体**

| 字段      | 类型    | 必填 | 描述                                                                |
| ------- | ----- | -- | ----------------------------------------------------------------- |
| `id`    | `整数`  | 是  | 唯一的订单/报价 ID                                                       |
| `issue` | `字符串` | 否  | 如果你遇到服务器的任何问题，可以将其报告给 [clore.ai](http://clore.ai/) 团队，最多 2048 个字符 |

**输出**

| 字段     | 类型   | 描述  |
| ------ | ---- | --- |
| `code` | `整数` | 状态码 |

**示例**

取消订单/报价

**输入：**\
在此示例中，我们正在报告 GPU #1 的问题；如果你没有问题，请不要包含 issue 字段。\n你可以在文本字段中写任何消息，我们会进行调查

```
curl -XPOST -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "id":39,
    "issue":"GPU #1 过热并发生降频"
}' 'https://api.clore.ai/v1/cancel_order'
```

**输出：**

```
{
  "code": 0
}
```

#### 10. `create_order` <a href="#id-10-create_order" id="id-10-create_order"></a>

**关于**

你可以使用此端点创建现货报价或按需订单

**请求头**

| 字段             | 类型    | 必填 | 描述                     |
| -------------- | ----- | -- | ---------------------- |
| `auth`         | `字符串` | 是  | API 令牌                 |
| `Content-type` | `字符串` | 是  | 必须是 `application/json` |

**请求体**

| 字段                   | 类型      | 必填  | 描述                                                                                                                         |
| -------------------- | ------- | --- | -------------------------------------------------------------------------------------------------------------------------- |
| `currency`           | `字符串`   | 是   | 货币名称                                                                                                                       |
| `image`              | `字符串`   | 是   | 来自 Docker Hub 的有效镜像                                                                                                        |
| `renting_server`     | `整数`    | 是   | 你想租用的服务器 ID                                                                                                                |
| `类型`                 | `字符串`   | 是   | `on-demand` 或 `spot`                                                                                                       |
| `spotprice`          | `浮点数`   | 取决于 | 在现货市场上的每日报价价格，创建现货订单时必填                                                                                                    |
| `端口`                 | `对象`    | 否   | 端口转发配置，最多 5 条记录                                                                                                            |
| `env`                | `对象`    | 否   | <p>环境变量，字符串化后总长度限制为 12288 个字符。\n变量名 - 最多 128 个字符，不能包含 <code>-</code><br>变量值 - 最多 1536 个字符\n仅保留前 30 个有效变量；其余会被静默丢弃</p>      |
| `jupyter_token`      | `字符串`   | 否   | 用于包含 Jupyter 笔记本的镜像的 Jupyter 令牌，最多 32 个字符 \*                                                                               |
| `ssh_key`            | `字符串`   | 否   | 用于带有 SSH 的镜像的 SSH 密钥，最多 3072 个字符 \*                                                                                        |
| `ssh_password`       | `字符串`   | 否   | 用于带有 SSH 的镜像的 SSH 密码，最多 32 个字符 \*                                                                                          |
| `command`            | `字符串`   | 否   | 订单创建后，命令将在服务器上运行                                                                                                           |
| `required_price`     | `浮点数`   | 否   | 指定你希望以何种价格启动订单；如果机器所有者更改价格，则订单不会启动（仅限按需）                                                                                   |
| `gpu_count`          | `整数`    | 否   | 在支持以下功能的服务器上要租用的 GPU 数量 [部分租用](/clore.ai/clore.ai-eng-zh/mian-xiang-zu-yong-zhe/partial-gpu-rental.md)。省略则租用整机。仅限按需，仅限同构整机 |
| `gpu_indices`        | `[]int` | 否   | 要租用的 GPU 插槽索引（从 0 开始）；长度必须等于 `gpu_count`。从以下位置获取空闲插槽 `partial_gpu_rental.free_indices`。省略则让后端自动选择空闲 GPU                    |
| `autossh_entrypoint` | `布尔值`   | 否   | 使用 clore.ai 入口点，它会自动部署 SSH 服务器和自定义 `/root/onstart.sh` 脚本                                                                   |

\* 对于标有星号的字段，你只能输入此正则表达式组中的字符 `/^[a-zA-Z0-9\s-=.@+/]+$/`

**输出**

| 字段     | 类型   | 描述  |
| ------ | ---- | --- |
| `code` | `整数` | 状态码 |

> **低于服务器底价的现货报价** 会被拒绝，并附带当前最低价，因此你可以立即重试：
>
> ```
> { "error": "too_low_price", "min_price": 0.0000012, "code": 6 }
> ```
>
> 底价大约每 10 分钟会根据实时币价重新计算一次，因此从市场列表读到的价格可能略有过时——请始终使用返回的 `min_price` 作为重试依据。

**示例**

**输入1（创建现货报价）：**

```
curl -XPOST -H 'auth: 6FcuR7ibcwKR1Z32lEFoSotzUUtzKO2H' -H "Content-type: application/json" -d '
{
    "currency":"bitcoin",
    "image":"cloreai/ubuntu20.04-jupyter",
    "renting_server":6,
    "type":"spot",
    "spotprice":0.000001,
    "ports":{
        "22":"tcp",
        "8888":"http"
    },
    "env":{
        "VARIABLE_NAME":"VARIABLE_VALUE",
    },
    "jupyter_token":"hoZluOjbCOQ5D5yH7R",
    "ssh_password":"Hpcj08ZaOpCbTmn1Eu",
    "command":"#!/bin/sh\napt update -y && apt install htop"
}' 'https://api.clore.ai/v1/create_order'
```

**输出1（创建现货报价）：**

```
{
  "code":0
}
```

**输入2（创建按需订单）：**

```
curl -XPOST -H 'auth: 6FcuR7ibcwKR1Z32lEFoSotzUUtzKO2H' -H "Content-type: application/json" -d '
{
    "currency":"bitcoin",
    "image":"cloreai/ubuntu20.04-jupyter",
    "renting_server":6,
    "type":"on-demand",
    "ports":{
        "22":"tcp",
        "8888":"http"
    },
    "env":{
        "VARIABLE_NAME":"VARIABLE_VALUE",
    },
    "jupyter_token":"hoZluOjbCOQ5D5yH7R",
    "ssh_password":"Hpcj08ZaOpCbTmn1Eu",
    "command":"#!/bin/sh\napt update -y && apt install htop"
}' 'https://api.clore.ai/v1/create_order'
```

**输出2（创建按需订单）：**

```
{
  "code":0
}
```

#### 11. `renter_fees` <a href="#id-11-renter_fees" id="id-11-renter_fees"></a>

**关于**

获取当前费用配置：基础租用者费用、PoH 费用减免设置、订单创建费用以及你的 PoH 余额

**请求头**

| 字段     | 类型    | 必填 | 描述     |
| ------ | ----- | -- | ------ |
| `auth` | `字符串` | 是  | API 令牌 |

**输出**

| 字段                                 | 类型    | 描述                     |
| ---------------------------------- | ----- | ---------------------- |
| `code`                             | `整数`  | 状态码                    |
| `renter_fees.on_demand`            | `对象`  | 按货币划分的按需订单基础费用（%）      |
| `renter_fees.spot`                 | `对象`  | 按货币划分的现货订单基础费用（%）      |
| `poh_config.max_reduction_percent` | `整数`  | 通过 PoH 可获得的最高基础费用减免（%） |
| `poh_config.max_poh_amount`        | `整数`  | 达到最高减免时所需的 PoH 余额      |
| `creation_fees.on_demand`          | `对象`  | 按货币划分的订单创建费用           |
| `creation_fees.spot`               | `对象`  | 按货币划分的现货订单创建费用         |
| `poh_balance`                      | `浮点数` | 你的 PoH CLORE 余额        |

**输入：**

```
curl -XGET -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' 'https://api.clore.ai/v1/renter_fees'
```

**输出：**

```
{
  "renter_fees": {
    "on_demand": {
      "base": { "bitcoin": 5, "CLORE-Blockchain": 5, "USD-Blockchain": 5 }
    },
    "spot": {
      "base": { "bitcoin": 1.25, "CLORE-Blockchain": 1.25, "USD-Blockchain": 1.25 }
    }
  },
  "poh_config": { "max_reduction_percent": 50, "max_poh_amount": 2000000 },
  "creation_fees": {
    "on_demand": { "bitcoin": 3e-7, "CLORE-Blockchain": 0.5, "USD-Blockchain": 0.1 },
    "spot": { "bitcoin": 1e-7, "CLORE-Blockchain": 0.05, "USD-Blockchain": 0.005 }
  },
  "poh_balance": 5000,
  "code": 0
}
```

#### 12. `cancel_orders` <a href="#id-12-cancel_orders" id="id-12-cancel_orders"></a>

**关于**

一次取消多个订单（每个请求最多 256 个）

**请求头**

| 字段             | 类型    | 必填 | 描述                     |
| -------------- | ----- | -- | ---------------------- |
| `auth`         | `字符串` | 是  | API 令牌                 |
| `Content-type` | `字符串` | 是  | 必须是 `application/json` |

**请求体**

| 字段          | 类型      | 必填 | 描述                 |
| ----------- | ------- | -- | ------------------ |
| `order_ids` | `[]int` | 是  | 要取消的订单 ID，最多 256 个 |

**输出**

| 字段                 | 类型      | 描述         |
| ------------------ | ------- | ---------- |
| `code`             | `整数`    | 状态码        |
| `failed_to_cancel` | `[]int` | 无法取消的订单 ID |

**输入：**

```
curl -XPOST -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "order_ids": [38, 39]
}' 'https://api.clore.ai/v1/cancel_orders'
```

**输出：**

```
{
  "failed_to_cancel": [],
  "code": 0
}
```

#### 13. `poh_balance` <a href="#id-13-poh_balance" id="id-13-poh_balance"></a>

**关于**

获取你的持有证明余额：项目、总额以及 PoH 市场报价金额

**请求头**

| 字段     | 类型    | 必填 | 描述     |
| ------ | ----- | -- | ------ |
| `auth` | `字符串` | 是  | API 令牌 |

**输出**

| 字段                                            | 类型     | 描述              |
| --------------------------------------------- | ------ | --------------- |
| `code`                                        | `整数`   | 状态码             |
| `项目`                                          | `对象数组` | 你的 PoH 项目及其各自余额 |
| `balance.total`                               | `浮点数`  | 所有项目的 PoH 总余额   |
| `balance.free_amount`                         | `浮点数`  | 未投入报价的 PoH 余额   |
| `balance.reward_amount`                       | `浮点数`  | 可获得奖励的余额        |
| `balance.offers.rented_amount`                | `浮点数`  | 出租给其他用户的数量      |
| `balance.offers.rented_on_marketplace_amount` | `浮点数`  | 在 PoH 市场上挂出的数量  |
| `balance.offers.leased_amount`                | `浮点数`  | 从其他用户处租入的数量     |

**输入：**

```
curl -XGET -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' 'https://api.clore.ai/v1/poh_balance'
```

**输出：**

```
{
  "items": [ { "balance": 5000 } ],
  "balance": {
    "total": 5000,
    "free_amount": 4000,
    "reward_amount": 5000,
    "offers": {
      "rented_amount": 0,
      "rented_on_marketplace_amount": 1000,
      "rented_finished_amount": 0,
      "leased_amount": 0
    }
  },
  "code": 0
}
```

#### 14. `server-config.json` <a href="#id-14-server-config-json" id="id-14-server-config-json"></a>

**关于**

获取静态 API 配置数据。无需认证

**输入：**

```
curl -XGET 'https://api.clore.ai/v1/server-config.json'
```

#### 15. `get_relay` <a href="#id-15-get_relay" id="id-15-get_relay"></a>

**关于**

获取您检测到的国家的 TCP 转发中继节点。无需认证

**输出**

| 字段     | 类型    | 描述       |
| ------ | ----- | -------- |
| `code` | `整数`  | 状态码      |
| `国家`   | `字符串` | 检测到的国家代码 |
| `节点`   | `对象`  | 可用的中继节点  |

**输入：**

```
curl -XGET 'https://api.clore.ai/v1/get_relay'
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.clore.ai/clore.ai/clore.ai-eng-zh/mian-xiang-zhu-ji/api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
