Skip to main content
Feedback

LLM Gateway architecture

LLM Gateway architecture delivers scalability, flexibility, and resilience during complex API consumption workloads.

LLM Gateway manages and optimizes outgoing API traffic. It offers a lightweight, optional solution for rerouting API traffic to the gateway without modifying existing codebases, providing efficient traffic management with minimal system impact. These lightweight interceptors also feature a built-in Failsafe mechanism to ensure continuous API traffic even in the event of gateway issues.

For expanded operational demand, LLM Gateway Pro supports deployment of multiple gateway instances. Redis manages shared state, ensuring consistent quota usage and traffic metrics across instances. Redis plays a crucial role in enabling LLM Gateway Pro to handle high traffic volumes seamlessly.

Routing and LLM Gateway policy execution

LLM Gateway excels in addressing complex API consumption challenges such as rate limits, retries, and account management. Configure LLM Gateway with Gateway policies to extend request routing capabilities.

By default, LLM Gateway forwards requests to the host specified in the incoming requests. Define the Gateway policies globally to process all requests passing through LLM Gateway, or on a per-endpoint/header basis. To achieve optimal performance, run the LLM Gateway on the same machine as the applications that use it.

Failsafe mechanisms

LLM Gateway includes a Failsafe mechanism that ensures continuous API traffic, even in case of system failure. For more details, refer to Failsafe mechanisms.

Flexible traffic routing

Unlike traditional proxy architectures that route all API traffic through a gateway, LLM Gateway lets you selectively route only part of your traffic. You can control and monitor specific traffic for testing, optimization, or security, without disrupting your entire API ecosystem or forcing architectural changes.

LLM Gateway Pro with Redis capabilities

To handle increased API traffic, LLM Gateway Pro provides horizontal scaling, enabling the deployment of multiple instances of the LLM Gateway . Redis plays a critical role in managing shared state between instances, ensuring consistency across distributed systems.

Redis for shared state management

Redis supports LLM Gateway Pro in the following ways:

  • Redis is used as a central store to manage state across LLM Gateway Pro instances, handling critical data such as quota usage and traffic metrics.
  • This integration enables multiple LLM Gateway Pro instances to function seamlessly, distributing API traffic efficiently and preventing bottlenecks.

LLM Gateway policies

The LLM Gateway policies are the foundation of the LLM Gateway, enabling fine-grained control over API traffic. They enable organizations to define customizable streams, filters, and processors to optimize traffic, control API usage, and enforce quotas with flexibility. Gateway policies are modular and scalable, letting businesses maintain, adapt, and extend traffic control policies easily.

LLM Gateway policies consist of three core building blocks:

  • Streams: API requests and responses are processed as streams, which are divided based on specific criteria (for example, URL, headers).
  • Filters: Apply logic to segment traffic into sub-streams, enabling focused traffic management.
  • Processors: Modify or transform traffic in real-time, enabling features like rate-limiting, request routing, or quota enforcement.

This modular structure lets organizations seamlessly integrate traffic policies that optimize API consumption and ensure that traffic is routed based on business-critical rules.

LLM Gateway performance footprint

LLM Gateway minimizes latency impact while optimizing API traffic. As API providers and consumers increasingly focus on response-time percentiles, LLM Gateway is designed to introduce minimal latency overhead, including under heavy load.

LLM Gateway operates alongside your applications, processing all outgoing traffic to third-party providers. By default, the LLM Gateway forwards requests and responses like a traditional gateway. LLM Gateway policies extend this behavior by enabling the gateway to modify, generate, or diagnose API traffic in real time. This feature ensures that LLM Gateway can meet the needs of high-traffic environments without impacting performance.

User interface integration

The LLM Gateway includes a web-based UI built using Vue.js, providing a user-friendly interface for managing API traffic and viewing analytics. LLM Gateway communicates with the UI through a secure connection, using a dedicated API key that is automatically generated upon sign-up, ensuring seamless and secure interaction between the UI and the gateway.

On this Page