Manual Logger - cURL
Integrate any custom LLM with Helicone using cURL. Step-by-step guide for direct API integration to connect your proprietary or open-source models.
cURL Manual Logger
You can log custom model calls directly to Helicone using cURL or any HTTP client that can make POST requests.
Request Structure
A typical request will have the following structure:
Endpoint
Headers
Name | Value |
---|---|
Authorization | Bearer {API_KEY} |
Replace {API_KEY}
with your actual Helicone API Key.
Body
The request body follows this structure:
Example Usage
Here’s a complete example of logging a request to a custom model:
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.
Advanced Usage
Adding Custom Properties
You can add custom properties to your requests by including them in the meta
field:
Session Tracking
To group requests into sessions, include a session ID in the meta
field:
User Tracking
To associate requests with specific users, include a user ID in the meta
field:
Calculating Timing Information
The timing information should be calculated as follows:
- Record the start time before making your request to the LLM provider
- Record the end time after receiving the response
- Convert these times to Unix epoch format (seconds and milliseconds)
Example in JavaScript:
Complete Example with Python Requests
Here’s a complete example using Python’s requests
library:
For more examples and detailed usage, check out our Manual Logger with Streaming cookbook.
Was this page helpful?