update_ai_model¶
- ArtificialIntelligenceApi.update_ai_model(model_id, action, role_id, ai_model_update_input=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
Update model status or parameters
Five mutations on a single model, selected by the required action query parameter. All of them are synchronous - a 200 means the change is persisted. enable - creates or refreshes the model’s cost inference profile, test-invokes the model, flips ModelStatus to Enabled and writes the model’s modality entries disable - refuses while the model is still referenced: if it is allow(listed for any component), or used as a knowledge base embedding model, or bound to an agent, GE-1034 is returned as a 400 naming the blocking resources. Otherwise the Bedrock inference profile is deleted, cost tag metadata is cleaned up, the status flips to Disabled and the modality entries are removed. Idempotent: disabling an already-disabled model returns 200 with “AI model is already disabled” and changes nothing. update_parameters - the entire request body is the parameter map. Each inference parameter value must be sent as a string holding a Python literal (for example “0.5”, “4096”, “[’\n\nHuman:’]”). A non-stringvalue returns IPV-1004. Parameters are validated by test-invoking the model before they are persisted, so an invalid combination fails the call rather than the next invocation. Effort and AdaptiveThinking are handled separately from the inference parameters and are each validated by their own test invoke. Sending only Effort and/or AdaptiveThinking leaves existing parameters untouched. Setting Effort on a model whose AdaptiveThinking is (or is being set) false returns IPV-1004. A successful update marks the values as user-owned so an ordinary PUT /ai/models?action=sync preserves them; force_sync resets them. set_default_inference_type - requires InferenceType in the body. The model must be Enabled and the value must appear in the model’s InferenceTypesSupported; INFERENCE_PROFILE additionally requires the model to already carry InferenceProfileDetails. Anything else returns IPV-1004 or IPV-1001 as a 400. update_cost_tags - requires CostTags in the body (an empty array is valid and means “no cost tags”). Omitting the key entirely returns IPV-1001. Recreates the model’s cost inference profile with the new tags and cascades the change to every agent using the model. Any other action value returns IPV-1041 as a 400.
- Parameters:
model_id (str) – Bedrock model identifier as stored by Amorphic, for example anthropic.claude-sonnet-4-6. An unknown model_id returns IPV-1002 as a 500, not a 404. (required)
action (str) – Mutation to perform. enable and disable change ModelStatus; update_parameters replaces the inference parameters, adaptive thinking toggle and effort levels; set_default_inference_type sets DefaultInferenceType; update_cost_tags replaces the model’s cost tags. Any other value returns IPV-1041 as a 400. (required)
role_id (str) – User role id (required)
ai_model_update_input (AIModelUpdateInput) – Action-dependent. Required for update_parameters (a flat map of parameter names to string values, optionally with Effort and AdaptiveThinking), set_default_inference_type (InferenceType), and update_cost_tags (CostTags). Optional for enable (CostTags). Unused for disable.
_request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
_request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
_content_type (str, Optional) – force content-type for the request.
_headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
_host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
- Return type:
- Returns:
Returns the result object.
Request and Response Examples¶
HTTP: PUT /ai/models/{model_id}
Request¶
Action-dependent. Required for update_parameters (a flat map of parameter names to string values, optionally with Effort and AdaptiveThinking), set_default_inference_type (InferenceType), and update_cost_tags (CostTags). Optional for enable (CostTags). Unused for disable.
The request body is optional.
action=enable
{
"CostTags": [
{
"TagKey": "BusinessUnit",
"TagValue": "analytics"
}
]
}
action=update_parameters, inference parameters as strings
{
"temperature": "0.5",
"top_p": "0.9",
"max_tokens": "4096"
}
action=update_parameters, adaptive thinking only
{
"AdaptiveThinking": "true",
"Effort": [
"low",
"medium",
"high"
]
}
action=set_default_inference_type
{
"InferenceType": "INFERENCE_PROFILE"
}
action=update_cost_tags
{
"CostTags": [
{
"TagKey": "BusinessUnit",
"TagValue": "analytics"
},
{
"TagKey": "CostCenter",
"TagValue": "4821"
}
]
}
Success (HTTP 200)¶
The requested change is persisted. Message identifies which change was applied; the already-disabled variant means no change was made.
action=enable
{
"Message": "AI model enabled successfully"
}
action=disable
{
"Message": "AI model disabled successfully"
}
action=disable on a model that was not enabled - no change made
{
"Message": "AI model is already disabled"
}
action=update_parameters
{
"Message": "AI model parameters updated successfully"
}
action=set_default_inference_type
{
"Message": "AI model default inference type updated successfully"
}
action=update_cost_tags
{
"Message": "Cost tags updated successfully"
}
Errors¶
Documented error codes: IPV-1041, IPV-1001, IPV-1004, GE-1034, AUTH-1014, DB-1002, GE-1032, IPV-1002, GE-1008.
HTTP 400
Input validation or dependency failure. Body is {“Message”: “<CODE> - <text>”}. Codes: IPV-1041 (unknown action), IPV-1001 (InferenceType or CostTags missing for the chosen action), IPV-1004 (non-string parameter value, parameter or effort validation failed at test invoke, model not enabled for set_default_inference_type, unsupported inference type, or effort set on a model without adaptive thinking), GE-1034 (disable blocked by component, knowledge base or agent dependencies). AUTH-1014 from the role check is also returned here, not as a 403.
Model is still allow-listed for components
{
"Message": "GE-1034 - Model is configured in the following components: Agents, SQL AI. Please update the component configurations before disabling the model."
}
invalidParameterValue
{
"Message": "IPV-1004 - Model parameter values should be strings"
}
unsupportedInferenceType
{
"Message": "IPV-1004 - Invalid inference type: INFERENCE_PROFILE. Supported inference types: ON_DEMAND"
}
costTagsMissing
{
"Message": "IPV-1001 - Parameter CostTags is a required value."
}
HTTP 500
Backend failure. Body is {“Message”: “<CODE> - <text>”}. Codes: DB-1002 (models table write failed, or cost inference profile could not be created), GE-1032 (inference profile deletion failed while disabling), IPV-1002 (unknown model_id — returned as 500, not 404), GE-1008 (catch-all).
modelNotFound
{
"Message": "IPV-1002 - Invalid Model - anthropic.claude-does-not-exist, resource not found."
}
updateFailed
{
"Message": "DB-1002 - Failed to update entry in the dynamoDB table, please check for errors."
}