Stay organized with collections Save and categorize content based on your preferences.


Google.Cloud.AIPlatform.V1 is a.NET client library for the Cloud AI Platform API.

Note: This documentation is for version 2.3.0 of the library. Some samples may not work with other versions.


Install the Google.Cloud.AIPlatform.V1 package from NuGet. Add it to your project in the normal way (for example by right-clicking on the project in Visual Studio and choosing "Manage NuGet Packages...").


When running on Google Cloud Platform, no action needs to be taken to authenticate.

Otherwise, the simplest way of authenticating your API calls is to download a service account JSON file then set the GOOGLE_APPLICATION_CREDENTIALS environment variable to refer to it. The credentials will automatically be used to authenticate. See the Getting Started With Authentication guide for more details.

Getting started

All operations are performed through the following client classes:

Clients in this API must be constructed with a regional endpoint. This can be done easily using the builder for a specific client (DatasetServiceClientBuilder for DatasetServiceClient for example). The following example shows how to list the datasets for a given project in the us-central1 region.

string region = "us-central1";
DatasetServiceClient client = new DatasetServiceClientBuilder
    Endpoint = $"{region}"

LocationName location = new LocationName(projectId, region);
PagedEnumerable<ListDatasetsResponse, Dataset> datasets = client.ListDatasets(location);
foreach (Dataset dataset in datasets)

Constructing schema values

Various aspects of the API use schemas which are represented using Google.Protobuf.WellKnownTypes.Value, which is a generic representation of a JSON value in Protocol Buffers.

Protocol Buffer messages are available for these schemas, and they can be converted to and from Value objects using the ValueConverter class, as shown below.

AutoMlImageClassificationInputs inputs = new AutoMlImageClassificationInputs
    ModelType = AutoMlImageClassificationInputs.Types.ModelType.Cloud,
    BaseModelId = "model-id",
    // Other properties
TrainingPipeline pipeline = new TrainingPipeline
    TrainingTaskInputs = ValueConverter.ToValue(inputs)
// Use pipeline in API calls such as PipelineServiceClient.CreateTrainingPipeline.