Documentation Index Fetch the complete documentation index at: https://docs.helicone.ai/llms.txt
Use this file to discover all available pages before exploring further.
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.
Helicone can be seamlessly integrated with your Azure-OpenAI deployment. This integration requires no additional code changes beyond importing the OpenAI package with Helicone.
MODEL OVERRIDE When using Azure, the model may sometimes display differently than expected. We have implemented a series of logic to parse out the model, but the returned body of the model can be inconsistent in most cases. Helicone-Model-Override: [MODEL_NAME] Click here to learn more about model override
Python
Node.js
Python w/package
LangChain JS
LangChain
cURL
Please ensure to include the ‘api-version’ in all of your requests.
It is mandatory to include the ‘api-key’ in both locations.
client = OpenAI(
api_key = "[AZURE_OPENAI_API_KEY]" ,
base_url = "https://oai.helicone.ai/openai/deployments/[DEPLOYMENT]" ,
default_headers = {
"Helicone-OpenAI-Api-Base" : "https://[AZURE_DOMAIN].openai.azure.com" ,
"Helicone-Auth" : "Bearer [HELICONE_API_KEY]" ,
"api-key" : "[AZURE_OPENAI_API_KEY]" ,
},
default_query = {
"api-version" : "[API_VERSION]"
}
)
Modify the API base and add a Helicone-Auth header import openai
openai.api_base = "https://oai.helicone.ai"
openai.api_key = "[AZURE_OPENAI_API_KEY]"
openai.api_version = "[API_VERSION]"
openai.api_type = "azure"
# Create the completion request
openai.ChatCompletion.create(
model = "[DEPLOYMENT]" ,
messages = [{ "role" : "User" , "content" : "Say hi!" }],
headers = {
"Helicone-Auth" : "Bearer [HELICONE_API_KEY]" ,
"Helicone-OpenAI-Api-Base" : "https://[AZURE_DOMAIN].openai.azure.com" ,
}
)
Congratulations! Your Azure OpenAI requests are now configured to log results to Helicone. Please ensure to include the ‘api-version’ in all of your requests.
const openai = new OpenAI ({
baseURL: "https://oai.helicone.ai/openai/deployments/[DEPLOYMENTNAME]" ,
defaultHeaders: {
"Helicone-Auth" : `Bearer [HELICONE_API_KEY]` ,
"Helicone-OpenAI-API-Base" : "https://[AZURE_DOMAIN].openai.azure.com" ,
"api-key" : "[AZURE_API_KEY]" ,
},
defaultQuery: { "api-version" : "[API_VERSION]" },
});
import { Configuration , OpenAIApi } from "openai" ;
const configuration = new Configuration ({
apiKey: "[AZURE_OPENAI_API_KEY]" ,
basePath: "https://oai.helicone.ai/openai/deployments/[DEPLOYMENT]" ,
baseOptions: {
headers: {
"Helicone-Auth" : `Bearer [HELICONE_API_KEY]` ,
"api-key" : "[AZURE_OPENAI_API_KEY]" ,
"Helicone-OpenAI-Api-Base" : "https://[AZURE_DOMAIN].openai.azure.com" ,
},
params: {
"api-version" : "[API_VERSION]" ,
},
},
});
const openai = new OpenAIApi ( configuration );
from helicone.openai_proxy import openai
openai.api_type = "azure"
openai.api_base = "https://[YOUR_AZURE_DOMAIN].openai.azure.com"
openai.api_version = "2023-03-15-preview"
openai.api_key = YOUR_AZURE_API_KEY
response = openai.ChatCompletion.create(
engine = 'gpt-4o-mini' ,
messages = [{
'role' : 'user' ,
'content' : "Hello World!"
}],
max_tokens = 30 ,
)
const model = new ChatOpenAI ({
azureOpenAIApiKey: "[AZURE_OPENAI_API_KEY]" ,
azureOpenAIApiDeploymentName: "openai/deployments/gpt-4o-mini" ,
azureOpenAIApiVersion: "2023-03-15-preview" ,
azureOpenAIBasePath: "https://oai.helicone.ai" ,
configuration: {
organization: "[organization]" ,
baseOptions: {
headers: {
"Helicone-Auth" : `Bearer ${ heliconeApiKey } ` ,
"Helicone-OpenAI-Api-Base" :
"https://[YOUR_AZURE_DOMAIN].openai.azure.com" ,
},
},
},
});
from langchain.chat_models import AzureChatOpenAI
helicone_headers = {
"Helicone-Auth" : f "Bearer { helicone_api_key } " ,
"Helicone-OpenAI-Api-Base" :
"https://<model_name>.openai.azure.com/"
}
self .model = AzureChatOpenAI(
openai_api_base = "https://oai.helicone.ai" ,
deployment_name = "gpt-4o-mini" ,
openai_api_key =< AZURE_OPENAI_API_KEY > ,
openai_api_version = "2023-05-15" ,
openai_api_type = "azure" ,
max_retries = max_retries,
headers = helicone_headers,
** kwargs,
)
curl --request POST \
--url "https://oai.helicone.ai/openai/deployments/ $DEPLOYMENT_NAME /chat/completions?api-version= $API_VERSION " \
--header "Helicone-Auth: Bearer $HELICONE_API_KEY " \
--header "Helicone-OpenAI-Api-Base: https:// $AZURE_DOMAIN .openai.azure.com" \
--header "api-key: $AZURE_API_KEY " \
--header "content-type: application/json" \
--data '{
"messages": [
{
"role": "user",
"content": "Answer in one word"
}],
"max_tokens": 800,
"temperature": 1,
"model": "gpt-4o-mini-0613"
}'