POST
/
api
/
open
/
v2
/
instance
/
startup
实例开机
curl --request POST \
  --url https://www.chenyu.cn/api/open/v2/instance/startup \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "instance_uuid": "<string>",
  "gpu_uuid": "<string>",
  "gpu_nums": 123
}'
{
  "code": 123,
  "msg": "<string>"
}

实例开机

启动一个已停止的实例。

请求参数

instance_uuid
string
required
实例uuid
gpu_uuid
string
gpu型号id,默认使用创建时的gpu型号
gpu_nums
integer
gpu数量,支持1/2/4/8,默认使用创建时的gpu数量

响应参数

code
integer
响应码
msg
string
响应信息

代码示例

import requests

url = "https://www.chenyu.cn/api/open/v2/instance/startup"
headers = {
    "Authorization": "Bearer your_api_key",
    "Content-Type": "application/json"
}

data = {
    "instance_uuid": "inst_12345678-1234-1234-1234-123456789012",
    "gpu_uuid": "gpu_12345678-1234-1234-1234-123456789012",
    "gpu_nums": 1
}

response = requests.post(url, headers=headers, json=data)
result = response.json()

if result['code'] == 0:
    print("实例启动成功")
else:
    print(f"启动失败: {result['msg']}")

响应示例

{
  "code": 0,
  "msg": "启动成功"
}