Import custom models from OSS, track import jobs, and query or delete imported models from the terminal.
The custom model import API is currently available in the Beijing region only. import, get, list, watch, and delete always call the public DashScope endpoint in Beijing; the Profile Base URL is not used. Workspace API keys are still accepted. base-models queries the console API and supports --console-region and --console-site.
Append --help to any command for full parameter details, e.g. bl cmodel import --help. Command details on this page are verified against bl 2.8.5.
List importable base models
bl cmodel base-models
List base models that can be imported as custom models. Requires console login (bl auth login --console).
Usage
bl cmodel base-models [flags]
| Parameter | Type | Required | Description |
|---|
--console-region <region> | string | no | Console gateway region, e.g. cn-beijing, ap-southeast-1 |
--console-site <site> | string | no | Console site: domestic, international |
--console-switch-agent <uid> | number | no | Switch agent UID for delegated access |
--workspace-id <id> | string | no | Workspace ID; also settable with BAILIAN_WORKSPACE_ID |
Example: List importable base models in Beijing
bl cmodel base-models --console-region cn-beijing
- The list is returned dynamically by the console API and may change between releases.
- Use this command before import to verify the base model ID; the CLI checks whether the weight type is supported when you submit the import.
Import and track
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 cannot be the bucket root |
--display-name <name> | string | no | Display name (max 50 characters) |
--console-region <region> | string | no | Console gateway region |
--console-site <site> | string | no | Console site: domestic, international |
--console-switch-agent <uid> | number | no | Switch agent UID for delegated access |
--workspace-id <id> | string | no | Workspace ID; also settable with BAILIAN_WORKSPACE_ID |
Example: Import a LoRA model from OSS
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
- The bucket must be tagged
bailian-datahub-access=read and must not use archive, cold archive, deep archive storage, or SSE-KMS encryption.
- 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;
--weight-type full may be rejected by the service, and the CLI does not hide the value.
- When a valid console session exists, the CLI checks the base model against the importable list and verifies the weight type before submission. If the console session is missing or expired, the check is skipped with a warning and the import API result is authoritative.
- After submission, track the job with
cmodel watch --job-id, or inspect it with cmodel get / cmodel list.
--dry-run makes no business requests.
bl cmodel watch
Query import job status. Without --follow, it performs one non-blocking query. 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 | Polling interval (default: 10, min: 1; --follow only) |
--poll-timeout <sec> | number | no | Total polling deadline (default: no limit; --follow only) |
Example: Query job status once
bl cmodel watch --job-id 937b-xxxx
Example: Poll until the import finishes
bl cmodel watch --job-id 937b-xxxx --follow --interval 5 --poll-timeout 3600
- Terminal states are
SUCCESSED and FAILED; an unknown server status is surfaced verbatim and treated as non-terminal.
- A terminal
FAILED status returns a non-zero exit code and preserves the server-provided error_code. SUCCESSED or still-running states return 0.
- With
--follow, exceeding --poll-timeout returns a timeout error.
Query and delete
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 verbatim; the CLI does not translate it.
bl cmodel list
List imported custom models one page at a time. 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
Example: Filter by model identifier
bl cmodel list --model-name qwen3-32b-offline-20240101-abc1
--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 delete
Delete a custom model and its Bailian-side import record. Requires API Key authentication.
Usage
bl cmodel delete --job-id <id>
| Parameter | Type | Required | Description |
|---|
--job-id <id> | string | yes | Import job ID returned by cmodel import |
--yes | switch | no | Confirm this high-risk operation |
Without --yes, the command exits with code 7 to request confirmation of the operation scope.
Example: Preview deletion
bl cmodel delete --job-id 937b-xxxx --dry-run
Example: Confirm deletion
bl cmodel delete --job-id 937b-xxxx --yes
This permanently deletes the Bailian-side import record and imported model copy; it 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 and the error is surfaced verbatim.
- To restore a deleted model, import it again.