Halaman ini memberikan petunjuk untuk membuat lingkungan pengembangan lokal Pengelolaan API Apigee di Cloud Code untuk VS Code, yang mendukung Gemini Code Assist untuk desain dan pengembangan spesifikasi OpenAPI.
Lihat
Ringkasan pengembangan lokal dengan Apigee untuk mengetahui fitur di lingkungan pengembangan lokal.
Proses penyiapan memerlukan penyelesaian kedua bagian panduan ini:
Untuk menyiapkan dan menggunakan Apigee di VS Code, Anda memerlukan:
Project Google Cloud untuk login di lingkungan pengembangan lokal Anda. Project tidak perlu disediakan untuk Apigee agar dapat menggunakan Gemini Code Assist untuk mengembangkan spesifikasi API, tetapi perlu disediakan untuk Apigee agar dapat membuat ruang kerja lokal Apigee tempat Anda dapat mengembangkan dan menguji proxy API. Penyediaan Apigee juga diperlukan untuk melihat API
API hub Apigee di bagian Apigee pada Cloud Code.
(Direkomendasikan) Hub API yang disediakan
di project Anda. Hub API diperlukan untuk fitur berikut:
Jika tidak ingin menambahkan hub API ke project, Anda dapat mengaitkan project
dengan project lain yang telah mengaktifkan hub API. Lihat
Melampirkan project runtime ke hub API untuk mengetahui informasi tentang cara melampirkan project ke hub API.
Memahami VS Code, cara mengelola VS Code, dan cara melakukan tindakan umum seperti
mengakses setelan dan menginstal ekstensi. Lihat
dokumentasi VS Code.
Menginstal VS Code dan ekstensi Cloud Code
Bagian ini memberikan petunjuk penginstalan untuk menginstal VS Code dan
ekstensi Cloud Code di VS Code. Ini adalah langkah pertama dalam menyiapkan pengembangan lokal untuk Apigee dan diperlukan untuk menggunakan fitur pengembangan lokal Apigee, termasuk Gemini Code Assist.
Instal ekstensi Cloud Code, seperti yang dijelaskan dalam
Menginstal ekstensi Cloud Code. Jika Anda berencana mengelola
proxy API di lingkungan lokal, instal Docker sebagai bagian dari proses.
(Direkomendasikan) Aktifkan update otomatis untuk ekstensi Cloud Code. Di
Setelan, telusuri Ekstensi: Update Otomatis dan aktifkan untuk semua ekstensi
atau untuk ekstensi Cloud Code satu per satu.
(Direkomendasikan) Aktifkan update otomatis untuk ekstensi Gemini Code Assist. Di
Setelan, telusuri Ekstensi: Update Otomatis dan aktifkan untuk semua ekstensi
atau untuk ekstensi Gemini Code Assist satu per satu.
Di VS Code, login ke project Google Cloud Anda di ekstensi Gemini Code Assist dan Cloud Code sekaligus. Anda dapat melakukannya menggunakan salah satu metode berikut:
Tambahkan project secara manual di file settings.json Anda:
Jika Anda membuka chat Gemini Code Assist dan tidak login ke project dengan Gemini diaktifkan, Anda akan melihat pesan yang menyatakan hal tersebut dengan cara untuk login.
Pilih pilih Google Cloud project untuk menambahkan Project.
Untuk memilih project untuk Google Cloud dari dalam bagian Apigee di Cloud Code,
luaskan bagian API hub, lalu klik Cloud Code - No Project selected:
Atau, klik nama project di status bar Cloud Code, lalu pilih project baru:
Menyiapkan pengembangan proxy API untuk pengembangan lokal Apigee
Selesaikan langkah-langkah di bagian ini jika Anda ingin menggunakan lingkungan pengembangan lokal untuk
pengembangan dan pengujian proxy API Apigee. Selesaikan juga langkah-langkah berikut agar dapat membuat
proxy API dari spesifikasi OpenAPI.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-03 UTC."],[[["\u003cp\u003eThis page provides instructions for setting up Cloud Code for Apigee and Apigee hybrid API management in Visual Studio Code (VS Code).\u003c/p\u003e\n"],["\u003cp\u003eInstallation involves downloading VS Code, installing the Cloud Code extension with Docker, restarting VS Code, and setting up an Apigee workspace and emulator.\u003c/p\u003e\n"],["\u003cp\u003eGemini Code Assist, a preview feature, can be used with Cloud Code and Apigee by enabling the Gemini for Google Cloud API and granting appropriate Identity and Access Management roles.\u003c/p\u003e\n"],["\u003cp\u003eVS Code supports integration with various source control management providers like Git for managing code versions, also allowing for more extension in the marketplace.\u003c/p\u003e\n"],["\u003cp\u003eAfter setting up cloud code, you can access and explore API management, build and deploy API proxies, or seek support through GitHub or Stack Overflow.\u003c/p\u003e\n"]]],[],null,["# Set up Apigee API Management in Cloud Code for VS Code\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\n\nThis page provides instructions for creating an Apigee API Management local development\nenvironment in [Cloud Code for VS Code](/code/docs/vscode), which supports\nGemini Code Assist for OpenAPI spec design and development.\nSee [Overview of local development with Apigee](/apigee/docs/api-platform/local-development/overview) for features in the local development environment.\n\nThe setup process requires completion of both of these sections of this guide:\n\n- [Before you begin](#before-you-begin)\n- [Install VS Code and the Cloud Code extension](#install)\n\n\nDepending on your use cases, also complete one or both of these sections:\n\n- [Set up Gemini Code Assist for Apigee in\n Cloud Code](#set-up-gemini)\n- [Set up API proxy development for Apigee\n local development](#set-up-proxy-development)\n\nBefore you begin\n----------------\n\nTo set up and use Apigee in VS Code, you need:\n\n1. 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](/apigee/docs/apihub/what-is-api-hub) APIs in the Apigee section of Cloud Code.\n2. (Recommended) [API hub](/apigee/docs/apihub/what-is-api-hub) provisioned on your project. API hub is required for these features:\n - [Enterprise context](/apigee/docs/api-platform/local-development/vscode/develop-design-edit-apis#enterprise-context) when generating OpenAPI specs.\n - Creation of a [remote mock server](/apigee/docs/api-platform/local-development/vscode/develop-design-edit-apis#use-remote-mock-server) for testing API specs.\n\n 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](/apigee/docs/apihub/auto-register-apigee-proxies#attach-a-runtime-project) for information on attaching a project to an API hub.\n3. The [Required roles to use\n Gemini Code Assist in Apigee](#required-roles-to-use-gemini-code-assist-in-apigee) for actions you plan to perform. You must have the [Service Usage Admin](/service-usage/docs/access-control#predefined_roles) role on your user account for the project to set up Gemini Code Assist.\n4. 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](https://code.visualstudio.com/docs).\n\nInstall VS Code and the Cloud Code extension\n--------------------------------------------\n\nThis section provides the installation instructions for installing VS Code and the\nCloud Code extension in VS Code. This is the first step in setting up local development for\nApigee and is required to use any of the Apigee local development\nfeatures, including Gemini Code Assist.\n\nTo install VS Code and the Cloud Code extension:\n\n1. Download and install **[Visual Studio Code (VS Code)](https://code.visualstudio.com)** on your local machine, if it is not already installed.\n2. Install the Cloud Code extension, as described in [Install the Cloud Code extension](/code/docs/vscode/install). If you plan to manage [API proxies](/apigee/docs/api-platform/fundamentals/understanding-apis-and-api-proxies#howdoyoucreateanapiproxy) in your local environment, install Docker as part of the process.\n3. (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.\n4. Restart VS Code.\n\nSet up Gemini Code Assist for Apigee\n------------------------------------\n\nFollow these steps to set up\n[Gemini Code Assist for Apigee](/apigee/docs/api-platform/local-development/overview#gemini-apigee-local-dev) in your local\ndevelopment environment. Note the [Required roles to use Gemini Code Assist in Apigee](#required-roles-to-use-gemini-code-assist-in-apigee).\n\n1. Make sure you've completed the steps in [Install VS Code and the Cloud Code extension](/apigee/docs/api-platform/local-development/setup#install), if not already completed.\n2. Install the Gemini Code Assist extension in VS Code.\n3. (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.\n4. If not already installed, install the [gcloud CLI](https://cloud.google.com/sdk/docs/install).\n5. Enable the Gemini for Google Cloud API for the project. You need the [Service Usage Admin](/service-usage/docs/access-control#predefined_roles) role to perform this step. \n\n ```scdoc\n gcloud services enable cloudaicompanion.googleapis.com --project=YOUR_PROJECT\n ```\n6. 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:\n - Manually add the project in your `settings.json` file: \n\n ```\n {\n \"cloudcode.apigee.gemini.options\": {\n \"cloudcode.project\": \"YOUR_PROJECT\",\n \"geminicodeassist.project\": \"YOUR_PROJECT\"\n ...\n }\n }\n ```\n - Select the project when prompted: \n\n 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. \n\n \u003cbr /\u003e\n\n 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** : \n\n \u003cbr /\u003e\n\n Or, click the project name in the Cloud Code status bar and select the new project:\n7. Add any needed [Required roles to use Gemini Code Assist in Apigee](#required-roles-to-use-gemini-code-assist-in-apigee) to your user account.\n8. 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\n development environment for API proxy development](#set-up-proxy-development).\n\n### Required roles to use Gemini Code Assist in Apigee\n\nYou'll need the roles listed below to perform API design and testing steps using\nGemini Code Assist:\n\nSet up API proxy development for Apigee\nlocal development\n---------------------------------------------------------\n\nComplete the steps in this section if you want to use your local development environment for\nApigee API proxy development and testing. Also complete these steps to be able to create\nan API proxy from an OpenAPI spec.\n\n1. [Create an Apigee workspace](/apigee/docs/api-platform/local-development/vscode/manage-apigee-workspace#creating_an_apigee_workspace).\n2. [Install the Apigee Emulator](/apigee/docs/api-platform/local-development/vscode/manage-apigee-emulator#install).\n3. [Add a container](/apigee/docs/api-platform/local-development/vscode/manage-apigee-emulator#adding_a_container_for_the_apigee_emulator) for deploying to the Apigee Emulator.\n\nWhat's next\n-----------\n\nAfter completing the installation and setup steps, get started using Cloud Code:\n\n- Complete the Gemini Code Assist tutorial for Apigee: [Tutorial: Use Gemini Code Assist to design, develop, and test APIs in Apigee and Cloud Code](/apigee/docs/api-platform/local-development/vscode/tutorial-gemini)\n- [Access and explore API Management in Cloud Code](/apigee/docs/api-platform/local-development/vscode/explore)\n- [Build and deploy your first API proxy in local development](/apigee/docs/api-platform/local-development/vscode/get-started)"]]