1

Create an account and generate an API key

Log into Helicone or create an account. Once you have an account, you can generate an API key here.
2

Set up your Helicone API key in your .env file

HELICONE_API_KEY=<your-helicone-api-key>
OPENAI_API_KEY=<your-openai-api-key>
3

Modify the base URL path and set up authentication

from openai import OpenAI
from dotenv import load_dotenv
import os

load_dotenv()

helicone_api_key = os.getenv("HELICONE_API_KEY")
openai_api_key = os.getenv("OPENAI_API_KEY")

client = OpenAI(
  api_key=openai_api_key,
  base_url="https://oai.helicone.ai/v1",
  default_headers={
    "Helicone-Auth": f"Bearer {helicone_api_key}"
  }
)
4

Use the OpenAI SDK

chat_completion = client.chat.completions.create(
  model="gpt-4o-mini",
  messages=[{"role": "user", "content": "What is the meaning of life?"}]
)

print(chat_completion.choices[0].message.content)
5

Verify your requests in Helicone

With the above setup, any calls to OpenAI will automatically be logged and monitored by Helicone. Review them in your Helicone dashboard.