Skip to main content

io.enterpriseai.resources.ModelsClient

Source: sdks/java/enterprise-ai-java/src/main/java/io/enterpriseai/resources/ModelsClient.java. Back to the Java SDK reference index.

note

This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.

Class ModelsClient​

Model registry, lifecycle status and Capability Resolver.

Constructor ModelsClient​

ModelsClient(Transport transport)

Creates the client on the shared transport; EnterpriseAIClient builds it and exposes it through the accessor of the same name.

NameTypeDefaultRequiredDescription
transportTransportyesTransport shared by the sub-clients of one client.

ModelsClient.approveVersion​

JsonNode approveVersion(String modelId, String version, Object body)

Request the approval of a version. Opens an approval request (action model_version_activation) for a draft version and answers 202 with its id; the version becomes pending_approval. The approvers are tenant_admin and security_officer, and the requester cannot approve its own request (separation of duties). A version that is not a draft answers 409 model_version_state. Audited. Requires a tenant principal with tenant_admin or platform_admin.

Route: /v1/models/{model_id}/versions/{version}/approval (POST).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.
versionStringyesVersion to approve, as registered.
bodyObjectyesOptional {reason} shown to the approvers.

Returns: JsonNode. Decoded JSON answer of the operation "Request the approval of a version".

Raises: the typed errors of the transport (Errors).

ModelsClient.approveVersion​

JsonNode approveVersion(String modelId, String version, Object body, RequestOptions options)

Request the approval of a version. Opens an approval request (action model_version_activation) for a draft version and answers 202 with its id; the version becomes pending_approval. The approvers are tenant_admin and security_officer, and the requester cannot approve its own request (separation of duties). A version that is not a draft answers 409 model_version_state. Audited. Requires a tenant principal with tenant_admin or platform_admin.

Route: /v1/models/{model_id}/versions/{version}/approval (POST).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.
versionStringyesVersion to approve, as registered.
bodyObjectyesOptional {reason} shown to the approvers.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Request the approval of a version".

Raises: the typed errors of the transport (Errors).

ModelsClient.create​

JsonNode create(Object body)

