# Helicone AI Gateway

> One OpenAI-compatible endpoint for 100+ LLM providers, with routing, caching, and tracing

- Category: Evaluation & Production Ops / Gateways & Routing
- Language: Rust
- Licence: Apache-2.0
- Repository: https://github.com/Helicone/ai-gateway
- Website: https://docs.helicone.ai/gateway/overview
- Canonical page: https://ai-tldr.dev/tools/helicone-ai-gateway/

## In short

Helicone AI Gateway is an open-source proxy, written in Rust, that sits between your application and the large language model providers you call. You send requests using the familiar OpenAI SDK and API format, and the gateway forwards them to OpenAI, Anthropic, Google, AWS Bedrock, and many other providers behind a single endpoint. It sits in the Gateways & Routing category of the Evaluation & Production Ops tools and is open-source, written in Rust and licensed Apache-2.0.

## Overview

Helicone AI Gateway is an open-source proxy, written in Rust, that sits between your application and the large language model providers you call. You send requests using the familiar OpenAI SDK and API format, and the gateway forwards them to OpenAI, Anthropic, Google, AWS Bedrock, and many other providers behind a single endpoint.

It is aimed at developers and teams who call several LLM providers and want one integration instead of many. Because it speaks the OpenAI API, you usually only change the base URL and the model name to start routing through it, so existing code keeps working.

As an LLM gateway, it adds the operational layer you normally have to build yourself: smart routing across providers, rate limiting to control spend, response caching, and request tracing through Helicone or OpenTelemetry. You can use the cloud-hosted version or run it on your own infrastructure with npx or Docker.

## What it does

- One OpenAI-compatible endpoint that fans out to 100+ models across OpenAI, Anthropic, Google, AWS Bedrock, and 20+ more providers
- Smart routing strategies including latency-based provider selection (P2C + PeakEWMA), weighted distribution, and cost-based routing to the cheapest option
- Rate limiting per user, team, or globally by request count, token usage, or dollar amount to control spend
- Response caching with Redis and S3 backends to cut cost and latency on repeated requests
- Built-in tracing via Helicone plus OpenTelemetry support for logs, metrics, and traces
- Self-host with npx or Docker, or use the cloud-hosted gateway; the Rust binary is small and starts quickly

## Getting started

You can call the cloud-hosted gateway with just a base URL change, or run the gateway locally and point your OpenAI client at it.

1. Use the cloud-hosted gateway

   Point the OpenAI SDK at the Helicone AI Gateway base URL and use your Helicone API key. Prefix the model with the provider name.

```python
from openai import OpenAI

client = OpenAI(
  api_key="YOUR_HELICONE_API_KEY",
  base_url="https://ai-gateway.helicone.ai/ai",
)

completion = client.chat.completions.create(
  model="openai/gpt-4o-mini", # or 100+ models
  messages=[
    {"role": "user", "content": "Hello, how are you?"}
  ]
)
```

2. Run the gateway locally

   Set your provider API keys in a .env file, then start the gateway. It listens on port 8080 by default.

```bash
OPENAI_API_KEY=your_openai_key
ANTHROPIC_API_KEY=your_anthropic_key

npx @helicone/ai-gateway@latest
```

3. Point your client at the local gateway

   Use the local base URL; the gateway holds the real provider keys, so the client key can be a placeholder.

```python
from openai import OpenAI

client = OpenAI(
  api_key="placeholder-api-key",
  base_url="http://localhost:8080/ai",
)

response = client.chat.completions.create(
  model="openai/gpt-4o-mini",
  messages=[{"role": "user", "content": "Hello!"}]
)
```

## When to use it

- Calling several LLM providers from one codebase without maintaining a separate integration for each
- Adding fallbacks and latency- or cost-based routing so traffic shifts to the fastest or cheapest available model
- Capping LLM spend with per-user, per-team, or global rate limits on requests, tokens, or dollars
- Caching repeated completions and tracing requests to cut cost and debug production LLM traffic
