Helicone Community Page

C
K
m
H
E

Helicone with Azure Provider doesn't work

The below connection doesn't work altough everything is setup correctly.

I even have to add the "apiKey" in the root of the config object, cause otherwise I get an error from openAI that the apiKey is undefined.

This also isn't mentioned in the Helicone Azure Doc

Any ideas?


import OpenAI from "openai"

const openai = new OpenAI({
baseURL: "https://oai.helicone.ai/openai/deployments/[DeploymentName]",
defaultHeaders: {
"Helicone-Auth": Bearer ${process.env.HELICONE_API_KEY},
"Helicone-OpenAI-API-Base": "https://chatarmin-ai.openai.azure.com",
"api-key": process.env.AZURE_API_KEY,
"Helicone-Cache-Enabled": "true",
},
apiKey: process.env.AZURE_API_KEY,
defaultQuery: { "api-version": "2024-05-13" },
})
R
C
5 comments
Facing the same issue with the Azure OpenAI in Python.
Works intermittently, but randomly fails alot of the times
Hi, I just tested and it worked for me

Plain Text
import OpenAI from "openai";

const openai = new OpenAI({
  baseURL: "https://oai.hconeai.com/openai/deployments/{DEPLOYMENT_NAME}",
  defaultHeaders: {
    "Helicone-Auth": `Bearer ${process.env.HELICONE_API_KEY}`,
    "Helicone-OpenAI-API-Base": process.env.AZURE_OPENAI_BASE_URL,
    "api-key": process.env.AZURE_OPENAI_API_KEY,
  },
  defaultQuery: { "api-version": "{API_VERSION}" },
});

const data = await openai.chat.completions.create({
    model: "gpt-4",
    messages: [{ role: "user", content: "Say Hi" }],
    stream: false,
  });

console.log(data);
I did not have to pass in the api_key in the root of the config. Which OpenAI version are you using? I'm on the latest: "openai": "^4.65.0",
IMO the only reason this would occur is if you have geographic restrictions on Azure OpenAI.

Otherwise, there is nothing else that would cause it to work intermittently. We just proxy it, is it possible that Azure OpenAI was having service interruptions?

Can you share your integration?

@Rajiv
Attachment
Screenshot_2024-09-26_at_3.11.01_PM.png
Add a reply
Sign up and join the conversation on Discord
Join