Vertex AI APIs on Google Distributed Cloud (GDC) air-gapped let you
programmatically integrate pre-trained machine learning models into your
applications and manage Vertex AI Workbench resources. Depending on
the service, you can interact with these APIs by using gRPC, REST, Python
client libraries, or the Kubernetes Resource Model (KRM).

## Service endpoint and discovery document

A service endpoint is required to interact programmatically with the
Vertex AI APIs.

### Get the Vertex AI Workbench endpoint and discovery document

The API endpoint for the Vertex AI Workbench KRM API is:

`https://ENDPOINT/apis/aiplatform.gdc.goog/v1`

Replace `ENDPOINT` with the API endpoint of the
Management API server.

To access the Vertex AI Workbench discovery document, perform one of
the following actions:

- Enter the endpoint URL in a browser.

- Run the `kubectl proxy` command in a tool such as curl to open a proxy to the
  Management API server on your local machine. After that command is running,
  enter the following URL in your browser:

  `http://127.0.0.1:8001/apis/aiplatform.gdc.goog/v1`.

### Get the pre-trained APIs endpoints

To get the endpoints for the pre-trained APIs,
[view service status and endpoints](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/vertex-ai-api-status.md.txt).

## REST, gRPC, KRM, and client libraries

You can access the pre-trained APIs using gRPC or one of the provided client
libraries. The client libraries are built on gRPC.

Alternatively, you access some pre-trained APIs using REST.

You can manage Vertex AI Workbench using its Kubernetes Resource
Model (KRM) API.

### Client libraries

Vertex AI provides Python client libraries for pre-trained APIs. The
following table shows a comparison of advantages and disadvantages of using
client libraries:

| Advantages | Disadvantages |
|---|---|
| Maintained by Google. Built-in authentication. Built-in retries. Efficient protocol buffer HTTP request body. | Not available for all programming languages. |

### REST

The OCR and Translation APIs support REST. For more
information, see the REST API references for these services:

- [OCR REST API reference](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/apis/vertex-ai/ocr/rest/overview.md.txt)

- [Translation REST API reference](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/apis/vertex-ai/translation/rest.md.txt)

> [!NOTE]
> **Note:** The Speech-to-Text and Vertex AI Workbench APIs don't support REST.

The following table shows a comparison of advantages and disadvantages of using
REST:

| Advantages | Disadvantages |
|---|---|
| Simple JSON interface. Well supported by many Google and third-party tools and libraries. | You must build your own client. You must implement authentication. You must implement retries. Less efficient JSON HTTP request body. <br /> REST streaming is not supported by these APIs. |

### gRPC

Pre-trained APIs support gRPC. For more information about the generic
descriptions of the types, methods, and fields generated for a gRPC library, see
the following gRPC reference:

- [OCR gRPC reference](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/apis/vertex-ai/ocr/rpc.md.txt)
- [Speech-to-Text gRPC reference](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/apis/vertex-ai/speech-to-text/rpc.md.txt)
- [Translation gRPC reference](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/apis/vertex-ai/translation/rpc.md.txt)

> [!NOTE]
> **Note:** The Vertex AI Workbench API doesn't support gRPC.

The following table shows a comparison of advantages and disadvantages of using
gRPC:

| Advantages | Disadvantage |
|---|---|
| Supports many programming languages. Efficient protocol buffer HTTP request body. | You must generate your own client from Google-supplied protocol buffers. You must implement authentication. You must implement retries. |

### KRM

The Vertex AI Workbench API supports KRM. For more information, see
the [Vertex AI Workbench KRM API reference](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/apis/vertex-ai/workbench/krm/vertex-ai-workbench-krm-ref.md.txt).

## Type, method, and field names

Depending on whether you are using client libraries, REST, gRPC, or KRM, the
type, method, and field names for the API vary in the following ways:

- REST is arranged by resource hierarchies and their methods.
- Client libraries and gRPC are arranged by services and their methods.
- KRM field names use camelCase, but the API service accepts either camelCase or snake_case.
- REST and gRPC field names use snake_case.
- Client library field names use either title case, camelCase, or snake_case, depending on which name is idiomatic for the language.

## REST and protocol buffers

When calling the REST API, the default value behavior for protocol
buffers might result in missing fields in a JSON response. These fields are
set to the default value, so they are not included in the response.