Apigee Samples

January 9, 2026 ยท View on GitHub


Intro

This repository contains a collection of sample API proxies that you can deploy and run on Apigee X or hybrid.

The samples provide a jump-start for developers who wish to design and create Apigee API proxies.

Audience

You are an Apigee API proxy developer, or you would like to learn about developing APIs that run on Apigee X & hybrid. At a minimum, we assume you're familiar with Apigee and how to create simple API proxies. To learn more, we recommend this getting started tutorial.

Before you begin

  1. See the full list of Prerequisites for installing Apigee.

  2. You'll need access to a Google Cloud Platform account and project. Sign up for a free GCP trial account.

  3. If you don't have one, you'll need to provision an Apigee instance. Create a free Apigee eval instance.

  4. Clone this project from GitHub to your system.

Using the sample proxies

Most developers begin by identifying an interesting sample based on a specific use case or need. You'll find all the samples in the root folder.

Samples

SampleDescriptionCloud Shell Tutorial
1deploy-apigee-proxyDeploy Apigee proxy using Apigee Maven plugin and Cloud BuildOpen in Cloud Shell
2deploy-apigee-sharedflowDeploy Apigee sharedflow using Apigee Maven plugin and Cloud BuildOpen in Cloud Shell
3deploy-apigee-configDeploy Apigee configurations using Apigee Maven plugin and Cloud BuildOpen in Cloud Shell
4authorize-idp-access-tokensAuthorize JWT access tokens issued by an Identity ProviderOpen in Cloud Shell
5oauth-client-credentialsA sample proxy which uses the OAuth 2.0 client credentials grant type flowOpen in Cloud Shell
6oauth-client-credentials-with-scopeA sample proxy which uses the OAuth 2.0 client credentials grant type flow and limit access using OAuth2 scopesOpen in Cloud Shell
7cloud-loggingA sample proxy that logs custom messages to Google Cloud LoggingOpen in Cloud Shell
8basic-cachingAn example showing how to cache responses and other data using Apigee's built in policiesOpen in Cloud Shell
9basic-quotaA sample which shows how to implement a basic API consumption quotaOpen in Cloud Shell
10apiproduct-operationsShows the behavior of API Product OperationsOpen in Cloud Shell
11cloud-runA sample proxy to invoke Cloud Run Service from ApigeeOpen in Cloud Shell
12integrated-developer-portalThis sample demonstrates how to create an Apigee Integrated portal and shows how to expose your API products to its catalogOpen in Cloud Shell
13drupal-developer-portalThis sample demonstrates how to create a Drupal developer portal using the GCP Marketplace and shows how to expose your Apigee API products to its catalogOpen in Cloud Shell
14exposing-to-internetThis sample demonstrates how to expose an Apigee instance to the internet using a Google Cloud external HTTP(S) Load BalancerOpen in Cloud Shell
15json-web-tokensThis sample demonstrates how to generate and verify JSON Web Tokens using the out of the box Apigee JWT policiesOpen in Cloud Shell
16corsThis sample lets you create an API that uses the cross-origin resource sharing (CORS) mechanism to allow requests from external webpages and applicationsOpen in Cloud Shell
17extract-variablesThis sample demonstrates how to extract variables and set headers using the out of the box Apigee AssignMessage and ExtractVariable policiesOpen in Cloud Shell
18websocketsThis sample shows how to deploy a sample websockets echo server in Cloud Run and how to use Apigee to expose that service to developers securelyOpen in Cloud Shell
19grpcThis sample shows how to deploy a sample gRPC Hello World application in Cloud Run and how to use Apigee to expose that service to developers securelyOpen in Cloud Shell
20mtls-northboundThis sample shows how to configure mTLS using a GCP Private CA (Certificate Authority) on an existing GLB (global load balancer).Open in Cloud Shell
21property-setThis sample lets you create an API that uses a property set and shows how to get data from it using a mediation policy (AssignMessage).Open in Cloud Shell
22data-deidentificationInvokes the Data Loss Prevention (DLP) API to perform data masking (de-identification) on JSON and XML payloads.Open in Cloud Shell
23publish-to-apigee-portalPublish OpenAPI Spec to Apigee Integrated Portal using Maven plugin and Cloud BuildOpen in Cloud Shell
24threat-protectionThreat Protection sample in ApigeeOpen in Cloud Shell
25composite-apiComposite API sample in ApigeeOpen in Cloud Shell
26cloud-functionsA sample proxy that connects to an app running in Cloud FunctionsOpen in Cloud Shell
27grpc-webA sample proxy that connects to a gRPC-Web service running in Cloud RunOpen in Cloud Shell
28monolith-to-microservices-based-on-pathsSample facade to facilitate the migration from a monolith to a microservice architecture.Open in Cloud Shell
29extension-processor-httpThis sample demonstrates how to use Apigee API Management with Google Cloud Load Balancer Service Extensions.Open in Cloud Shell
30extension-processor-grpcThis sample demonstrates how to use Apigee API Management with Google Cloud Load Balancer Service Extensions.Open in Cloud Shell
31java-calloutThis sample demonstrates how to use the Java Callout policy.Open in Cloud Shell
32mtls-southboundThis sample shows an mTLS southbound backend connection using an Apigee Keystore and Truststore.Open in Cloud Shell
33apihub-portal-publishShows how an unmanaged API can be onboarded to Apigee API hub, deployed as a managed Apigee proxy for secure access, and then published to the Apigee integrated developer portal.Open in Cloud Shell
34traffic-mirroring-sharedflowDemonstrates traffic mirroring (shadow traffic) using a shared flow to test new endpoints with production traffic without impacting the primary response. Useful for API migrations, blue-green deployments, and canary releases.Open in Cloud Shell
35spike-arrestA sample showing how to protect against traffic spikes using the Spike Arrest policy for traffic smoothingOpen in Cloud Shell

