Creates a new model import job.
Prerequisites
-
You have configured your Model Studio API key. For more information, see Get an API Key.
-
You have created an OSS bucket and authorized Model Studio to access it. For details, see the prerequisites in Model Import.
-
Your model files are uploaded to an OSS bucket and meet the Import requirements and limits.
Common request headers
All API requests must include the following fields in the HTTP header:
|
Header |
Description |
|
Authorization |
|
|
Content-Type |
|
Create an import job
Submits a model import job. The system validates the structure and security of the model files to ensure they can be deployed successfully.
Endpoint
POST https://dashscope-intl.aliyuncs.com/api/v1/custom_models/import
Request example
curl -X POST "https://dashscope-intl.aliyuncs.com/api/v1/custom_models/import" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model_name": "qwen3-32b",
"display_name": "My LoRA-tuned model",
"source": "oss",
"weight_type": "lora",
"storage_info": {
"bucket_name": "my-model-bucket",
"object_key": "models/qwen3-32b-lora/"
}
}'
Request parameters
|
Parameter |
Type |
Location |
Required |
Description |
|
model_name |
String |
body |
Yes |
The name of the base model. This corresponds to the Base Model field in the console. For a list of supported models, see Supported base models for import. Example: |
|
display_name |
String |
body |
No |
The display name for the imported model. This corresponds to the Model Name field in the console. The name can be up to 50 characters long. If omitted, this defaults to the base model name. |
|
source |
String |
body |
Yes |
The import source. This corresponds to the Import Source field in the console. Currently, only |
|
weight_type |
String |
body |
Yes |
The tuning type. |
|
storage_info |
Object |
body |
Yes |
Storage information for the import source. |
|
storage_info.bucket_name |
String |
body |
Yes |
The name of the OSS bucket. This corresponds to the Bucket field in the console. |
|
storage_info.object_key |
String |
body |
Yes |
The path prefix for the model files in the OSS bucket. The path must end with a forward slash ( |
Response example
{
"request_id": "6c6b****-3fea-****-bc26-c9e2********",
"output": {
"job_id": "937b****-2a4f-****-8abe-c2fa********",
"model_name": "qwen3-32b-offline-20240101-abc1",
"display_name": "My LoRA-tuned model",
"source": "OSS",
"weight_type": "lora",
"storage_info": {
"bucket_name": "my-model-bucket",
"object_key": "models/qwen3-32b-lora/"
},
"status": "PENDING",
"gmt_create": "2024-01-01T12:00:00.000+00:00"
}
}
Response parameters
|
Parameter |
Type |
Description |
|
request_id |
String |
The request ID. |
|
output.job_id |
String |
The job ID of the import job. Use this ID in the Query import job details, List import jobs, and Delete an import job operations. |
|
output.model_name |
String |
The system-generated identifier for the model. The format is the base model name followed by a timestamp suffix. |
|
output.display_name |
String |
The display name of the imported model. |
|
output.source |
String |
The import source. The returned value is |
|
output.weight_type |
String |
The tuning type. |
|
output.storage_info |
Object |
Storage information for the import source, which includes |
|
output.status |
String |
The job status. For more information, see Job status description. |
|
output.gmt_create |
String |
The time when the job was created, in ISO 8601 format. Example: |
Error responses
If a request fails, the API returns an error response in the following format:
{
"request_id": "ca21****-b91b-****-bd35-c41c********",
"code": "OperationDenied",
"message": "The import job is currently running and cannot be deleted."
}
Error codes
|
Error code |
Description |
|
InvalidParameter |
Indicates an invalid request parameter, such as a missing required parameter, an incorrect format, or an invalid value. |
|
NotFound |
Indicates that the requested resource could not be found. This may occur if the specified job ID is incorrect, the base model does not support import, or you lack permissions to access the resource. |
|
OperationDenied |
Indicates that the requested operation is not permitted, often due to the resource's current state. For example, you cannot delete a job that is |
|
InvalidApiKey |
The API key is invalid or was not provided. |
|
InternalError |
An internal system error occurred. Try the request again later. |