Obtaining Models

Function

This API is used to obtain the models that meet the search criteria.

Debugging

You can debug this API through automatic authentication in or use the SDK sample code generated by API Explorer.

URI

GET /v1/{project_id}/models

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID and Name.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

model_name

No

String

Model name. Fuzzy match is supported. If a model name contains an underscore (_), add the exact_match parameter to the request and set the parameter value to true because the underscore needs to be escaped. This ensures that the query operation can be performed properly.

exact_match

No

String

Whether to escape underscores (*). If a model name contains underscores (*), set this parameter to true to ensure that the query operation can be performed properly. By default, this parameter is left blank.

model_version

No

String

Model version

model_status

No

String

Model status. You can obtain models based on model statuses. Options:

  • publishing: The model is being published.

  • published: The model has been published.

  • failed: Publishing the model failed.

  • building: The image is being created.

  • building_failed: Creating an image failed.

description

No

String

Description. Fuzzy match is supported.

offset

No

Integer

Index of the query page, which defaults to 0

limit

No

Integer

Maximum number of records returned on each page. Default value: 1000

sort_by

No

String

Sorting field. Options:

  • create_at: time when an AI application is created (default value)

  • model_version: AI application version

  • model_size: AI application size

order

No

String

Sorting mode. Options:

  • asc: ascending order

  • desc: descending order (default value)

workspace_id

No

String

Workspace ID, which defaults to 0

model_type

No

String

Model type, which is used for obtaining models of this type. Either model_type or not_model_type can be configured.

not_model_type

No

String

Model type, which is used for obtaining models of types except for this type

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling the IAM API that is used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

models

Array of ModelListItem objects

Model metadata

total_count

Integer

Total number of models that meet the search criteria when no paging is performed

count

Integer

Total number of models that meet the search criteria

Table 5 ModelListItem

Parameter

Type

Description

owner

String

User ID of the tenant to which a model belongs

model_version

String

Model version

model_type

String

Model type

description

String

Model description

project

String

Project ID of the tenant to which a model belongs

source_type

String

Model source type. This parameter is valid and its value is auto only if the model is deployed using ExeML.

model_id

String

Model ID

model_source

String

Model source. Options:

  • auto: ExeML

  • algos: built-in algorithm

  • custom: custom model

install_type

Array of strings

Deployment types supported by a model

model_size

Integer

Model size, in bytes

workspace_id

String

Workspace ID. Value 0 indicates the default workspace.

model_status

String

Model status

market_flag

Boolean

Whether a model is subscribed from AI Gallery

tunable

Boolean

Whether a model can be tuned. true indicates that the model can be tuned, and false indicates not.

model_name

String

Model name

create_at

Long

Time when a model is created, in milliseconds calculated from 1970.1.1 0:0:0 UTC

publishable_flag

Boolean

Whether a model can be published to AI Gallery

source_copy

String

Whether to enable image replication. This parameter is valid only when model_type is set to Image.

  • true: Image replication is enabled. After this function is enabled, AI applications cannot be rapidly created, and modifying or deleting an image in the SWR source directory will not affect service deployment.

  • false: Image replication is not enabled. After this function is disabled, AI applications can be rapidly created, but modifying or deleting an image in the SWR source directory will affect service deployment. If this parameter is not configured, image replication is enabled by default.

tenant

String

Account ID of the tenant to which a model belongs

subscription_id

String

Model subscription ID

extra

String

Extended parameter

specification

ModelSpecification object

Minimum specifications for model deployment

Table 6 ModelSpecification

Parameter

Type

Description

min_cpu

String

Minimal CPU specifications

min_gpu

String

Minimal GPU specifications

min_memory

String

Minimum memory

min_ascend

String

Minimal Ascend specifications

Example Requests

GET https://{endpoint}/v1/{project_id}/models

Example Responses

Status code: 200

Models

{
  "total_count" : 1,
  "count" : 1,
  "models" : [ {
    "model_name" : "mnist",
    "model_version" : "1.0.0",
    "model_id" : "10eb0091-887f-4839-9929-cbc884f1e20e",
    "model_type" : "tensorflow",
    "model_size" : 5012312,
    "tenant" : "6d28e85aa78b4e1a9b4bd83501bcd4a1",
    "project" : "d04c10db1f264cfeb1966deff1a3527c",
    "owner" : "6d28e85aa78b4e1a9b4bd83501bcd4a1",
    "create_at" : 1533041553000,
    "description" : "mnist model",
    "workspace_id" : "0",
    "specification" : { }
  } ]
}

Status Codes

Status Code

Description

200

Models

Error Codes

See Error Codes.