Model sync

更新时间:
复制 MD 格式

Syncs model information.

If you have a small number of models, you can upload and manage them in the Model Management section of the AI Creation Workshop console. However, if you already manage model information in your own system, you can use the API described in this document to sync model information in bulk.

Core domain model

image

Model sync process

The model sync process involves both synchronous and asynchronous processes.

The synchronous process syncs object metadata. When object metadata in your system changes, you must assemble the complete metadata structure for the model, version, and file. Then, use the synchronous process to sync the object metadata to AI Creation Workshop.

After AI Creation Workshop receives the object metadata:

  • If the model file has already been uploaded to AI Creation Workshop, the service directly returns the model sync result.

  • If the model file has not been uploaded to AI Creation Workshop, the service returns the model sync result and triggers the asynchronous process. The asynchronous process uploads and lists the model file. After the model is listed, a model listing result event is sent to you.

image.png

Model sync

Request syntax

POST /scc/spSdModelSync

Request parameters

Name

Type

Required

Description

Example

apiToken

string

Yes

Token

01j1w6cxqz****

roleId

string

No

The role ID attached to the session.

01j2bapbjd****

sessionMode

integer

No

Session mode: 10. Inference mode: 20. The default is 10.

10

expiredInSeconds

long

No

The time-to-live (TTL) of the session in seconds. The default TTL is 1 hour for session mode and 24 hours for inference mode.

3600

customResourceConfigId

string

No

The resource configuration ID. You can specify multiple IDs separated by commas.

Request parameter information

{
  "modelId": "xxxxx", // The model ID from your system. This ID uniquely identifies a model and is required for synchronization.
  "name": "Demo", // The model name. Required.
  "modelType": "checkpoint", // The model type. Valid values: checkpoint, lora, textualinversion, vae. Required.
  "modelDesc": "xxxx", // The model description in HTML format. Optional.
  "source": "https://xxxx", // The source URL of the model. Optional.
  "sourceType": "internal", // The source type of the model. Valid values: liblib, civitia, hugging_face, internal. The value `internal` indicates a model owned by the tenant. Required.
  "isOriginal": false, // Specifies whether the model is original.
  "originalCreator": "ccc", // The original author.
  "originalCreatorHomepage": "https://xxxx", // A link to the original author's homepage.
  "versions": [
    {
      "modelVersionId": "xxxx", // The model version ID from your system. This ID uniquely identifies a model version and is required for synchronization.
      "name": "v1.2.2-EOL", // The model version name. Required.
      "baseModel": "v1.5", // The foundation model type. Valid values: v1.4, v1.5, v2.0, v2.1, vxl_0.9, vxl_1.0, vxl_distilled, v1.5_lcm, vxl_1.0_lcm, vxl_turbo. Required.
      "versionDesc": "xxxx", // The model version description in HTML format. Optional.
      "triggerWords": ["rev", "animated", "v1.2.2", "eol"], // The trigger words for the model version. Optional.
      "isAutoCollection": true, // Specifies whether to automatically add the model version to favorites. Optional. If set to true, the model version is automatically added to favorites when a new token is created.
      "covers": [
        {
          "cover": "https://xxx.jpeg", // The thumbnail for the model version. Required.
          "coverFile": {
            // The thumbnail file information. Required.
            "width": 1920, // The width of the thumbnail. Required.
            "height": 1080, // The height of the thumbnail. Required.
            "format": "jpeg" // The format of the thumbnail. Optional.
          }
        }
      ],

      "files": [
        {
          "name": "revAnimated_v122EOL.safetensors", // The model file name. Required.
          "aliasName": "revAnimated_v122EOL", // The alias of the model file. This is used as the alias for LoRA models. Required.
          "downloadUrl": "https://xxx", // The download URL of the model file. Required.
          "hash": "xxx", // The hash of the model file. Required.
          "sizeKb": 5376404.0390625, // The size of the model file in KB. Required.
          "isPrimary": true, // Specifies whether this is the primary model file. A version can have only one primary model file.
        }
      ]
    }
  ]
}

Response parameters

Name

Type

Description

data

object

The returned data.

Data parameters

Name

Type

Description

modelId

string

Model ID

modelVersionId

string

Model version ID

modelFileId

string

Model file ID

status

integer

The model sync status. 0: Not listed. 5: Listing. 10: Listed. -10: Listing failed.