Glows.ai SDK API (1.0.1)

API documentation for Glows.ai SDK

Start an instance

Start a new instance using the SDK

Request Body schema: application/json
required
One of
from_image_id
required
string

Image ID, for example: 6np5yvq2

gpu_name
required
string

GPU machine name, for example: NVIDIA L40S PCIe

custom_meta_key
required
string

Unique identifier for the instance, other than the instance ID, set by the user

instance_category
required
string

Machine underlying technology type, for example: container, vm

region_name
required
string

Machine region, for example: TW-03, TW-04, etc.

remark
string

Instance remark name, set by the user

envs
string

Default environment variables, for example: foo=bar;tik=tok

ports
string

Custom exported ports, in JSON string format, for example: [{"port":7890,"protocol":2}, {"port":3306,"protocol":1}], where protocol=1 indicates SSH protocol, and protocol=2 indicates HTTP protocol

cmd
string

Entry command, supported only in container mode. The command must be able to hang; otherwise, the instance will be automatically released once the command finishes. For example: python -m http.server 8080

Responses

Response Schema: application/json
code
integer

Return code, 0 means success, and others (not 0) means failure

msg
string

Returned message, typically a failure description

object

Request samples

Content type
application/json
Example
{
  • "from_image_id": "87p9kq26",
  • "gpu_name": "NVIDIA GeForce RTX 4090",
  • "custom_meta_key": "order.123456",
  • "instance_category": "container",
  • "region_name": "TW-03",
  • "remark": "this is from sdk",
  • "envs": "foo=bar",
  • "ports": "[{\"port\":7890,\"protocol\":2}]",
  • "cmd": "string"
}

Response samples

Content type
application/json
{
  • "code": 0,
  • "msg": "",
  • "instance": {
    }
}

Retrieve instance info

Retrieve information about a specific instance

Authorizations:
bearerAuth
query Parameters
request_id
string

Instance ID (instanceID from the response of creating an instance). Either request_id or meta_key is required.

meta_key
string

The meta_key specified when creating the instance, globally unique. Either request_id or meta_key is required.

Responses

Response Schema: application/json
code
integer

Return code, 0 means success, and others (not 0) means failure

msg
string

Returned message, typically a failure description

object

Request samples

curl --http1.1 \
  --request GET \
  --url 'https://example.glows.ai/sdk/v1/instance?meta_key=cpu_test.009' \
  --header 'Authorization: Bearer YOUR_SDK_TOKEN'

Response samples

Content type
application/json
{
  • "code": 0,
  • "msg": "",
  • "instance": {
    }
}

Release instance

Release an instance using request_id or meta_key

Authorizations:
bearerAuth
query Parameters
request_id
string

Instance ID (instanceID from the response of creating an instance). Either request_id or meta_key is required.

meta_key
string

The meta_key specified when creating the instance, globally unique. Either request_id or meta_key is required.

Responses

Response Schema: application/json
code
integer

Return code, 0 means success, and others (not 0) means failure

msg
string

Returned message, typically a failure description

Request samples

curl --http1.1 \
  --request DELETE \
  --url 'https://example.glows.ai/sdk/v1/instance?meta_key=cpu_test.009' \
  --header 'Authorization: Bearer YOUR_SDK_TOKEN'

Response samples

Content type
application/json
{
  • "code": 0,
  • "msg": ""
}

Stat instance

Retrieve the statistics of instances

Authorizations:
bearerAuth

Responses

Response Schema: application/json
code
integer

Return code, 0 means success, and others (not 0) means failure

msg
string

Returned message, typically a failure description

object

Instances amount corresponding to each status; status with a statistic of 0 are not displayed

Response samples

Content type
application/json
{
  • "code": 0,
  • "msg": "",
  • "stats": {
    }
}

Instance list

Retrieve a list of instances with pagination and filtering options

Authorizations:
bearerAuth
query Parameters
page
required
integer

Pagination number

per_page
required
integer

Number of pages per pagination

ascending
boolean

Whether to create in ascending order, default is reverse order

statuses
Array of strings

Display instances of the specified status

Responses

Response Schema: application/json
code
integer

Return code, 0 means success, and others (not 0) means failure

msg
string

Returned message, typically a failure description

object
Array of objects

Response samples

Content type
application/json
{
  • "code": 0,
  • "msg": "",
  • "pagination": {
    },
  • "instances": [ ]
}
Welcome to Glows.ai
Invitation Code: