OpenAI
OpenAI Python SDK Integration
Use OpenAI’s Python SDK to integrate with Helicone to log your OpenAI usage.
Proxy Integration (recommended)
1
2
Set HELICONE_API_KEY as an environment variable
export HELICONE_API_KEY=<your API key>
3
Modify the base path and add a Helicone-Auth header
Package Integration
1
2
Set HELICONE_API_KEY as an environment variable
export HELICONE_API_KEY=<your API key>
3
Install the Helicone package
pip install helicone
4
Modify OpenAI import to use Helicone
from helicone.openai_proxy import openai # replace `import openai` with this line
5
That's it! You're ready to start logging with Helicone. Here's an example of using Helicone along with our advanced features as parameters
import OpenAI from "openai";
const openai = new OpenAI({
apiKey: request.env.OPENAI_API_KEY,
baseURL: "https://oai.helicone.ai/v1",
defaultHeaders: {
"Helicone-Auth": `Bearer ${request.env.HELICONE_API_KEY}`,
},
});