Custom model import
Bailian CLI command reference for importing custom models from OSS, tracking import jobs, and managing imported models.
bl cmodel imports custom models from OSS, lists base models available for import, tracks import jobs, and queries or deletes imported models.
NoteThe model import API is currently available in the Beijing region only. Import commands always call the public DashScope endpoint in the Beijing region and do not use the Profile Base URL; workspace API keys are still accepted.
ImportantAppend --help to any command for full parameter details, e.g. bl cmodel import --help. Deleting an imported model is a high-risk operation; without --yes the command is blocked (exit code 7). Command details on this page are verified against bl 2.8.0.
Quick start
bl cmodel base-models
bl cmodel import --base-model qwen3-32b --weight-type lora --bucket my-model-bucket --object-key models/qwen3-32b-lora/
bl cmodel watch --job-id <job-id> --follow
bl cmodel list
Import models
bl cmodel base-models
List base models that can be imported as custom models. Requires console login.
Usage
bl cmodel base-models
This command supports only global flags and console flags.
Example: List importable base models in the Beijing region
bl cmodel base-models --console-region cn-beijing
- The list is returned dynamically by the console API and may change between releases.
- Import is currently available only in the Beijing region.
bl cmodel import
Import a custom model from OSS and create an import job. Requires API Key authentication.
Usage
bl cmodel import --base-model <model> --weight-type <lora|full> --bucket <bucket> --object-key <dir/> [--display-name <name>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--base-model <model> | string | yes | Base model ID used for tuning, e.g. qwen3-32b |
--weight-type <lora|full> | string | yes | Tuning weight type: lora or full |
--bucket <bucket> | string | yes | OSS bucket containing the model files |
--object-key <dir/> | string | yes | OSS directory prefix containing the model files; must end with / and not be the bucket root |
--display-name <name> | string | no | Display name (max 50 characters) |
Example: Import a LoRA model
bl cmodel import --base-model qwen3-32b --weight-type lora --bucket my-model-bucket --object-key models/qwen3-32b-lora/
Example: Set a display name
bl cmodel import --base-model qwen3-32b --weight-type lora --bucket my-model-bucket --object-key models/qwen3-32b-lora/ --display-name my-lora
- After submission, follow the job with
cmodel watch --job-idand inspect it withcmodel getorcmodel list. - The bucket must be tagged
bailian-datahub-access=read, must not use archive, cold-archive, or deep-archive storage or SSE-KMS, and the directory must contain the model files required by the platform, such asadapter_model.safetensors,adapter_config.json, andconfig.json. - The current product version supports importing LoRA models; submitting
fullmay be rejected by the service. The API contract keeps bothloraandfull, so the CLI does not hidefull. - When a valid console session is available, the base model is checked against the console-supported import list before submission: the ID is normalized to the catalog
modelvalue, and the weight type is checked against the model'ssupportTrainTypes(lora requires efficient_sft, full requires sft). Unsupported combinations fail immediately with a usage error. If the console session is missing or expired, the check is skipped with a warning, and the import API's final result is authoritative.
bl cmodel get
Get details of a custom model import job. Requires API Key authentication.
Usage
bl cmodel get --job-id <id>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Import job ID returned by cmodel import |
Example: Get import job details
bl cmodel get --job-id 937b-xxxx --output json
- Failed jobs include the server-provided
error_code; the CLI does not translate it.
bl cmodel list
List imported custom models by page. Requires API Key authentication.
Usage
bl cmodel list [--page <n>] [--page-size <n>] [--status <status>] [--model-name <name>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--page <n> | number | no | Page number (default: 1) |
--page-size <n> | number | no | Results per page (default: 10, max 100) |
--status <PENDING|RUNNING|SUCCESSED|FAILED> | string | no | Filter by status (server-side) |
--model-name <name> | string | no | Filter by the server-generated model identifier (exact match, server-side) |
Example: List running import jobs
bl cmodel list --status RUNNING
--statusand--model-nameare server-side filters over the whole result set, not local page filters.- Failed entries include the server-provided
error_code.
bl cmodel watch
Probe an import job's status. By default it queries once; pass --follow to poll until a terminal state. Requires API Key authentication.
Usage
bl cmodel watch --job-id <id> [--follow] [--interval <sec>] [--poll-timeout <sec>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Import job ID returned by cmodel import |
--follow | switch | no | Block and poll until a terminal state. Without it, query once and return immediately |
--interval <sec> | number | no | Seconds between polls with --follow (default: 10, min: 1); ignored without --follow |
--poll-timeout <sec> | number | no | With --follow, stop polling after this many seconds (default: no limit); ignored without --follow |
Example: Query status once
bl cmodel watch --job-id 937b-xxxx
Example: Poll until the job finishes
bl cmodel watch --job-id 937b-xxxx --follow --interval 5 --poll-timeout 3600
- Terminal statuses are
SUCCESSEDandFAILED. Unknown server statuses are surfaced verbatim and treated as non-terminal. - A terminal
FAILEDstatus returns a non-zero exit code with the servererror_codepreserved.SUCCESSEDand still-running statuses return 0. - With
--follow, exceeding--poll-timeoutreturns a timeout error.
bl cmodel delete
Delete a custom model and its Bailian-side import record. Requires API Key authentication.
Usage
bl cmodel delete --job-id <id> [--yes]
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Import job ID returned by cmodel import |
--yes | switch | no | Confirm this high-risk operation |
Example: Delete an imported model
bl cmodel delete --job-id 937b-xxxx
WarningDeletion permanently removes the Bailian-side import record and the imported model copy and cannot be undone. OSS source files are not modified. Only SUCCESSED or FAILED jobs can be deleted; deleting a RUNNING job is rejected by the service (OperationDenied).
- Use
--dry-runto preview the deletion. - Add
--yesonly after confirming the action and its scope.