This integration method is maintained but no longer actively developed. For the best experience and latest features, use our new AI Gateway with unified API access to 100+ models.
Copy
Ask AI
import os
from dotenv import load_dotenv
from llama_index.core import Settings
from llama_index.llms.openai import OpenAI
load_dotenv()
helicone_api_key = os.getenv("HELICONE_API_KEY")
openai_api_key = os.getenv("OPENAI_API_KEY")
Settings.llm = OpenAI(
base_url="https://oai.helicone.ai/v1",
api_key=openai_api_key,
default_headers={
"Helicone-Auth": f"Bearer {helicone_api_key}"
}
)