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} |
{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:
Note: The timing
field is optional. If not provided, Helicone will automatically set the current time as both start and end time.
Token Tracking
Helicone supports token tracking for custom model integrations. To enable this, include ausage
object in your providerResponse.json
. Here are the supported formats:
OpenAI-style Format
Anthropic-style Format
Google-style Format
Alternative Format
Advanced Usage
Adding Custom Properties
You can add custom properties to your requests by including them in themeta
field:
Session Tracking
To group requests into sessions, include a session ID in themeta
field:
User Tracking
To associate requests with specific users, include a user ID in themeta
field:
Calculating Timing Information
The timing information is optional but recommended for accurate latency metrics. It 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)
Regional Support: Helicone supports both US and EU regions for caching. In development/preview environments, both regions use the same cache URL, while in production they use region-specific endpoints.Example in JavaScript:
Complete Example with Python Requests
Here’s a complete example using Python’srequests
library:
Examples
Basic Example
String Response Example
You can now log string responses directly using thetextBody
field:
Time to First Token Example
For streaming responses, you can include the time to first token:timeToFirstToken
is measured in milliseconds.