Custom Model Integration
Integrate any custom LLM, including open-source models like Llama and GPT-Neo, with Helicone. Step-by-step guide for both NodeJS and Curl implementations to connect your proprietary or open-source models.
Quickstart
Logging calls to custom models is currently supported via the Helicone NodeJS SDK.
To get started, install the `@helicone/helpers` package
Set `HELICONE_API_KEY` as an environment variable
Create a new HeliconeManualLogger instance
Log your request
API Reference
HeliconeManualLogger
logRequest
Parameters
request
:HeliconeLogRequest
- The request object to log
operation
:(resultRecorder: HeliconeResultRecorder) => Promise<T>
- The operation to be executed and logged
additionalHeaders
:Record<string, string>
- Additional headers to be sent with the request
- This can be used to use features like session management, custom properties, etc.
Token Tracking
Helicone supports token tracking for custom model integrations. To enable this, include a usage
object in your providerResponse.json
. Here are the supported formats:
OpenAI-style Format
Anthropic-style Format
Google-style Format
Alternative Format
If your model returns token counts in a different format, you can transform the response to match one of these formats before logging to Helicone. If no token information is provided, Helicone will still log the request but token metrics will not be available.
Streaming Responses
For streaming responses, token counts should be included in the final message of the stream. If you’re experiencing issues with cost calculation in streaming responses, please refer to our streaming usage guide for additional configuration options.
Was this page helpful?