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.
1
2
HELICONE_API_KEY=<your-helicone-api-key>
OPENAI_API_KEY=<your-openai-api-key>
3
import { OpenAI } from "@langchain/openai";
const llm = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
baseURL: "https://oai.helicone.ai/v1",
defaultHeaders: {
"Helicone-Auth": `Bearer ${process.env.HELICONE_API_KEY}`
}
});
from langchain_openai import OpenAI
from dotenv import load_dotenv
import os
load_dotenv()
llm = OpenAI(
api_key=os.getenv("OPENAI_API_KEY"),
base_url="https://oai.helicone.ai/v1",
default_headers={
"Helicone-Auth": f"Bearer {os.getenv('HELICONE_API_KEY')}"
}
)
4
const response = await llm.invoke("What is the meaning of life?");
console.log(response);
response = llm.invoke("What is the meaning of life?")
print(response)
5