Create an LLM backend (workspace endpoint)

Save LLM backend configuration and get a new backend ID.

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

Before you call this API

BASE_URL uses the product API prefix https://api.moi.matrixorigin.cn/v5. For a dedicated deployment, use its corresponding product API address.

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

Request

curl --request POST \
  "$BASE_URL/workspaces/$WORKSPACE_ID/llm/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":["chat-example"]}'

Parameter

Location

Type

Required

Description

X-Workspace-ID

Header

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 surrounding 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 (array of strings)

No

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

timeout_seconds

Body

integer

No

Positive seconds. Omitted/nonpositive values become 120.

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 capability. Ordinary Workspace-level 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": 120,
    "models": [
      "chat-example"
    ],
    "created_at": 1794445200,
    "updated_at": 1794445200,
    "provider_origin": "external_provider",
    "api_key_encrypted": "provider-key-example"
  }
}

HTTP 201。

Field

Type

Description

code

integer

0 on success.

data

object

Actual objects for this protocol.

Error response

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

Last updated on