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

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}`
  }
});
4

Use the LangChain SDK

const response = await llm.invoke("What is the meaning of life?");
console.log(response);
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.