Set up Apigee API Management in Cloud Code for VS Code

This page applies to Apigee and Apigee hybrid.

View Apigee Edge documentation.

This page provides instructions for creating an Apigee API Management local development environment in Cloud Code for VS Code, which supports Gemini Code Assist for OpenAPI spec design and development. See Overview of local development with Apigee for features in the local development environment.

The setup process requires completion of both of these sections of this guide:

Depending on your use cases, also complete one or both of these sections:

Before you begin

To set up and use Apigee in VS Code, you need:

  1. A Google Cloud project to log into in your local development environment. The project does not need to be provisioned for Apigee in order to use Gemini Code Assist to develop API specs, but does need to be provisioned for Apigee to create an Apigee local workspace where you can develop and test API proxies. Apigee provisioning is also required to see any Apigee API hub APIs in the Apigee section of Cloud Code.
  2. (Recommended) API hub provisioned on your project. API hub is required for these features: If you do not want to add API hub to your project, you could associate the project with another project that has API hub enabled instead. See Attach a runtime project to an API hub for information on attaching a project to an API hub.
  3. The Required roles to use Gemini Code Assist in Apigee for actions you plan to perform. You must have the Service Usage Admin role on your user account for the project to set up Gemini Code Assist.
  4. Familiarity with VS Code, how to manage VS Code, and how to perform common actions such as accessing settings and installing extensions. See the VS Code documentation.

Install VS Code and the Cloud Code extension

This section provides the installation instructions for installing VS Code and the Cloud Code extension in VS Code. This is the first step in setting up local development for Apigee and is required to use any of the Apigee local development features, including Gemini Code Assist.

To install VS Code and the Cloud Code extension:

  1. Download and install Visual Studio Code (VS Code) on your local machine, if it is not already installed.
  2. Install the Cloud Code extension, as described in Install the Cloud Code extension. If you plan to manage API proxies in your local environment, install Docker as part of the process.
  3. (Recommended) Enable automatic updates for the Cloud Code extension. In Settings, search for Extensions: Auto Update and enable it for all extensions or for the Cloud Code extension individually.
  4. Restart VS Code.

Set up Gemini Code Assist for Apigee

Follow these steps to set up Gemini Code Assist for Apigee in your local development environment. Note the Required roles to use Gemini Code Assist in Apigee.

  1. Make sure you've completed the steps in Install VS Code and the Cloud Code extension, if not already completed.
  2. Install the Gemini Code Assist extension in VS Code.
  3. (Recommended) Enable automatic updates for the Gemini Code Assist extension. In Settings, search for Extensions: Auto Update and enable it for all extensions or for the Gemini Code Assist extension individually.
  4. If not already installed, install the gcloud CLI.
  5. Enable the Gemini for Google Cloud API for the project. You need the Service Usage Admin role to perform this step.
    gcloud services enable cloudaicompanion.googleapis.com --project=YOUR_PROJECT
  6. In VS Code, log in to your Google Cloud project in both the Gemini Code Assist and Cloud Code extensions. You can do this using either of these methods:
    • Manually add the project in your settings.json file:
      {
        "cloudcode.apigee.gemini.options": {
            "cloudcode.project": "YOUR_PROJECT",
            "geminicodeassist.project": "YOUR_PROJECT"
          ...
          }
        }
    • Select the project when prompted:

      If you open Gemini Code Assist chat and are not logged in to a project with Gemini enabled, you'll see a message to that effect with a way to log in. Select select a Google Cloud project to add the Project.
      Gemini Code Assist for Gemini Code Assist Chat missing project

      To select a project for Google Cloud from within the Apigee section of Cloud Code, expand the API hub section and click Cloud Code - No Project selected:
      Google Cloud no project

      Or, click the project name in the Cloud Code status bar and select the new project: Cloud Code status bar showing Apigee project
  7. Add any needed Required roles to use Gemini Code Assist in Apigee to your user account.
  8. If you want to be able to create an API proxy bundle from an OpenAPI spec and manage it in your local development environment, complete the steps in Set up your local development environment for API proxy development.

Required roles to use Gemini Code Assist in Apigee

You'll need the roles listed below to perform API design and testing steps using Gemini Code Assist:

Task Required Role(s)
Design APIs using Gemini Code Assist Gemini for Google Cloud User
Service Usage Consumer

See Grant IAM roles in a Google Cloud project for Gemini Code Assist.
Use enterprise context from your existing APIs in API hub when designing APIs Cloud API Hub Viewer
Edit API hub APIs Cloud API Hub Editor or Admin
Publish APIs to API hub Cloud API Hub Editor or Admin
Set up and manage a remote mock server to test APIs Artifact Registry Administrator
Cloud Build Service Account
Cloud Run Admin
Service Usage Admin

See IAM basic and predefined roles reference.

You must also have the gcloud CLI installed.

Set up API proxy development for Apigee local development

Complete the steps in this section if you want to use your local development environment for Apigee API proxy development and testing. Also complete these steps to be able to create an API proxy from an OpenAPI spec.

  1. Create an Apigee workspace.
  2. Install the Apigee Emulator.
  3. Add a container for deploying to the Apigee Emulator.

What's next

After completing the installation and setup steps, get started using Cloud Code: