Course contentsShow
← AI Engineering
Lesson 1278 of 1,88631. LLM Observability PlatformsFree lesson

Setting Up Helicone Proxy and API Keys

Configuring Helicone as a transparent proxy between your application and LLM providers for automatic logging.

Setting Up Helicone Proxy and API Keys

You'll learn: How to configure Helicone as a transparent proxy between your application and LLM providers to automatically capture every request and response without changing your code.

The Transparent Proxy Pattern

Think of Helicone as a security camera positioned between your application and OpenAI (or other providers). Instead of talking directly to OpenAI, your requests flow through Helicone first, where they're logged, then forwarded to the real API. The responses come back the same way. Your application code barely changes—you just redirect traffic.

Basic Configuration Steps

First, sign up at helicone.ai and generate an API key from your dashboard. This key authenticates your requests to the Helicone proxy.

For OpenAI, you'll modify two things:

  1. Base URL: Change from https://api.openai.com/v1 to https://oai.hconeai.com/v1
  2. Headers: Add Helicone-Auth: Bearer YOUR_HELICONE_KEY
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_OPENAI_KEY",
    base_url="https://oai.hconeai.com/v1",
    default_headers={
        "Helicone-Auth": "Bearer YOUR_HELICONE_KEY"
    }
)

# Your existing code works unchanged
response = client.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Hello!"}]
)

Every request now flows through Helicone's infrastructure, getting logged with timestamps, token counts, costs, and latency—all without additional instrumentation code.

Key Takeaway: Helicone's proxy pattern requires only URL and header changes to gain full observability, making it one of the least intrusive monitoring solutions for LLM applications.