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.
Proxy Integration
Fetch
Create an account + Generate an API Key
Log into helicone or create an account. Once you have an account, you
can generate an API key. Set API keys as environment variables
export HELICONE_API_KEY=<your API key>
export GCLOUD_API_KEY=<your Google Cloud API key>
Install necessary packages
Ensure you have the necessary packages installed in your Javascript project: Send a request using fetch
const fetch = require('node-fetch');
const url = 'https://gateway.helicone.ai/v1/projects/your-project-id/locations/your-location/publishers/google/models/model-name:streamGenerateContent';
const headers = {
'Authorization': `Bearer ${process.env.GCLOUD_API_KEY}`,
'Content-Type': 'application/json',
'Helicone-Auth': `Bearer ${process.env.HELICONE_API_KEY}`,
'Helicone-Target-URL': `https://${LOCATION}-aiplatform.googleapis.com`,
'User-Agent': 'node-fetch'
};
const body = JSON.stringify({
contents: {
role: 'user',
parts: { text: 'Which theaters in Mountain View show Barbie movie?' }
},
generation_config: { maxOutputTokens: 1 }
});
fetch(url, { method: 'POST', headers: headers, body: body })
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
VertexAI SDK
Create an account + Generate an API Key
Log into helicone or create an account. Once you have an account, you
can generate an API key. Set API keys as environment variables
export HELICONE_API_KEY=<your API key>
export GCLOUD_API_KEY=<your Google Cloud API key>
Install necessary packages
Ensure you have the necessary packages installed in your Javascript project:npm install @google-cloud/vertexai
Import VertexAI and configure the client
import { VertexAI } from "@google-cloud/vertexai";
const vertex_ai = new VertexAI({
project: "your-project-id",
location: "your-location",
apiEndpoint: "gateway.helicone.ai",
});
Set up custom headers
const customHeaders = new Headers({
"Helicone-Auth": `Bearer ${process.env.HELICONE_API_KEY}`,
"Helicone-Target-URL": `https://${LOCATION}-aiplatform.googleapis.com`,
});
Define request options
const requestOptions = {
customHeaders: customHeaders,
} as RequestOptions;
Get the generative model
const generativeModel = vertex_ai.preview.getGenerativeModel(
{
model: "model-name"
},
requestOptions // Pass request options
);
Generate content
const result = await generativeModel.generateContent({
contents: [{ role: "user", parts: [{ text: "How are you doing today?" }] }],
});
console.log(result);