Skip to main content

API Documentation

To facilitate flexible usage of GPU resources, the platform provides instance-related functionality through API calls, currently available only to enterprise users.

API Overview

The platform provides the following APIs externally:

APIDescription
Get Available GPU TypesQuery the current available GPU types on the platform
Get ImagesQuery the images available to the current account, including official and custom images
Create InstanceCreate an instance. According to the platform's recommendation rules, choose the most suitable machine to execute the creation plan.
Query Operation ResultQuery the result of an instance operation
Query InstancesQuery and return instances that are not released
Instance OperationsOpenAPI supports starting, stopping, restarting, releasing, and setting custom ports for instances. More complex operations should be performed via the web console.

How to Call the API

1. Apply for Enterprise Qualification

Currently, APIs are only open to enterprise users. If you have not activated enterprise qualification, please go to the Account Center to submit an enterprise certification application.

2. Create API Key

API calls require an API key. You can create one in "Account Center - OpenAPI Key". After adding, the key will be downloaded locally. It cannot be downloaded again later. Please keep it safe and do not disclose it. open_api_001.png

3. Endpoints

The endpoint is the request address for calling the API. The platform currently provides the following server call address:

Request AddressProtocol Type
https://api-cloud.gpugeek.comHTTPS

4. Authentication

All API interfaces require authentication by including the API key in the header.
The header format is as follows:

{
"gz-api-token":"test123abcxxxxxxxxx"
}

Here gz-api-token is the custom header key of the platform.

5. Response Results

All API responses are returned in JSON format (request/response header: Content-Type: application/json).
The general structure is as follows:

{
"code": 0,
"message": "success",
"traceid": "",
"data": {}
}

Response field descriptions:

FieldDescription
codeResponse code. 0 means success. Other values are error codes. Refer to the appendix for error code details.
message"success" for successful requests. Otherwise, specific business error information.
dataReturned business data

API Details

1. Get Platform GPU Types

Description

  • Request URI: /api/v1/openapi/gpu/list
  • Request Method: GET

Request Parameters
None

Response Parameters

NameTypeDescription
gpusArray<string>Array of GPU types, GPU types are consistent

Response Example

{
"code": 0,
"message": "success",
"traceid": "",
"data": {
"gpus": [
"G40-24G",
"G30-24G",
"A100-PCIE-40G"
]
}
}

2. Get Available Datacenter IDs

Description

  • Request URI: /api/v1/openapi/datacenter/list
  • Request Method: GET

Request Parameters
None

Response Parameters

NameTypeDescription
datacentersArray<Datacenter>Array of datacenters

Datacenter

NameTypeDescription
nameStringDatacenter name
dcIdStringDatacenter ID

Response Example

{
"code": 0,
"message": "success",
"traceid": "57cbd46995d11318814a78746318bc32",
"data": {
"datacenters": [
{
"name": "Suqian-B",
"dcId": "suqian-b"
},
{
"name": "Qingyang-A",
"dcId": "qingyang-a"
},
{
"name": "USA-Dallas-N",
"dcId": "dallas-n"
}
]
}
}

3. Get Images

Description

  • Request URI: /api/v1/openapi/image/list
  • Request Method: GET

Request Parameters
None

Response Parameters
Image Parameter Description

NameTypeDescription
typeStringImage type: user / official. user: backup image, official: official image
imageIdStringImage ID, used for instance creation
nameStringImage name

Response Example

{
"code": 0,
"message": "success",
"traceid": "90223a7f6632b1176c74fa17445cfe0e",
"data": {
"images": [
{
"type": "official",
"name": "torch2.1.1-cuda12.1.0-py3.10",
"imageId": "torch2.1.1-cuda12.1.0-py3.10"
},
{
"type": "user",
"name": "testimage",
"imageId": "123abc"
}
]
}
}

3. Create Instance

Description

  • Request URI: /api/v1/openapi/instance/create
  • Request Method: POST

Request Parameters
Body

