Create an embedding backend through the workspace API

Save embedding backend configuration and get a new backend ID.

POST https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/embeddings/backends

Before you call this API

Set BASE_URL to the product API prefix https://api.moi.matrixorigin.cn/v5; use the corresponding product API URL for a dedicated deployment.

Configure identity, workspace, and object permissions in the same environment.

Request

curl --request POST \
  "$BASE_URL/workspaces/$WORKSPACE_ID/embeddings/backends" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID" \
  --header "Content-Type: application/json" \
  --data-raw '{"name":"临时后端","type":0,"api_key_encrypted":"provider-key-example","models":["bge-m3"]}'

Parameter

Location

Type

Required

Description

X-Workspace-ID

Headers

string

Yes

Workspace ID in the same environment.

workspace_id

Path

string

Yes

Workspace ID in the same environment.

name

Body

string

Yes

Nonempty name after trimming whitespace.

type

Body

integer

No

Numeric protocol 0–6, default 0; Embedding rejects 5.

api_key_encrypted

Body

string

No

Provider credentials. The field name does not establish their encryption state.

models

Body

array (strings)

No

Nonempty names without leading/trailing whitespace. The workspace API allows an empty set.

timeout_seconds

Body

integer

No

Positive seconds. Omission or nonpositive values use 30.

reasoning_control_protocol

Body

integer

No

LLM only uses 0–5, default 0; Embedding ignores it.

provider_origin

Body

string

No

Only LLM accepts external_provider; Embedding does not use it.

origin_ref

Body

string

No

LLM provenance reference text.

origin_version

Body

string

No

LLM provenance version text.

Requires workspace model_backend.create. Save the returned id, then read details and endpoints. Configuration does not verify model connectivity or inference capabilities. Ordinary workspace-style creation does not automatically create endpoints. DEV adapters have special internal behavior and are not a production integration method.

Successful response

{
  "code": 0,
  "data": {
    "id": 12,
    "name": "临时后端",
    "timeout_seconds": 30,
    "models": [
      "bge-m3"
    ],
    "created_at": 1794445200,
    "updated_at": 1794445200,
    "provider_origin": "unknown",
    "api_key_encrypted": "provider-key-example"
  }
}

HTTP 201。

Field

Type

Description

code

integer

0 on success.

data

object

Actual objects for this protocol.

Error responses

Errors and result confirmation distinguishes the two protocols. Parse omitted fields, SDK zero values, and empty HTTP responses separately. Confirm writes with the corresponding reads.

Last updated on