All Products
Search
Document Center

OpenSearch:CreateModel

Last Updated:Nov 04, 2025

Creates a model.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

searchengine:CreateModel

create

*Instance

acs:searchengine:{#regionId}:{#accountId}:instance/{#InstanceId}

None None

Request syntax

POST /openapi/ha3/instances/{instanceId}/models HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

instanceId

string

Yes

The instance ID.

ha-cn-pl32rf0****

dryRun

string

No

Specifies whether to perform only a dry run. The default value is false.

true

body

object

No

The request body.

name

string

Yes

The model name.

test

content

object

No

The model details.

modelType

string

No

The model type.

  • a. Text embedding: text_embedding

  • b. Text sparse embedding: text_sparse_embedding

  • c. Image embedding: image_embedding

  • d. Image content analysis: image_analyze

text_embedding

dimension

integer

No

The dimension of the model. This parameter is required if `modelType` is `text_embedding` or `image_embedding`.

128

url

string

No

The endpoint of the model service.

http://***.platform-cn-shanghai.opensearch.aliyuncs.com/v3/openapi/workspaces/default/text-embedding/ops-text-embedding-001

method

string

No

The HTTP method to access the model service. Supported methods: PUT and POST.

POST

request

object

No

The model request body.

header

object

No

The HTTP header for accessing the model service.

Authorization

string

No

The authentication information. Format: Bearer access_token

Bearer OS-v0********6vvs

Content-Type

string

No

The content type of the HTTP request.

application/json

urlParams

object

No

The parameters in the URL. Some model services require that parameters are passed in the URL.

build

object

No

The parameters passed during index building.

key: value

search

object

No

The parameters passed during a query.

key: value

parameters

object

No

If the parameters in the request body are different for the build and search phases, define them in this parameter.

build

object

No

The parameters for the index building phase.

input_type

string

No

The input type.

query

search

object

No

The parameters for the query phase.

input_type

string

No

The input type.

document

requestBody

string

No

The template string for the request body.

{\"input\": [\"%{input}\"], \"input_type\": \"%{input_type}\"}

response

object

No

The configuration for parsing the response. Use JSONPath format.

embeddings

string

No

The JSONPath expression to extract embeddings from the response.

$.result.embeddings[*].embedding

Response elements

Element

Type

Description

Example

object

Schema of Response

requestId

string

Id of the request

022F36C7-9FB4-5D67-BEBC-3D14B0984463

Examples

Success response

JSON format

{
  "requestId": "022F36C7-9FB4-5D67-BEBC-3D14B0984463"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.