NameTypeRequiredDescription
typeIntegerYesType value. Currently only supports type=2
gpuNameStringYesGPU type. Can be queried through the GPU list API or from the official website
skuNameStringYesPayment method. Options: pay-as-you-go (payg), bidding, daily, weekly, monthly
gpuNumIntegerYesNumber of GPUs to rent
cpuNumIntegerNoNumber of CPU cores allocated per GPU
memoryIntegerNoMemory allocated per GPU
diskTypeStringNoDisk type (SSD/NVME)
tagsArray<String>NoQuery machines with specific tags
imageIdStringYesImage ID used to create the instance, can be queried from available images
autoRenewBooleanNoWhether to enable auto-renewal upon expiration. Default true for payg, false for prepaid methods
durationIntegerNoRental duration for prepaid instances. Default = 1
nameStringNoInstance name
servicePortArray<Integer>NoCustom TCP service ports, up to 3 total (TCP+HTTP)
httpServicePortArray<Integer>NoCustom HTTP service ports, up to 3 total (TCP+HTTP)
cmdStringNoStartup command
envStringNoEnvironment variables
dryRunBooleanNoDry run. If true, only perform machine selection and price check
dcIdStringNoDatacenter ID
systemDiskSizeIntegerNoSystem disk size (GB). Default = 30GB
dataDiskSizeIntegerNoData disk size (GB). Default = 20GB

Response Parameters
Data

NameTypeDescription
instanceIdInt64Instance ID. 0 if dryRun=true
operationIdInt64Current operation ID. 0 if dryRun=true
specObject<Spec>Instance specification

Spec

NameTypeDescription
gpuNameStringGPU name
vramStringGPU memory size (GB)
skuNameStringPayment type: payg, bidding, daily, weekly, monthly
priceStringPrice
cpuNameStringCPU model
cpuCoreNumintCPU cores (allocated proportionally by GPU count)
memorySizeintMemory size (allocated proportionally by GPU count)
payByVoucherintVoucher payment supported: 1, not supported: 0
regionNameStringRegion
dcIdStringDatacenter ID

Response Example

{
"code": 0,
"message": "success",
"traceid": "905b8753fb3db11760f67138872918cb",
"data": {
"InstanceId": 512300905672709,
"operationId": 512303116840965,
"spec": {
"gpuName": "G30-24G",
"vram": "10G",
"skuName": "payg",
"price": "10",
"cpuCoreNum": 16,
"cpuName": "Intel Xeon Processor (Skylake, IBRS)",
"memorySize": 17179869184,
"payByVoucher": 1,
"regionName": "East China",
"dcId": "suqian-b"
}
}
}

4. Query Operation Status

Description

  • Request URI: /api/v1/openapi/instance/op/result
  • Request Method: POST

Request Parameters
Body

NameTypeRequiredDescription
idsArray<int>YesList of operation IDs

Response Parameters
Operation

NameTypeDescription
instanceIdInt64Instance ID
statusintOperation status: in progress = 1, success = 2, failure = 3
actionStringCurrent operation
operationIdStringCurrent operation ID
isCompletedintWhether the operation is completed: 1 = completed, 0 = not completed
startTimeStringStart time
completeTimeStringCompletion time

Response Example

{
"code": 0,
"message": "success",
"traceid": "287bfb0b8e3fb11797f57d7a4f92b05b",
"data": {
"operations": [
{
"instanceId": 512300905672709,
"operationId": 512303116840965,
"action": "stop",
"status": 2,
"isCompleted": 1,
"startTime": "2024-02-06 17:06:45",
"completeTime": "2024-02-06 17:06:47"
}
]
}
}

5. Query Instance List

Description

  • Request URI: /api/v1/openapi/instance/query
  • Request Method: GET

Request Parameters
Query

NameTypeRequiredDescription
statusStringNoInstance status. Options: stopd, running, creating
instanceIdIntNoQuery a specific instance
pnIntegerNoPage number
psIntegerNoPage size (default = 20)

Response Parameters

NameTypeDescription
instancesArray<Instance>Array of instances
totalIntegerTotal count

Instance