You can find video walkthroughs of many of these samples in this YouTube playlist

Samples for LLM Serving with Apigee

The rise of Large Language Models (LLMs) presents an unparalleled opportunity for AI productization, but also necessitates a robust platform to manage, scale, secure, and govern access to them. While specialized tools and platforms are emerging, organizations can leverage their existing investment in a best-in-class API Management platform like Apigee to effectively handle all their LLM serving needs.

Apigee X plays a crucial role in LLM serving by acting as an intermediary between clients and the LLM endpoints. It provides a secure, reliable, and scalable way to expose LLMs as APIs while offering essential features like:

  • Security: Authentication, authorization, rate limiting, and protection against attacks.
  • Reliability: Load balancing, circuit breaking, and failover mechanisms.
  • Performance: Caching, request/response transformation, and optimized routing.
  • Observability: Logging, monitoring, and tracing for troubleshooting and analysis.
  • Governance: API lifecycle management, versioning, and productization.

This repository explores common LLM serving patterns using Apigee X as a robust and feature-rich API management platform. While the primary focus is on serving Gemini models, the principles and patterns discussed here can be adapted for other LLMs.

SampleDescriptionOpen Notebook
1llm-token-limitsApigee's API Products provide real-time monitoring and enforcement of token usage limits for LLMs, enabling effective management of token consumption across different providers and consumers.notebook
2llm-semantic-cacheThis sample performs a cache lookup of responses on Apigee's Cache layer and Vector Search as an embeddings database.notebook
3llm-semantic-cache-v2This sample performs a cache lookup of responses on Apigee's Cache layer and Vector Search as an embeddings database using out of the box policies.notebook
4llm-circuit-breakingApigee enhances the resilience and prevents outages in Retrieval Augmented Generation applications that utilize multiple Large Language Models by intelligently managing traffic and implementing circuit breaking to avoid exceeding endpoint quotas.notebook
5llm-loggingLogging prompts and responses of large language models facilitates performance analysis, security monitoring, and bias detection, ultimately enabling model improvement and risk mitigation.notebook
6llm-routingSample to route to different LLM providers using Apigee's routing capabilities.notebook
7llm-securitySample to demonstrate the security capabilities of Apigee with Model Armor to secure the user promptsnotebook
8llm-security-v2Sample to demonstrate the security capabilities of Apigee with out of the box Model Armor policies to secure the user promptsnotebook
9llm-vertexai-agentSample to deploy an agent using Vertex Agent Builder and point to an Apigee proxynotebook
10llm-function-callingSample to deploy a proxy and configure it as a function callnotebook
11llm-sse-securitySample to deploy a proxy that streams server-side events (SSE) and use Model Armor to inspect the responsenotebook
12llm-sse-loggingSample to deploy a proxy that streams server-side events (SSE) and log the response to Cloud Loggingnotebook
13llm-token-limits-per-userApigee's API Products provide real-time monitoring and enforcement of token usage limits for LLMs, enabling effective management of token consumption across different providers and consumers. This focus on per end-user countingnotebook
14llm-inference-gatewayConfigure Apigee with GKE Inference Gateway to provide authorization and rate limiting capabilities
15llm-token-limits-v2Apigee's API Products provide real-time monitoring and enforcement of token usage limits for LLMs, enabling effective management of token consumption across different providers and consumers.notebook

