Use one of the following methods to undeploy a model and delete the endpoint.

> [!NOTE]
> **Note:** You can only delete the endpoint after all models have been undeployed from it.

As a best practice, when replacing a model on an endpoint after shifting traffic
to a new model version (such as during automated CI/CD rollouts), wait at least
10--15 minutes after updating the traffic split to 100% before initiating
`undeploy-model`. This hold window allows in-flight inference requests to
complete and ensures regional routing configurations fully synchronize before
previous model resources are deallocated.

### Google Cloud console

1. Undeploy the model as follows:

   1. In the Google Cloud console, in the Agent Platform section, go
      to the **Endpoints** page.

      [Go to the Endpoints page](https://console.cloud.google.com/agent-platform/endpoints)
   2. Click the name and version ID of the model you want to undeploy to open
      its details page.

   3. On the row for your model, click
      **Actions** , and then click **Undeploy model from endpoint**.

   4. In the **Undeploy model from endpoint** dialog, click **Undeploy**.

   5. To delete additional models, repeat the preceding steps.

2. Optional: Delete the online inference endpoint as follows:

   1. In the Google Cloud console, in the **Gemini Enterprise Agent Platform** section,
      go to the **Online prediction** page.

      [Go to Online prediction](https://console.cloud.google.com/agent-platform/online-prediction/endpoints)
   2. Select the endpoint.

   3. To delete the endpoint, click
      **Actions** , and then click **Delete endpoint**.

### gcloud

1. List the endpoint IDs for all endpoints in your project:

   ```bash
   gcloud ai endpoints list \
       --project=PROJECT_ID \
       --region=LOCATION_ID
   ```

   Replace <var translate="no">PROJECT_ID</var> with your project name and
   <var translate="no">LOCATION_ID</var> with the region where you are using
   Gemini Enterprise Agent Platform.
2. List the model IDs for the models that are deployed to an endpoint:

   ```bash
   gcloud ai endpoints describe ENDPOINT_ID \
       --project=PROJECT_ID \
       --region=LOCATION_ID
   ```

   Replace <var translate="no">ENDPOINT_ID</var> with the endpoint ID.
3. Undeploy a model from the endpoint:

   ```bash
   gcloud ai endpoints undeploy-model ENDPOINT_ID \
       --project=PROJECT_ID \
       --region=LOCATION_ID \
       --deployed-model-id=DEPLOYED_MODEL_ID
   ```

   Replace <var translate="no">DEPLOYED_MODEL_ID</var> with the model ID.
4. Optional: Delete the online inference endpoint:

   ```bash
   gcloud ai endpoints delete ENDPOINT_ID \
       --project=PROJECT_ID \
       --region=LOCATION_ID
   ```