Helicone: Track LLM Costs, Cache Responses, and Rate-Limit Users
Helicone sits between your app and LLM APIs as a one-line proxy - giving you per-user cost attribution, response caching, and rate limiting without changing your application logic.
LLM API costs are invisible until they are not. A single prompt change can double token usage. One user can exhaust your monthly budget in a day. Without visibility, cost optimisation is guesswork. Helicone solves this by acting as a transparent proxy between your application and any LLM API - capturing every request, response, token count, and cost in real time.
One-Line Integration
The entire integration is changing base_url in your OpenAI client:
The dashboard shows cost per user as a histogram - identify heavy users driving disproportionate spend.
Response Caching - Save Up to 80%
Enable semantic or exact caching to avoid re-computing identical or similar requests:
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "What is PagedAttention?"}],
extra_headers={
"Helicone-Cache-Enabled": "true",
"Helicone-Cache-Bucket-Max-Size": "3", # Up to 3 cached variations
},
)
Cache hits return in under 50ms and cost $0. For apps with repeated queries (FAQs, knowledge bases, templates), cache hit rates of 30 - 80% are common.
Rate Limiting Per API Key
extra_headers={
"Helicone-User-Id": "user-456",
"Helicone-RateLimit-Policy": "100;w=86400;u=requests;s=user",
# 100 requests per 24 hours per user
}
Rate limit policies support requests, tokens, or cost as the unit, with per-user or global scope.
Custom Properties for Filtering
Tag requests with arbitrary metadata to slice your dashboard:
Practical deep-dives on LLMs, developer tools, and AI engineering. No filler. Unsubscribe any time.
// written byFIG. AUTH-01
530
Mahmudul Haque Qudrati
CEO & ML Engineer
CEO and ML Engineer at Pristren. Builds AI-powered software for teams and writes about machine learning, LLMs, developer tools, and practical AI applications.