Updated on 2025-08-13 GMT+08:00

Creating a model

Function

The API is used to configure the added NLP model, including the model name, model description, model endpoint, and model deployment_id.

URI

POST /v1/koosearch/models

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Parameter description:

Token used for API authentication. For how to obtain the token, see section 3.2 "Authentication."

Constraints:

N/A.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Model name

detail

Yes

String

Model description

endpoint

Yes

String

Model endpoint

type

Yes

String

Model type:

Pangu_chat Pangu chat model

pangu_llm Pangu model deployed on bare metal

embedding Embedding model

query2query query2query model

rerank Reranking model

search_plan Search planning model

llm LLM

extend_config

Yes

ModelExtendConfig object

Customized model configuration in JSON format

alias

No

String

Model name required for the Ascend model scenario

Table 3 ModelExtendConfig

Parameter

Mandatory

Type

Description

iam_info

Yes

IamInfo object

IAM authentication agency information

custom_header

No

map<string, object>

Extended request header

deployment_id

No

String

deployment_id of a model

vector_config

No

VectorConfig object

Vector model configuration.

nlp_config

No

NlpConfig object

Configuration of the NLP foundation model.

Table 4 IamInfo

Parameter

Mandatory

Type

Description

iam_enabled

No

Boolean

Indicates whether to enable authentication

agency_enabled

No

Boolean

Indicates whether to use an agency account for authentication

project_id

No

String

Project ID of the IAM user. This parameter is mandatory when iam_enable is set to true.

domain_name

No

String

Name of the agency account

agency_name

No

String

Agency name.

Table 5 VectorConfig

Parameter

Mandatory

Type

Description

embedding_url

Yes

String

URL for calling the embedding or query2query model.

rerank_url

Yes

String

URL for calling the reranking model.

Table 6 NlpConfig

Parameter

Mandatory

Type

Description

context_length

Yes

Integer

Context length, that is, the maximum number of tokens that can be considered by the NLP foundation model during a specific inference.

Response Parameters

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error Code

error_msg

String

Error description

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error Code

error_msg

String

Error description

Example Requests

POST https://{endpoint}/v1/koosearch/models

{
  "name" : "pangu_v30_32k",
  "type" : "pangu_llm",
  "endpoint" : "http://10.0.0.169:31010",
  "detail" : "panguv30_4k",
  "extend_config" : {
    "deployment_id" : "panguv30_4k",
    "iam_info" : {
      "project_id" : "123",
      "iam_enabled" : false,
      "agency_enabled" : false
    },
    "nlp_config" : {
      "context_length" : 32
    }
  }
}

Example Responses

None

Status Codes

Status Code

Description

200

The addition is successful.

400

Invalid request body

500

Internal error

Error Codes

See Error Codes.