Envoy AI Gateway Documentation

repository·main·Indexed 23 days ago

https://github.com/envoyproxy/ai-gateway

An open source project leveraging Envoy Gateway to manage and route request traffic to Generative AI services. It features an InferencePool for intelligent routing across LLM backends, support for Model Context Protocol (MCP) tool calls, and OpenTelemetry instrumentation for observability. The gateway integrates with providers including OpenAI, Azure OpenAI, GCP Vertex AI, AWS Bedrock, Cohere, and Ollama.

Tokens
140.1K
Snippets
253
Records
569
Agent score
82%

What's inside Envoy AI Gateway

  1. Overview of Envoy AI Gateway

    main

    Envoy AI Gateway is an open-source project built on Envoy Proxy designed to simplify application client interactions with Generative AI (GenAI) services. It acts as a unified layer for routing and managing LLM/AI traffic, providing a secure, scalable, and efficient way to handle requests to both external LLM providers (like OpenAI, Anthropic, and AWS Bedrock) and self-hosted models.

    Core Capabilities

    • Traffic Management: Unified routing for LLM/AI traffic with support for automatic failover to ensure service reliability.
    • Security: End-to-end security including fine-grained access control, authorization policies, rate limiting, and Upstream Authentication for secure egress to external providers.
    • Observability: Visibility into traffic performance, usage patterns, and cost analytics to optimize GenAI usage.
    • Extensibility: Built on Envoy's extensibility framework, allowing for custom features tailored to specific AI infrastructure needs.
    • Resilience: Intelligent routing and automatic failover mechanisms to maintain high availability across different providers and self-hosted models.
  2. Overview of Inference Optimization in Envoy AI Gateway

    main

    Envoy AI Gateway provides inference optimization to improve the speed and reliability of AI/LLM tasks. It achieves this through intelligent routing and load balancing across backend endpoints.

    Key capabilities include:

    • Intelligent Endpoint Selection: Routing requests to the most suitable endpoints based on real-time metrics and availability.
    • Dynamic Load Balancing: Distributing workloads across multiple backend instances to optimize resource utilization.
    • Seamless Integration: Compatibility with both standard HTTPRoute and the enhanced AIGatewayRoute configurations.
    • Extensible Architecture: Support for custom Endpoint Picker Providers (EPP), allowing developers to implement domain-specific routing logic.
  3. Overview of supported API endpoints in Envoy AI Gateway

    main

    The Envoy AI Gateway acts as a proxy for routing and managing LLM/AI traffic. It accepts requests using two primary API specifications:

    1. OpenAI-compatible API: The gateway maintains compatibility with the OpenAI API specification, though it currently supports a subset of the full OpenAI API.
    2. Anthropic-compatible API: The gateway supports Anthropic's API format for routing requests to various AI providers.

    By using these compatible interfaces, you can route traffic intended for OpenAI or Anthropic to different underlying AI providers through the Envoy AI Gateway.

  4. Overview of Envoy AI Gateway features

    main

    Envoy AI Gateway is an AI gateway built on CNCF's Envoy Gateway designed to simplify enterprise AI adoption. It provides a unified interface for interacting with various Large Language Model (LLM) providers and includes built-in management features for security and cost control.

    Core Capabilities:

    • Unified API: Provides a single integration point for multiple LLM providers (currently supporting AWS Bedrock and OpenAI).
    • Upstream Authorization: Simplifies authentication processes across different AI providers.
    • Usage Rate Limiting: Controls costs and operational efficiency by implementing rate limiting based on word tokens.
  5. Overview of Envoy AI Gateway Capabilities

    main

    Envoy AI Gateway provides a suite of features designed to manage, optimize, and secure AI/LLM traffic. Key capability areas include:

    • LLM Provider Integrations: Connectivity to various providers, support for vendor-specific fields, and provider-agnostic prompt caching via a unified cache_control API.
    • Inference Optimization: Intelligent routing and load balancing using InferencePool and integration with standard or AI-specific Gateway APIs (HTTPRoute or AIGatewayRoute).
    • Gateway Configuration: Scoped configuration for external processors (environment variables, resources) and scaling strategies for production.
    • Traffic Management: Features like Model Virtualization, automatic Provider Fallback, token-based Quota Policies, usage-based Rate Limiting, and HTTP header/body mutations.
    • Security: Upstream authentication to secure connections to AI services.
    • Model Context Protocol (MCP): Support for MCP workloads including server multiplexing, tool routing, OAuth, and observability.
    • Observability: Comprehensive metrics collection for monitoring AI workloads.
  6. Overview of Model Context Protocol (MCP) Gateway

    main

    The Envoy AI Gateway provides support for the Model Context Protocol, acting as a transparent proxy between MCP clients (such as Claude or Goose) and backend MCP servers.

    Key capabilities include:

    • Aggregation: Combine multiple MCP servers into a single unified endpoint.
    • Security: Apply OAuth authentication, fine-grained tool access control, and upstream API key injection.
    • Tool Filtering: Control which specific tools are exposed to the client.
    • Networking: Utilize Envoy's standard features like load balancing, rate limiting, circuit breaking, and observability (OpenTelemetry/Prometheus).
    • Spec Compliance: Full support for the June 2025 MCP specification, including tool calls, notifications, prompts, resources, and bi-directional requests.
  7. Overview of Envoy AI Gateway goals and objectives

    main

    Envoy AI Gateway is designed to facilitate seamless communication between application clients and multiple Generative AI (GenAI) services by leveraging Envoy Gateway and Envoy Proxy.

    Its primary objectives are:

    • Enable GenAI traffic handling with Envoy: Provides control plane extensions to the Envoy Gateway API to define routing rules specifically for GenAI services.
    • Easy Setup: Simplifies the management of traffic to and from GenAI services through preset Envoy Gateway configurations, allowing platform engineers to provide a gateway solution that application developers can use without deep infrastructure knowledge.

    The project is an additive layer designed to expand Envoy use cases without disrupting existing Envoy deployment or control patterns.

  8. New features in Envoy AI Gateway v0.3

    main

    Envoy AI Gateway v0.3 introduces several key capabilities for production-ready AI infrastructure:

    • Endpoint Picker Provider: Enables intelligent AI load balancing.
    • AIGatewayRoute with InferencePool: Allows for advanced routing configurations using inference pools.
    • Google Vertex AI Support: Provides enterprise-scale AI integration via Google Vertex AI.
    • Comprehensive AI Observability: Enhanced monitoring and visibility for AI workloads.
    • Model Name Virtualization: Provides an abstraction layer for model names, allowing for greater flexibility in switching or upgrading models without changing client code.
    • Unified APIs: Supports both LLM and non-LLM APIs through a unified interface.
  9. AI/LLM Observability Features in Envoy AI Gateway

    main

    Envoy AI Gateway provides specialized observability for AI and LLM workloads by extending the foundational observability of Envoy Gateway. The key features include:

    • GenAI Metrics: Prometheus metrics that follow OpenTelemetry Gen AI semantic conventions. These allow you to monitor token usage, latency, and model performance.
    • GenAI Tracing: OpenTelemetry integration using OpenInference semantic conventions, designed for LLM request tracing and evaluation.
    • Access Logs with AI/LLM metadata: The ability to include AI-specific metadata (such as model name and token usage) directly in Envoy Access Logs.
    • Gateway Configuration: Per-gateway configuration for the external processor container, which includes setting environment variables for tracing and defining resource requirements.
  10. Key features of Envoy AI Gateway

    main

    The Envoy AI Gateway MVP focuses on three core capabilities designed to address the unique challenges of LLM traffic compared to traditional API traffic:

    1. Usage Limiting: Controls LLM usage based on word tokens rather than traditional request counts. This accounts for the computational complexity and cost associated with tokenization in LLM requests and responses.
    2. Unified API: Simplifies client integration by providing a consistent interface for interacting with multiple different LLM providers.
    3. Upstream Authorization: Provides a mechanism to configure and manage Authorization across multiple upstream LLM providers.
  11. Use the Envoy AI Gateway CLI (aigw)

    main

    The aigw CLI is a command-line interface used to manage and interact with the Envoy AI Gateway. It currently supports two primary modes of operation:

    1. Run: Executes the Envoy AI Gateway locally as a standalone proxy. This mode uses a provided configuration file and does not require external dependencies like Docker or Kubernetes.
    2. Translate: Converts an Envoy AI Gateway configuration file into an Envoy Gateway configuration file format.

    :::warning The CLI is experimental and currently under active development. :::

  12. Explore LLM Provider Integrations

    main

    Envoy AI Gateway supports multiple LLM providers through a unified interface. You can manage connectivity, access provider-specific features, and use advanced capabilities like prompt caching.

    Key areas for integration include:

    • Provider Support: View the full list of supported AI/LLM service providers and their specific configuration requirements.
    • Supported Endpoints: Review the available API endpoints and operations provided across different backend providers.
    • Vendor-Specific Fields: Access unique provider capabilities by passing backend-specific parameters within OpenAI-compatible requests.
    • Prompt Caching: Implement provider-agnostic prompt caching using the unified cache_control API.
    • Connectivity: Establish fundamental connections between the gateway and your chosen AI providers.