NameTypeDescription
instanceIdint64Instance ID
nameStringCustom instance name
imageIdStringImage ID
statusStringInstance status
isPendingIntWhether an operation is in progress. 1 = in progress
gpuNameStringGPU name
gpuNumIntegerNumber of GPUs
availableGpuNumIntAvailable GPUs on the host machine
skuNameStringRental method: payg, daily, weekly, monthly, card_less (start without GPU)
createdAtStringCreation time
cpuCoreNumIntCPU cores
memorySizeInt64Memory size, in Bytes
systemDiskSizeInt64Allocated system disk space (root directory /), in Bytes
systemDiskUsedSizeInt64Used system disk space (root directory /), in Bytes
dataDiskSizeInt64Allocated data disk space (/gz-data), in Bytes
dataDiskUsedSizeInt64Used data disk space (/gz-data), in Bytes
sshCmdStringSSH login command
sshPwdStringSSH login password
notebookUrlStringJupyterLab Notebook access URL
tensorboardUrlStringTensorboard access URL
customServicesArray<String>Custom TCP port access URLs (array, each element is the access URL for a port)
httpServicesArray<String>Custom HTTP port access URLs (array, each element is the access URL for a port)
operationIdInt64Most recent operation ID
dcIdStringDatacenter ID
isStartableBooleanWhether the instance can be directly started, determined by the host machine status and available GPUs

Response Example

{
"code": 0,
"message": "success",
"traceid": "3082737a3085b5177f74d5555f57a69f",
"data": {
"instances": [
{
"instanceId": 504838617333765,
"name": "testname",
"status": "stopd",
"imageId": "stable-diffusion-webui_v1.7.0",
"isPending": 0,
"gpuName": "G40-24G",
"gpuNum": 0,
"skuName": "payg",
"operationId": 511642810499077,
"cpuCoreNum": 1,
"memorySize": 2147483648,
"systemDiskSize": 32212254720,
"systemDiskUsedSize": 4311059,
"dataDiskSize": 53687091200,
"dataDiskUsedSize": 0,
"sshCmd": "ssh -p 59064 root@xxxxx",
"sshPwd": "Q3rDHh7QEwgYsuPxYSdVbE9zzKQQW45e",
"notebookUrl": "http://xxxxx:42757/lab?token=f4jzygqwno3fecinx9arnetu",
"tensorboardUrl": "http://xxxxx:44634",
"customServices": [
"http://xxxxx:48548"
],
"httpServices": [
"https://504838617333765-http-8099.northwest1.gpugeek.com:8443"
],
"createdAt": "2024-01-16 14:53:38",
"dcId": "qingyang-a",
"availableGpuNum": 8,
"isStartable": true
}
],
"total": 1
}
}

6. Instance Operations

Description

  • Request URI: /api/v1/openapi/instance/action
  • Request Method: POST

Request Parameters
Body

NameTypeRequiredDescription
instanceIdInt64YesInstance ID
actionStringYesInstance operation type. Supported actions: stop (shutdown), start (boot), restart (reboot), release (terminate), set_port (set custom ports)
portsArray<Int>Required if action=set_portInternal TCP port array. Up to 3 (TCP+HTTP) can be opened simultaneously. This operation resets and replaces existing TCP port mappings. Empty array deletes mappings.
httpPortsArray<Int>Required if action=set_portInternal HTTP port array. Up to 3 (TCP+HTTP) can be opened simultaneously. This operation resets and replaces existing HTTP port mappings. Empty array deletes mappings.

Response Parameters

NameTypeDescription
operationIdInt64Operation ID

Response Example

{
"code": 0,
"message": "success",
"traceid": "3082737a3085b5177f74d5555f57a69f",
"data": {
"operationId": 511642810499077
}
}

Appendix

1. Common Response Structure

{
"code": 0,
"message": "success",
"traceid": "180114fedf26b1177b44121fa5c1e5d9",
"data": {}
}

2. HTTP Status Codes

Status CodeMeaningDescription
404Not FoundRequest URI does not exist
403ForbiddenRequest not authorized
200OKRequest successful
500Internal Server ErrorServer error

3. Common Error Codes

Error CodeMessageDescription
10001Internal Server ErrorUndefined internal server error. Contact support for assistance
10002Not logged in or login expiredUsually occurs when the request header is missing gz-api-token
10005Parameter errorParameter validation error
10135Instance operation errorInstance operation error. Error details are in the message