Register a model. Registers a model for the tenant, or a shared one with scope: platform (platform_admin only), and answers 201. The body is a Model Manifest v1 or a bare spec; it must be valid (422 invalid_manifest) and its category must exist. A model id already registered in the same scope answers 409 model_exists. Audited (model.create). Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/models (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesA Model Manifest v1 (kind: Model, metadata, spec) or the spec alone (model_id, provider, provider_model_id, capabilities, context_window, status...), with the sheet fields, optional pricing and scope.

Returns: JsonNode. Decoded JSON answer of the operation "Register a model".

Raises: the typed errors of the transport (Errors).

ModelsClient.create​

JsonNode create(Object body, RequestOptions options)

Register a model. Registers a model for the tenant, or a shared one with scope: platform (platform_admin only), and answers 201. The body is a Model Manifest v1 or a bare spec; it must be valid (422 invalid_manifest) and its category must exist. A model id already registered in the same scope answers 409 model_exists. Audited (model.create). Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/models (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesA Model Manifest v1 (kind: Model, metadata, spec) or the spec alone (model_id, provider, provider_model_id, capabilities, context_window, status...), with the sheet fields, optional pricing and scope.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Register a model".

Raises: the typed errors of the transport (Errors).

ModelsClient.createCategory​

JsonNode createCategory(Object body)

Create a model category. Creates a category for the tenant, or a shared one with scope: platform (platform_admin only, 403 platform_only), and answers 201. A slug already used answers 409 category_exists; invalid fields 422 parameter_invalid. Audited. Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/llm/categories (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesslug (lowercase letters, digits, dashes and underscores, 1 to 40 characters, required), label (text or {en, fr}, 80 characters at most, required), description (500 characters at most), icon, sort_order (0 to 10000, default 100), scope (platform for a shared category).

Returns: JsonNode. Decoded JSON answer of the operation "Create a model category".

Raises: the typed errors of the transport (Errors).

ModelsClient.createCategory​

JsonNode createCategory(Object body, RequestOptions options)

Create a model category. Creates a category for the tenant, or a shared one with scope: platform (platform_admin only, 403 platform_only), and answers 201. A slug already used answers 409 category_exists; invalid fields 422 parameter_invalid. Audited. Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/llm/categories (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesslug (lowercase letters, digits, dashes and underscores, 1 to 40 characters, required), label (text or {en, fr}, 80 characters at most, required), description (500 characters at most), icon, sort_order (0 to 10000, default 100), scope (platform for a shared category).
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Create a model category".

Raises: the typed errors of the transport (Errors).

ModelsClient.createVersion​

JsonNode createVersion(String modelId, Object body)

Register a model version. Registers a version of the model in the tenant with status draft and answers 201. The version needs a licence (SPDX expression, or terms reference starting with https:// or LicenseRef-) and the weights provenance; invalid fields answer 422 model_version_invalid with their names, an existing version 409 model_version_exists. Audited (model.version.create). Requires a tenant principal with tenant_admin or platform_admin.

Route: /v1/models/{model_id}/versions (POST).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.
bodyObjectyesversion (1 to 64 characters: letters, digits, dots, dashes, underscores, plus), licence_spdx or licence_terms_ref, weights with source (https://, oci://, hf://, s3:// or registry://), digest (sha256: and 64 hex characters) and size_bytes (positive integer), optional capabilities (list of texts).

Returns: JsonNode. Decoded JSON answer of the operation "Register a model version".

Raises: the typed errors of the transport (Errors).

ModelsClient.createVersion​

JsonNode createVersion(String modelId, Object body, RequestOptions options)

Register a model version. Registers a version of the model in the tenant with status draft and answers 201. The version needs a licence (SPDX expression, or terms reference starting with https:// or LicenseRef-) and the weights provenance; invalid fields answer 422 model_version_invalid with their names, an existing version 409 model_version_exists. Audited (model.version.create). Requires a tenant principal with tenant_admin or platform_admin.

Route: /v1/models/{model_id}/versions (POST).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.
bodyObjectyesversion (1 to 64 characters: letters, digits, dots, dashes, underscores, plus), licence_spdx or licence_terms_ref, weights with source (https://, oci://, hf://, s3:// or registry://), digest (sha256: and 64 hex characters) and size_bytes (positive integer), optional capabilities (list of texts).
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Register a model version".

Raises: the typed errors of the transport (Errors).

ModelsClient.delete​

void delete(String modelId)

Delete a model from the registry. Deletes the tenant entry of the model (an override of a shared model brings the shared entry back), or the shared entry when there is no tenant entry; the shared entry needs platform_admin (403 platform_only). Answers 204; audited (model.delete). Unknown model: 404 model_not_found. Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/models/{model_id} (DELETE).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model (not the provider model id).

Returns: void.

Raises: the typed errors of the transport (Errors).

ModelsClient.deleteCategory​

void deleteCategory(String slug)

Delete a model category. Deletes a category created by the tenant or the platform and answers 204. A predefined category cannot be deleted (409 category_builtin), nor a category still used by a model (409 category_in_use); a shared category needs platform_admin (403 platform_only). Audited. Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/llm/categories/{slug} (DELETE).

NameTypeDefaultRequiredDescription
slugStringyesSlug of the category: lowercase letters, digits, dashes and underscores, 1 to 40 characters.

Returns: void.

Raises: the typed errors of the transport (Errors).

ModelsClient.disable​

JsonNode disable(String modelId)

Disable a model (kill switch). Kill switch of the model for the tenant: the gateway refuses it at once (403 model_disabled). On a shared model this creates a tenant override. Audited (model.disable). Requires tenant_admin, platform_admin, ai_platform_engineer or security_officer.

Route: /v1/models/{model_id}/disable (POST).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.

Returns: JsonNode. Decoded JSON answer of the operation "Disable a model (kill switch)".

Raises: the typed errors of the transport (Errors).

ModelsClient.enable​

JsonNode enable(String modelId)

Enable a disabled model. Lifts the kill switch of the model for the tenant. Audited (model.enable). Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/models/{model_id}/enable (POST).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.

Returns: JsonNode. Decoded JSON answer of the operation "Enable a disabled model".

Raises: the typed errors of the transport (Errors).

ModelsClient.get​

JsonNode get(String modelId)

Get a registered model. One model of the registry, or its Model Manifest v1 with format=manifest. Unknown model: 404 model_not_found. Requires a reader role.

Route: /v1/models/{model_id} (GET).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.

Returns: JsonNode. Decoded JSON answer of the operation "Get a registered model".

Raises: the typed errors of the transport (Errors).

ModelsClient.get​

JsonNode get(String modelId, Map<String, ?> query)

Get a registered model. One model of the registry, or its Model Manifest v1 with format=manifest. Unknown model: 404 model_not_found. Requires a reader role.

Route: /v1/models/{model_id} (GET).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.
queryMap<String, ?>yesQuery string parameters of the route.

Returns: JsonNode. Decoded JSON answer of the operation "Get a registered model".

Raises: the typed errors of the transport (Errors).

ModelsClient.getCategory​

JsonNode getCategory(String slug)

Get a model category. One model category with its number of models. Unknown slug: 404 category_not_found. Requires a reader role.

Route: /v1/llm/categories/{slug} (GET).

NameTypeDefaultRequiredDescription
slugStringyesSlug of the category.

Returns: JsonNode. Decoded JSON answer of the operation "Get a model category".

Raises: the typed errors of the transport (Errors).

ModelsClient.importModels​

JsonNode importModels(Object body)

Import discovered models. Registers the models chosen in a discovery. Idempotent: the ones already registered (same id, or same provider and provider model id) are skipped and listed with already_registered. Every item is checked first; one invalid item refuses the whole import with 422 import_invalid and the problem of each item. Each model and the import are audited. Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/models/import (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesprovider_id (provider id or name, required), models (1 to 200 objects from the discovery: provider_model_id and the optional registry id, category and sheet fields), optional scope (platform).

Returns: JsonNode. Decoded JSON answer of the operation "Import discovered models".

Raises: the typed errors of the transport (Errors).

ModelsClient.importModels​

JsonNode importModels(Object body, RequestOptions options)

Import discovered models. Registers the models chosen in a discovery. Idempotent: the ones already registered (same id, or same provider and provider model id) are skipped and listed with already_registered. Every item is checked first; one invalid item refuses the whole import with 422 import_invalid and the problem of each item. Each model and the import are audited. Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/models/import (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesprovider_id (provider id or name, required), models (1 to 200 objects from the discovery: provider_model_id and the optional registry id, category and sheet fields), optional scope (platform).
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Import discovered models".

Raises: the typed errors of the transport (Errors).

ModelsClient.list​

Page<JsonNode> list()

List the registered models. Models visible to the caller (shared models with the tenant overrides applied, and the tenant models), optionally filtered. One page only (next_cursor is always null). Requires a reader role.

Route: /v1/models (GET).

This element takes no parameter.

Returns: Page<JsonNode>. A Page: One page of a cursor paginated collection ({"items": [...], "next_cursor": "..."|null}).

Raises: the typed errors of the transport (Errors).

ModelsClient.list​

Page<JsonNode> list(Map<String, ?> query)

List the registered models. Models visible to the caller (shared models with the tenant overrides applied, and the tenant models), optionally filtered. One page only (next_cursor is always null). Requires a reader role.

Route: /v1/models (GET).

NameTypeDefaultRequiredDescription
queryMap<String, ?>yesQuery string parameters of the route.

Returns: Page<JsonNode>. A Page: One page of a cursor paginated collection ({"items": [...], "next_cursor": "..."|null}).

Raises: the typed errors of the transport (Errors).

ModelsClient.listCategories​

JsonNode listCategories()

List the model categories. Model categories visible to the caller (predefined, shared and tenant ones) with their label and description in English and French, icon, order and number of models using them. One page only. Requires a reader role.

Route: /v1/llm/categories (GET).

This element takes no parameter.

Returns: JsonNode. Decoded JSON answer of the operation "List the model categories".

Raises: the typed errors of the transport (Errors).

ModelsClient.listVersions​

JsonNode listVersions(String modelId)

List the versions of a model. Versions of the model in the tenant, oldest first, with licence, weights source, digest and size, capabilities, status (draft, pending_approval, canary, active, superseded, rolled_back) and approval. Requires a tenant principal with tenant_admin, platform_admin, security_officer, finops, developer, auditor or viewer.

Route: /v1/models/{model_id}/versions (GET).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.

Returns: JsonNode. Decoded JSON answer of the operation "List the versions of a model".

Raises: the typed errors of the transport (Errors).

ModelsClient.resolve​

JsonNode resolve(Object body)

Resolve the native call parameters. Capability Resolver: translates normalized call parameters (for example the reasoning effort none, low, medium, high, max) into the native parameters of the model, from what its manifest declares. An unsupported value is rejected with an explicit code or adjusted with a warning in the answer, never silently. Unknown model: 404 model_not_found. Requires a reader role.

Route: /v1/models/resolve (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesmodel (or model_id) and the normalized parameters, either in params or at the top level of the body.

Returns: JsonNode. Decoded JSON answer of the operation "Resolve the native call parameters".

Raises: the typed errors of the transport (Errors).

ModelsClient.resolve​

JsonNode resolve(Object body, RequestOptions options)

Resolve the native call parameters. Capability Resolver: translates normalized call parameters (for example the reasoning effort none, low, medium, high, max) into the native parameters of the model, from what its manifest declares. An unsupported value is rejected with an explicit code or adjusted with a warning in the answer, never silently. Unknown model: 404 model_not_found. Requires a reader role.

Route: /v1/models/resolve (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesmodel (or model_id) and the normalized parameters, either in params or at the top level of the body.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Resolve the native call parameters".

Raises: the typed errors of the transport (Errors).

ModelsClient.rollback​

JsonNode rollback(String modelId, Object body)

Roll back a model version. During a canary, aborts it: the active version keeps all the traffic. Otherwise, restores the version that was active before the last full publication. The version left becomes rolled_back, the step is added to the rollout history and audited (model.rollout.rollback). Nothing to roll back: 409 model_rollback_unavailable. Requires a tenant principal with tenant_admin or platform_admin.

Route: /v1/models/{model_id}/rollback (POST).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.
bodyObjectyesOptional {reason} written to the rollout history and the audit trail.

Returns: JsonNode. Decoded JSON answer of the operation "Roll back a model version".

Raises: the typed errors of the transport (Errors).

ModelsClient.rollback​

JsonNode rollback(String modelId, Object body, RequestOptions options)

Roll back a model version. During a canary, aborts it: the active version keeps all the traffic. Otherwise, restores the version that was active before the last full publication. The version left becomes rolled_back, the step is added to the rollout history and audited (model.rollout.rollback). Nothing to roll back: 409 model_rollback_unavailable. Requires a tenant principal with tenant_admin or platform_admin.

Route: /v1/models/{model_id}/rollback (POST).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.
bodyObjectyesOptional {reason} written to the rollout history and the audit trail.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Roll back a model version".

Raises: the typed errors of the transport (Errors).

ModelsClient.rollout​

JsonNode rollout(String modelId)

Read the rollout of a model. Active version, canary version and canary share of the model in the tenant, with the whole rollout history (publish, canary, rollback, actor, reason, approval). Requires a tenant principal with tenant_admin, platform_admin, security_officer, finops, developer, auditor or viewer.

Route: /v1/models/{model_id}/rollout (GET).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.

Returns: JsonNode. Decoded JSON answer of the operation "Read the rollout of a model".

Raises: the typed errors of the transport (Errors).

ModelsClient.setStatus​

JsonNode setStatus(String modelId, Object body)

Change the status of a model. Sets the status to approved, restricted, deprecated or blocked (422 status_invalid otherwise). For a tenant, a promotion to approved is not applied at once: an approval request is opened and the answer is 202 with it; the status changes once it is approved. Other changes apply at once and are audited (model.status, with the previous and new status). Requires tenant_admin, platform_admin, ai_platform_engineer or security_officer.

Route: /v1/models/{model_id}/status (POST).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.
bodyObjectyesstatus (approved, restricted, deprecated or blocked) and an optional reason.

Returns: JsonNode. Decoded JSON answer of the operation "Change the status of a model".

Raises: the typed errors of the transport (Errors).

ModelsClient.setStatus​

JsonNode setStatus(String modelId, Object body, RequestOptions options)

Change the status of a model. Sets the status to approved, restricted, deprecated or blocked (422 status_invalid otherwise). For a tenant, a promotion to approved is not applied at once: an approval request is opened and the answer is 202 with it; the status changes once it is approved. Other changes apply at once and are audited (model.status, with the previous and new status). Requires tenant_admin, platform_admin, ai_platform_engineer or security_officer.

Route: /v1/models/{model_id}/status (POST).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.
bodyObjectyesstatus (approved, restricted, deprecated or blocked) and an optional reason.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Change the status of a model".

Raises: the typed errors of the transport (Errors).

ModelsClient.startRollout​

JsonNode startRollout(String modelId, String version, Object body)

Publish a model version. Publishes an approved version fully (canary_percent 100, default) or as a canary for 1 to 99 percent of the traffic, picked deterministically from the caller (same session or principal, same version). Requires a tenant principal with tenant_admin or platform_admin.

Route: /v1/models/{model_id}/versions/{version}/rollout (POST).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.
versionStringyesApproved version to publish.
bodyObjectyescanary_percent (integer 1 to 100, default 100) and an optional reason.

Returns: JsonNode. Decoded JSON answer of the operation "Publish a model version".

Raises: the typed errors of the transport (Errors).

ModelsClient.startRollout​

JsonNode startRollout(String modelId, String version, Object body, RequestOptions options)

Publish a model version. Publishes an approved version fully (canary_percent 100, default) or as a canary for 1 to 99 percent of the traffic, picked deterministically from the caller (same session or principal, same version). Requires a tenant principal with tenant_admin or platform_admin.

Route: /v1/models/{model_id}/versions/{version}/rollout (POST).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.
versionStringyesApproved version to publish.
bodyObjectyescanary_percent (integer 1 to 100, default 100) and an optional reason.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Publish a model version".

Raises: the typed errors of the transport (Errors).

ModelsClient.update​

JsonNode update(String modelId, Object body)

Update a registered model. Changes fields of the model spec, the sheet (category, display_name, knowledge_cutoff) or the prices; the model id never changes. A tenant change of a shared model creates a tenant override. The merged spec must stay a valid Model Manifest v1 (422 invalid_manifest) and the category must exist. Audited (model.update). Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/models/{model_id} (PATCH).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.
bodyObjectyesSpec fields to change, sheet fields and pricing (per million tokens: input_per_mtok, output_per_mtok, cached_input_per_mtok, cache_write_per_mtok; per unit: per_image, per_second, per_character; with a currency). Use POST .../status to change the status.

Returns: JsonNode. Decoded JSON answer of the operation "Update a registered model".

Raises: the typed errors of the transport (Errors).

ModelsClient.update​

JsonNode update(String modelId, Object body, RequestOptions options)

Update a registered model. Changes fields of the model spec, the sheet (category, display_name, knowledge_cutoff) or the prices; the model id never changes. A tenant change of a shared model creates a tenant override. The merged spec must stay a valid Model Manifest v1 (422 invalid_manifest) and the category must exist. Audited (model.update). Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/models/{model_id} (PATCH).

NameTypeDefaultRequiredDescription
modelIdStringyesRegistry identifier of the model.
bodyObjectyesSpec fields to change, sheet fields and pricing (per million tokens: input_per_mtok, output_per_mtok, cached_input_per_mtok, cache_write_per_mtok; per unit: per_image, per_second, per_character; with a currency). Use POST .../status to change the status.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Update a registered model".

Raises: the typed errors of the transport (Errors).

ModelsClient.updateCategory​

JsonNode updateCategory(String slug, Object body)

Update a model category. Changes the label, description, icon or order of a category; the slug never changes. A predefined category answers 409 category_builtin; a shared category needs platform_admin. Invalid values answer 422 parameter_invalid. Audited. Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/llm/categories/{slug} (PATCH).

NameTypeDefaultRequiredDescription
slugStringyesSlug of the category.
bodyObjectyesFields to change: label and description (a text, or {en, fr}; label 80 characters at most, description 500), icon (lowercase name of 1 to 48 characters, or null), sort_order (0 to 10000).

Returns: JsonNode. Decoded JSON answer of the operation "Update a model category".

Raises: the typed errors of the transport (Errors).