Create an LLM backend through the root API¶
Save LLM backend configuration and get a new backend ID.
POST https://api.moi.matrixorigin.cn/v5/llm/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/llm/backends" \
--header "X-API-Key: $MOI_KEY" \
--header "X-Workspace-ID: $WORKSPACE_ID" \
--header "Content-Type: application/json" \
--data-raw '{"name":"临时后端","type":"OPENAI","api_key":"provider-key-example","models":["chat-example"]}'
Parameter |
Location |
Type |
Required |
Description |
|---|---|---|---|---|
|
Headers |
string |
Yes |
Workspace ID in the same environment. |
|
Body |
string |
Yes |
Nonempty name after trimming whitespace. |
|
Body |
string |
No |
OPENAI/OLLAMA/VLLM/QIANWEN/DOUBAO/DEV_LLM/HTTP. Omission or invalid values use OPENAI. Embedding rejects DEV_LLM. |
|
Body |
string |
Conditionally required |
Required for OPENAI/QIANWEN/DOUBAO; separate from MOI_KEY. |
|
Body |
array (strings) |
Yes |
At least one valid model name. |
|
Body |
integer |
No |
Positive seconds. Omission or nonpositive values use 120. |
|
Body |
string |
No |
LLM reasoning control protocol; defaults to NONE. Embedding does not use reasoning control. |
|
Body |
string |
No |
A nonempty Embedding address can also create an endpoint. This LLM creation action ignores the address; create endpoints separately. |
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": "OK",
"msg": "OK",
"data": {
"id": 12,
"name": "临时后端",
"type": "OPENAI",
"timeout_seconds": 120,
"models": [
"chat-example"
],
"created_at": 1794445200,
"updated_at": 1794445200,
"reasoning_control_protocol": "REASONING_CONTROL_NONE"
}
}
HTTP 200。
Field |
Type |
Description |
|---|---|---|
|
string |
OK on success. |
|
string |
OK on success. |
|
object |
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.