Custom model import

Updated at:

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>]
ParameterTypeRequiredDescription
--base-model <model>stringyesBase model ID used for tuning, e.g. qwen3-32b
--weight-type <lora|full>stringyesTuning weight type: lora or full
--bucket <bucket>stringyesOSS bucket containing the model files
--object-key <dir/>stringyesOSS directory prefix containing the model files; must end with / and not be the bucket root
--display-name <name>stringnoDisplay 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-id and inspect it with cmodel get or cmodel 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 as adapter_model.safetensors, adapter_config.json, and config.json.
  • The current product version supports importing LoRA models; submitting full may be rejected by the service. The API contract keeps both lora and full, so the CLI does not hide full.
  • 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 model value, and the weight type is checked against the model's supportTrainTypes (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>
ParameterTypeRequiredDescription
--job-id <id>stringyesImport 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>]
ParameterTypeRequiredDescription
--page <n>numbernoPage number (default: 1)
--page-size <n>numbernoResults per page (default: 10, max 100)
--status <PENDING|RUNNING|SUCCESSED|FAILED>stringnoFilter by status (server-side)
--model-name <name>stringnoFilter by the server-generated model identifier (exact match, server-side)

Example: List running import jobs

bl cmodel list --status RUNNING
  • --status and --model-name are 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>]
ParameterTypeRequiredDescription
--job-id <id>stringyesImport job ID returned by cmodel import
--followswitchnoBlock and poll until a terminal state. Without it, query once and return immediately
--interval <sec>numbernoSeconds between polls with --follow (default: 10, min: 1); ignored without --follow
--poll-timeout <sec>numbernoWith --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 SUCCESSED and FAILED. Unknown server statuses are surfaced verbatim and treated as non-terminal.
  • A terminal FAILED status returns a non-zero exit code with the server error_code preserved. SUCCESSED and still-running statuses return 0.
  • With --follow, exceeding --poll-timeout returns 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]
ParameterTypeRequiredDescription
--job-id <id>stringyesImport job ID returned by cmodel import
--yesswitchnoConfirm 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-run to preview the deletion.
  • Add --yes only after confirming the action and its scope.