Create model configuration¶
Create a model configuration that is referenced by the agent. This interface does not upload or save provider keys.
POST https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/model-configs
Before you call¶
Prepare a personal access token and target workspace ID that has access to the target workspace.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: The workspace ID of the configuration to be created, passed in theX-Workspace-IDHeader and also asworkspace_idin the path.
Referenced resources such as connections, credentials, etc. must be valid; the interface itself does not receive provider keys.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/model-configs" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"name": "销售分析模型",
"model_name": "<MODEL_NAME>",
"model_category": "chat"
}'
Path parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Current workspace ID, must be consistent with |
Request body¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Configuration name. |
|
string |
Yes |
Model name. |
|
string |
No |
Configuration description. |
|
string |
No |
Configuration status. |
|
string |
No |
Model source type. |
|
string |
No |
Model category. |
|
string |
No |
Provider reference. |
|
string |
No |
The configured display name. |
|
string |
No |
An existing connection resource reference. |
|
string |
No |
An existing credential reference. |
|
object |
No |
Model parameters. |
|
object |
No |
Structural definition of model parameters. |
|
string[] |
No |
Model capabilities. |
|
object |
No |
Model usage restrictions. |
|
string |
No |
Pricing configuration reference. |
|
object |
No |
Tag key-value pair. |
|
object |
No |
Annotation key-value pair. |
|
object |
No |
Extended metadata. |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Successful response¶
Returns 201 on success. data configured for new models.
{
"code": 0,
"data": {
"id": "mc_01",
"workspace_id": "ws_01",
"name": "销售分析模型",
"status": "active",
"source_kind": "workspace",
"model_category": "chat",
"model_name": "<MODEL_NAME>",
"version": 1,
"created_at": "2026-08-18T01:00:00Z",
"updated_at": "2026-08-18T01:00:00Z"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
Model configuration ID. |
|
string |
ID of the workspace to which it belongs. |
|
string |
Configuration name. |
|
string |
Configuration status. |
|
string |
Model source type. |
|
string |
Model category. |
|
string |
Model name. |
|
integer |
Configuration version. |
|
string |
Creation and update time. |
|
string |
Creation and update time. |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Error response¶
{
"code": 2,
"message": "模型配置参数无效"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The request body, resource reference, or model configuration field is invalid. |
Check request fields and reference IDs. |
|
|
Credentials are missing or invalid. |
Check API Key. |
|
|
The current identity does not have permission to create configurations in the workspace. |
Use valid credentials, or contact your administrator for authorization. |
|
|
Configuration ID or name conflict. |
Modify the logo or process the existing configuration. |
|
|
The model configuration service is unavailable. |
Try again later. |
Follow-up operations¶
Save data.id and reference the configuration in agent model binding.