# Update model configuration

Partially update the agent model configuration. Each successful update increments the configuration version.

```text
PATCH https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/model-configs/{model_config_id}
```

## Before you call

First [Query model configuration details](get-model-configuration.md)confirm the current fields and versions. 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 the `X-API-Key` Header.
- `$WORKSPACE_ID`: Target workspace ID, passed through the `X-Workspace-ID` Header and also as `workspace_id` in the path.
- `$MODEL_CONFIG_ID`: Model configuration ID to update.

## Request example

```bash
curl -X PATCH "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/model-configs/$MODEL_CONFIG_ID" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "capabilities": ["tool_calling"],
    "parameters": {
      "temperature": 0.2
    }
  }'
```

## Path parameters

| Parameters | Type | Is it required | Description |
| --- | --- | --- | --- |
| `workspace_id` | string | Yes | The current workspace ID. |
| `model_config_id` | string | Yes | Model configuration ID. |

## Request body

All fields are optional, submit only the fields that need to be updated.

| Field | Type | Is it required | Description |
| --- | --- | --- | --- |
| `name` | string | No | Configuration name, description, and display name. |
| `description` | string | No | Configuration name, description, and display name. |
| `display_name` | string | No | Configuration name, description, and display name. |
| `status` | string | No | Configuration status, source type, and model category. |
| `source_kind` | string | No | Configuration status, source type, and model category. |
| `model_category` | string | No | Configuration status, source type, and model category. |
| `provider_ref` | string | No | Provider reference and model name. |
| `model_name` | string | No | Provider reference and model name. |
| `connection_ref` | string | No | Connection and credential reference. |
| `credential_ref` | string | No | Connection and credential reference. |
| `parameters` | object | No | Model parameters, parameter schema, and constraints. |
| `parameter_schema` | object | No | Model parameters, parameter schema, and constraints. |
| `limits` | object | No | Model parameters, parameter schema, and constraints. |
| `capabilities` | string[] | No | Model capability list. |
| `pricing_ref` | string | No | Billing information reference. |
| `labels` | object | No | String key-value labels and annotations. |
| `annotations` | object | No | String key-value labels and annotations. |
| `metadata` | object | No | Other metadata. |

`[]` after a type denotes an array. `[]` in a field path denotes each item in an array.


## Successful response

When successful, `200` is returned, and `data` is the updated configuration. Save the new `data.version` to avoid treating the old configuration state as the current state.

```json
{
  "code": 0,
  "data": {
    "id": "mc_01",
    "workspace_id": "ws_01",
    "name": "销售分析模型",
    "status": "active",
    "source_kind": "workspace",
    "model_category": "chat",
    "model_name": "<MODEL_NAME>",
    "capabilities": ["tool_calling"],
    "version": 2,
    "updated_at": "2026-08-18T02:00:00Z"
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | `0` on success. |
| `data.id` | string | Model configuration ID. |
| `data.name` | string | The updated configuration name. |
| `data.status` | string | Updated status, source type and model category. |
| `data.source_kind` | string | Updated status, source type and model category. |
| `data.model_category` | string | Updated status, source type and model category. |
| `data.model_name` | string | The updated model name. |
| `data.parameters` | object or string[] | Updated parameters, capabilities, and limitations; returned only if there is a value. |
| `data.capabilities` | object or string[] | Updated parameters, capabilities, and limitations; returned only if there is a value. |
| `data.limits` | object or string[] | Updated parameters, capabilities, and limitations; returned only if there is a value. |
| `data.version` | integer | Updated configuration version. |
| `data.updated_at` | string | Update time. |

`[]` after a type denotes an array. `[]` in a field path denotes each item in an array.


## Error response

```json
{
  "code": 2,
  "message": "模型配置参数无效"
}
```

### Common HTTP errors

```{list-table}
:header-rows: 1
:widths: 12 22 32 34

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `2`（`INVALID_ARGUMENT`）
  - Invalid request body, connection, or credential reference.
  - Check request fields and reference IDs.
* - `401`
  - `6`（`UNAUTHENTICATED`）
  - Credentials are missing or invalid.
  - Check API Key.
* - `403`
  - `5`（`PERMISSION_DENIED`）
  - The current identity does not have update permissions.
  - Use valid credentials, or contact your administrator for authorization.
* - `404`
  - `3`（`NOT_FOUND`）
  - The model configuration does not exist.
  - First query the model configuration list.
* - `409`
  - `4`（`ALREADY_EXISTS`）
  - The updated configuration conflicts with the existing configuration.
  - Modify the update content and try again.
* - `503`
  - `15`（`UNAVAILABLE`）
  - The model configuration service is unavailable.
  - Try again later.
```

## Follow-up operations

Use [Query model configuration details](get-model-configuration.md) to confirm the current fields and versions.