ADK Samples with Apigee

This is a collection of sample AI agents created using Google's Agent Development Kit that show how to use ADK's built-in tooling to connect to APIs from Apigee API hub.

Prerequisites

You will need a GCP project with the following services enabled and provisioned:

  • Vertex AI
  • Apigee API hub
  • Apigee

Samples

AgentDescription
adk-auto-insurance-agentA virtual assistant for auto insurance that uses Apigee API hub to provide APIs as tools.

For more information on ADK's Apigee API hub and Application Integration toolsets, see the documentation.

Apigee and Model Context Protocol (MCP)

The Model Context Protocol (MCP) standardizes how Large Language Models (LLMs) interact with external tools and APIs. Apigee can act as a powerful MCP provider, exposing managed APIs as tools for LLMs. This allows AI agents to leverage existing enterprise APIs securely and reliably through Apigee's governance and traffic management capabilities. The sample in this section demonstrates how to integrate Apigee with MCP.

SampleDescriptionOpen Notebook
1apigee-mcpIllustrates Apigee's role in the MCP ecosystem. Features an MCP server that discovers API specs from Apigee API hub, dynamically creates tools for LLMs, and exposes them through Apigee. An example CRM agent notebook demonstrates consuming these tools.notebook

Apigee API hub plugins

Plugins, also known as on-ramp plugins, enable API hub to connect and ingest API metadata from various Google Cloud services and external sources where your APIs are managed or defined. They simplify and enhance the process of bringing your API metadata directly into API hub. For more info on plugins, check out this page. The sample in this section demonstrates how to configure them for different sources.

SampleDescription
1azure-apimThis sample provides an Application Integration template and scripts to synchronize API metadata from Azure API Management (APIM) to Apigee API hub

Modifying a sample proxy

Feel free to modify and build upon the sample proxies. You can make changes in the Apigee management UI or by using our Cloud Code extension for local development in Visual Studio Code. Whichever approach is comfortable for you.

Simply redeploy the proxies for changes to take effect.

Ask questions on the Community Forum

The Apigee Forum on the Google Cloud Community site is a great place to ask questions and find answers about developing API proxies.

Apigee documentation

The Apigee docs are located here.

Contributing

New samples should be added as a root level directory in this repository.

For more details on how to contribute please see the guidelines.

License

All solutions within this repository are provided under the Apache 2.0 license. Please see the LICENSE file for more detailed terms and conditions.

Not Google Product Clause

This is not an officially supported Google product, nor is it part of an official Google product.

Support

If you need support or assistance, you can try inquiring on Google Cloud Community forum dedicated to Apigee.