# Replace a service slot model configuration

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Completely replace a feature slot's model list and extra configuration. An empty list clears the slot; do not use this as a read-only probe.

```text
PUT https://api.moi.matrixorigin.cn/v5/admin/aistudio/service-slots/{slot_id}
```

## Before you call this API

Prepare a Genesis administrator Bearer token valid for the current environment. An ordinary personal access token, X-API-Key, or Workspace Owner status is insufficient. Session authentication also requires the corresponding CSRF protection. See [AI Studio](../../../../../developer/api/ai-studio/index.md). These are account-level administration operations and do not require a Workspace ID.

First have the deployment configuration operator confirm the slot's complete configuration and back up the configuration source. The list response omits deployment-side endpoint and cannot serve as a complete recovery backup. Updating a target slot currently rebuilds that configuration entry and may remove its existing endpoint. Verify writes only in an authorized, isolated test deployment.

Choose a real model ID of an allowed type from the candidates to replace model-example. The example {} represents extra JSON text only; it does not guarantee effects for specific extension keys. See [Writes and environments](write-recovery-environments.md) for clearing, ordering, and read-back after failures.

## Request parameters

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```bash
curl -X PUT "https://api.moi.matrixorigin.cn/v5/admin/aistudio/service-slots/agent_chat" \
  -H "Authorization: Bearer $GENESIS_ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"default_model_id":"model-example","model_ids":["model-example"],"extra_json":"{}"}'
```

:::::
:::::{tab-item} Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `Authorization` | string | Yes for the Bearer example | Bearer followed by the current environment's administrator token. Do not also send X-API-Key. |
| `slot_id` | string | Yes | Path field obtained from the slot list. |
| Request body `slot_id` | string | No | When supplied, must match the slot selected in the path. |
| `default_model_id` | string | No | For a nonempty model list, omission/whitespace selects the first item. A nonempty value must appear in model_ids. |
| `model_ids` | string (array of strings) | According to the target configuration | Complete list. Omission, null, [], or whitespace-only items may clear it. |
| `extra_json` | string | No | Valid JSON text or an empty string. Omission/an empty string does not preserve the previous value. |
| `models` | object (array of objects) | Not used for writes | Compatibility parsing field; currently excluded from the write command. Cannot replace model_ids. |

:::::
::::::
:::::::

## Successful response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "slot_id": "agent_chat",
  "name": "Agent chat",
  "frontend_behavior": "selectable",
  "allowed_model_types": [
    "chat_text",
    "chat_multimodal"
  ],
  "configured": true,
  "default_model_id": "model-example",
  "models": [
    {
      "id": "model-example",
      "name": "model-example",
      "type": "",
      "position": 0
    }
  ],
  "default_model_name": "model-example",
  "extra_json": "{}"
}
```

:::::
:::::{tab-item} Fields

| Field | Type | Description |
| --- | --- | --- |
| `slot_id` | string | Feature slot identifier. |
| `name` | string | Name in the currently registered definition. |
| `frontend_behavior` | string | hidden or selectable; describes whether the frontend allows users to choose a model. |
| `allowed_model_types` | string (array of strings) | Catalog model types allowed for assignment. |
| `configured` | boolean | Whether a nonempty model list is configured; does not indicate model health or whether current credentials can call it. |
| `default_model_id` | string | Default model ID; an empty string when unconfigured. |
| `default_model_name` | string | Optional; currently displayed as the model ID. |
| `models` | object (array of objects) | Ordered model list; empty when unconfigured. |
| `models[].id` | string | Candidate catalog model ID. |
| `models[].name` | string | Currently projected name. |
| `models[].type` | string | The list may supplement this from the catalog; write responses may currently use an empty string. |
| `models[].position` | integer | Zero-based position in the list. |
| `extra_json` | string | Optional extra JSON text, not a JSON object field. |

:::::
::::::
:::::::

## Error responses

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": "ErrForbidden",
  "msg": "Forbidden"
}
```

:::::
:::::{tab-item} Fields

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | Current error code. |
| `msg` | string | Description of the current failure stage; this example uses HTTP Forbidden text. |

| HTTP / code | Conditions and handling |
| --- | --- |
| 400 / ErrParamInvalid | Invalid slot, model, default, JSON text, or log-count parameter. |
| 401 / Unauthorized | Invalid identity or an inapplicable authentication method such as X-API-Key. |
| 403 / ErrForbidden | No Genesis administrator eligibility. |
| 503 / ErrServiceUnavailable | Classified required identity/configuration dependencies are unavailable. |
| 500 / ErrServer or InternalServerError | Internal or identity-stage failure. Read back after a write error rather than assuming rollback. |

Errors use code/msg, whereas success returns a raw object. Different failure stages may use different string codes; do not assume a distinct machine reason for every validation error.

:::::
::::::
:::::::
