For reference this is the call to the second API
const OPENAI_API_KEY = process.env.OPENAI_API_KEY!;
const HELICONE_API_KEY = process.env.HELICONE_API_KEY!;
const HELICONE_CHAT_URL = "https://oai.hconeai.com/v1/chat/completions";
const res = await fetch(HELICONE_CHAT_URL, {
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${OPENAI_API_KEY}`,
"Helicone-Retry-Enabled": "true",
"Helicone-Auth": `Bearer ${HELICONE_API_KEY}`,
"Helicone-Property-Id": id,
"Helicone-Property-ConversationId": conversationId,
},
method: "POST",
body: JSON.stringify({
model: LLM_OPTIONS[llm].name,
max_tokens: LLM_OPTIONS[llm].maxTokensForOutput,
messages: chatHistory,
temperature: temperature,
top_p: 1,
frequency_penalty: 0,
presence_penalty: 0,
stream: true,
n: 1,
}),
});