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 |
|---|---|---|---|---|
|
Header |
string |
Yes |
Workspace ID in the same environment. |
|
Path |
string |
Yes |
Workspace ID in the same environment. |
|
Body |
string |
Yes |
Nonempty name after trimming surrounding whitespace. |
|
Body |
integer |
No |
Numeric protocol 0–6, default 0; Embedding rejects 5. |
|
Body |
string |
No |
Provider credentials. The field name does not establish their encryption state. |
|
Body |
array (array of strings) |
No |
Nonempty names without leading/trailing whitespace. The workspace API allows an empty set. |
|
Body |
integer |
No |
Positive seconds. Omitted/nonpositive values become 120. |
|
Body |
integer |
No |
LLM only uses 0–5, default 0; Embedding ignores it. |
|
Body |
string |
No |
Only LLM accepts external_provider; Embedding does not use it. |
|
Body |
string |
No |
LLM provenance reference text. |
|
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 |
|---|---|---|
|
integer |
0 on success. |
|
object |
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.