Update administrative compute resource configuration¶
Update a target compute resource as a configured administrator and return the ordinary resource object.
PUT https://api.moi.matrixorigin.cn/v5/admin/compute-resources/{id}
Before you call this API¶
Prepare an identity configured as a compute specification administrator in this deployment and an accessible authentication Workspace. Workspace Owner status or a Genesis administration scope is insufficient. Replace example IDs with targets you are authorized to read or operate on. See Compute Instances.
Submit only fields you want to change. Omitted or null scalars retain their values; explicit zero values and empty strings are validated as updates. An empty worker_images array is rejected. Neither {} nor null is a reliable no-op: the current implementation may still clear status_message and update the timestamp.
Request parameters¶
curl -X PUT "https://api.moi.matrixorigin.cn/v5/admin/compute-resources/cr-example" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $AUTH_WORKSPACE_ID" \
-H "Content-Type: application/json" \
--data '{"description":"更新说明"}'
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes (in this example) |
A valid personal access token for an identity configured as a compute specification administrator in this deployment. |
|
string |
Yes |
One nonempty authentication Workspace, separate from the resource’s Workspace and the workspace_id list filter. |
|
string |
Yes |
Target resource ID. The service resolves its owning workspace from the administrative repository. |
|
string |
No |
Must not be empty after trimming whitespace. |
|
string |
No |
Saved verbatim; an explicit empty string clears the value. |
|
string |
No |
task or query. On submission, the final spec_id must reference an enabled specification of the matching kind; the specification is reapplied. |
|
string |
No |
Whitespace is trimmed, and the specification must exist. An explicit change requires an enabled specification of the matching kind. Specification values override legacy CPU/memory/GPU fields in the same request. |
|
integer |
No |
Final value must be greater than 0, in cores. Setting it alone does not synchronize cpu_milli. |
|
integer |
No |
Final value must be greater than 0, in GiB. Setting it alone does not synchronize memory_mib. |
|
integer |
No |
Final value must be at least 0. Setting it alone does not synchronize gpu_count. |
|
object (array of objects) |
No |
Replace the full image selection. Omission or null retains it; [] is validated and rejected. Cover every Worker type in the current ACTIVE catalog exactly once, with matching IDs, types, and platforms. is_default=true is not required. See common objects for nested fields. |
|
integer |
No |
Current update validation requires the final value to be 0. |
|
integer |
No |
Final value must be greater than 0 and at least min_replicas. This is a per-Worker-type limit. |
|
string |
No |
Legacy image field; an empty string clears it. This does not replace the full worker_images selection. |
|
string |
No |
Legacy image field; an empty string clears it. This does not replace the full worker_images selection. |
|
string |
No |
Must not be empty after trimming whitespace. The image selection platform must also match the image catalog. |
|
integer |
No |
Final value must be at least 0. An explicit 0 is retained; values above 60 are capped at 60. |
|
string |
No |
Omission or null retains the value. An explicit empty string clears both text and SHA. Nonempty text requires a Python Worker, a configured validator, and the capability enabled; current dynamic size, line-count, and source rules apply. |
Successful response¶
HTTP 200。
{
"code": "OK",
"msg": "OK",
"data": {
"id": "cr-example",
"workspace_id": "target-workspace",
"name": "示例实例",
"description": "更新说明",
"kind": "task",
"spec_id": "spec-example",
"cpu": 1,
"memory_gib": 4,
"gpu": 0,
"cpu_milli": 1000,
"memory_mib": 4096,
"gpu_count": 0,
"gpu_memory_mib": 0,
"gpu_cores": 0,
"min_replicas": 0,
"max_replicas": 2,
"current_replicas": 0,
"desired_replicas": 0,
"go_worker_image_id": "",
"python_worker_image_id": "",
"worker_images": [
{
"worker_type": "python-worker",
"image_id": "image-example",
"platform": "linux/amd64"
}
],
"platform": "linux/amd64",
"auto_suspend_minutes": 30,
"scale_reason": "",
"is_default": false,
"status": "IDLE",
"status_message": "",
"created_by": "creator-example",
"allowed_actions": [],
"created_at": "2026-11-12T07:00:00Z",
"updated_at": "2026-11-12T07:00:00Z"
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
OK on success. |
|
string |
OK on success. |
|
object |
Data returned by this API; see the fields below. |
|
string |
Compute instance ID. |
|
string |
The instance’s actual Workspace, separate from the authentication header. |
|
string |
Instance name. |
|
string |
Instance description; may be an empty string. |
|
string |
task or query. |
|
string |
Associated specification ID. |
|
integer |
Legacy CPU specification field, in cores; do not confuse it with cpu_milli. |
|
integer |
Legacy memory specification field, in GiB. |
|
integer |
Legacy GPU specification field. |
|
integer |
Specification CPU, in millicores. |
|
integer |
Specification memory, in MiB. |
|
integer |
Specification GPU count. |
|
integer |
Specification GPU memory, in MiB. |
|
integer |
Specification GPU core field. |
|
integer |
Configured minimum replica field; not the currently observed replica count. |
|
integer |
Replica limit for each Worker type, not a combined limit across all types. |
|
integer |
Aggregate current instance replica field; separate from per-type observations. |
|
integer |
Target instance replica field; does not indicate readiness. |
|
string |
Legacy Go Worker image ID; may be empty. |
|
string |
Legacy Python Worker image ID; may be empty. |
|
object (array of objects), optional |
Optional images selected by Worker type. See the item fields below. |
|
string |
Worker platform configuration. |
|
integer |
Configured automatic suspension delay in minutes; not a duration guarantee for this operation. |
|
string |
Most recent scaling or lifecycle reason. |
|
boolean |
Whether this is the default instance; may be false. |
|
string |
Parent instance state. Current models include IDLE, DEPLOYING, SCALING, ACTIVE, DRAINING, SUSPENDED, TERMINATING, ERROR, and others. Do not conflate this with Worker states. |
|
string |
Status text; may be empty. |
|
string, optional |
Echoes normalized dependency text when nonempty; not declared in current typed SDK models. |
|
string, optional |
Echoes the text’s SHA256 when nonempty; not declared in current typed SDK models. |
|
object, optional |
Declared optional observation object. Current list/update converters do not populate it, so it does not guarantee installation progress information. |
|
string |
Creating principal. |
|
string (array of strings) |
Regular resource projection; update results may contain []. Administrative lists remove this field. Do not use it to determine administrator eligibility. |
|
string, optional |
Most recent activation time in RFC3339; omitted when unrecorded. |
|
string, optional |
Most recent activity time in RFC3339; omitted when unrecorded. |
|
string |
Creation time in RFC3339. |
|
string |
Update time in RFC3339; not a caller-supplied concurrency version. |
See Shared objects for nested objects and omission rules.
Error responses¶
{"code": "INVALID_PARAMS", "msg": "invalid compute resource request", "data": null}
HTTP / code |
Conditions and handling |
|---|---|
400 / INVALID_PARAMS |
Required context is missing, JSON cannot be parsed, or a second JSON value is present. Unknown JSON properties are not currently rejected strictly; this does not mean those fields are supported. |
403 / ErrForbidden |
A classified rejection of administrator eligibility, principal, or Workspace access. |
503 / ErrServiceUnavailable |
A classified shared authorization unavailability error; does not cover every directory/configuration error. |
500 / ErrServer |
The current administrative handler uses the shared service mapping throughout. Missing resources and specification/parameter/dependency validation failures are not separately classified. The ordinary update API’s 404/409/UPDATE_UNAVAILABLE mappings do not apply. |
Field |
Type |
Description |
|---|---|---|
|
string |
Classified by the specific failure stage. |
|
string |
Error text; shared errors may be localized. |
|
null or omitted |
Direct compute errors use null. See error recovery for shared error formats. |
An error does not mean every stage was rolled back. See Errors and recovery.