翻篇收录说明
翻篇网页快照

Get Started with Helicone - Cerebras Inference

https://inference-docs.cerebras.ai/integrations/helicone

最近抓取:2026-12-03 17:02:00(北京时间)

最近内容变化:2026-12-03 17:02:00(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Learn how to monitor, debug, and optimize your Cerebras Inference API calls using Helicone's observability platform.

正文摘录

What is Helicone? Helicone is an open-source observability platform for LLM applications that provides logging, monitoring, and analytics for your AI API calls. With Helicone, you can track usage, debug issues, analyze costs, and optimize performance across all your Cerebras Inference requests. Learn more at https://www.helicone.ai/ Key features include: Request Logging - Automatically log all API requests and responses Cost Tracking - Monitor spending across models and users Performance Analytics - Analyze latency, token usage, and throughput Custom Properties - Tag requests for filtering and analysis User Tracking - Monitor usage by user or session Caching - Reduce costs with semantic caching Prerequisites Before you begin, ensure you have: Cerebras API Key - Get a free API key here. Helicone Account - Visit Helicone and create a free account. Helicone API Key - After signing up, generate an API key from your Helicone dashboard. Python 3.11 or higher (for Python examples) Configure Helicone 1Install required dependenciesInstall the OpenAI Python SDK, which is compatible with Cerebras Inference:pip install openai python-dotenv The python-dotenv package helps manage your API keys securely through environment variables.2Configure environment variablesCreate a .env file in your project directory with your API keys:CEREBRAS_API_KEY=your-cerebras-api-key-here HELICONE_API_KEY=your-helicone-api-key-here The Helicone API key enables authentication and links your requests to your Helicone account for monitoring and analytics. Keep these keys secure and never commit them to version control.3Initialize the client with HeliconeSet up the OpenAI client to route requests through Helicone’s proxy. This configuration automatically logs all your Cerebras API calls to Helicone without requiring any code changes to your existing application logic:PythoncURLimport os from openai import OpenAI from dotenv import load_dotenv load_dotenv() client = OpenAI( api_key=os.getenv("CEREBRAS_API_KEY"), base_url="https://cerebras.helicone.ai/v1", default_headers={ "Helicone-Auth": f"Bearer {os.getenv('HELICONE_API_KEY')}", "X-Cerebras-3rd-Party-Integration": "Helicone" } ) The base_url points to Helicone’s Cerebras proxy endpoint (https://cerebras.helicone.ai/v1), which forwards requests to Cerebras while capturing metrics. The Helicone-Auth header authenticates your requests with Helicone.4Make your first requestNow you can make API calls as usual. Helicone will automatically log the request, response, latency, and token usage:Pythonimport os from openai import OpenAI from dotenv import load_dotenv load_dotenv() client = OpenAI( api_key=os.getenv("CEREBRAS_API_KEY"), base_url="https://cerebras.helicone.ai/v1", default_headers={ "Helicone-Auth": f"Bearer {os.getenv('HELICONE_API_KEY')}", "X-Cerebras-3rd-Party-Integration": "Helicone" } ) response = client.chat.completions.create( model="gpt-oss-120b", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain what observability means in AI applications."} ], max_tokens=150, temperature=0.7 ) print(response.choices[0].message.content) After running this code, visit your Helicone dashboard to see the logged request with full details including prompt, response, latency, and token counts.5View your logs in HeliconeNavigate to your Helicone dashboard to view detailed logs of your requests. You’ll see: Complete request and response data Token usage and cost breakdowns Latency metrics and performance trends Custom properties and user tracking data Error logs and debugging information The dashboard provides powerful filtering and search capabilities to help you analyze your AI application’s behavior and optimize performance. Advanced Features Custom Properties Add custom metadata to your requests for better filtering and analysis in the Helicone dashboard. Custom properties help you segment your data by environment, feature, user cohort, or any other dimension relevant to your application: Pythonimport os from openai import OpenAI from dotenv import load_dotenv load_dotenv() client = OpenAI( api_key=os.getenv("CEREBRAS_API_KEY"), base_url="https://cerebras.helicone.ai/v1", default_headers={ "Helicone-Auth": f"Bearer {os.getenv('HELICONE_API_KEY')}", "X-Cerebras-3rd-Party-Integration": "Helicone" } ) response = client.chat.completions.create( model="gpt-oss-120b", messages=[ {"role": "user", "content": "What is machine learning?"} ], extra_headers={ "Helicone-Property-Environment": "production", "Helicone-Property-User-Id": "user-123", "Helicone-Property-Session-Id": "session-456", "Helicone-Property-Feature": "chat-assistant" } ) These custom properties allow you to: Filter requests by environment (development, staging, production) Track usage per user or session Analyze performance across different features or segments Create custom dashboards and reports Learn more about custom properties in the Helicone documentation. User Tracking Track requests by user to monitor individual usage patterns, costs, and behavior. User tracking helps you understand how different users interact with your AI application and identify power users or potential issues: Pythonimport os from openai import OpenAI from dotenv import load_dotenv load_dotenv() client = OpenAI( api_key=os.getenv("CEREBRAS_API_KEY"), base_url="https://cerebras.helicone.ai/v1", default_headers={ "Helicone-Auth": f"Bearer {os.getenv('HELICONE_API_KEY')}", "X-Cerebras-3rd-Party-Integration": "Helicone" } ) response = client.chat.completions.create( model="gpt-oss-120b", messages=[ {"role": "user", "content": "Summarize this article..."} ], extra_headers={ "Helicone-User-Id": "user@example.com" } ) The Helicone-User-Id header associates requests with specific users, enabling per-user analytics and cost tracking in your dashboard. Caching Enable semantic caching to reduce costs and latency for similar requests. Helicone’s intelligent caching can match semantically similar queries even if they’re not identical, significantly reducing API costs for common questions: Pythonimport os from openai import OpenAI from dotenv import load_dotenv load_dotenv() client = OpenAI( api_key=os.getenv("CEREBRAS_API_KEY"), base_url="https://cerebras.helicone.ai/v1", default_headers={ "Helicone-Auth": f"Bearer {os.getenv('HELICONE_API_KEY')}", "X-Cerebras-3rd-Party-Integration": "Helicone" } ) response = client.chat.completions.create( model="gpt-oss-120b", messages=[ {"role": "user", "content": "What is the capital of France?"} ], extra_headers={ "Helicone-Cache-Enabled": "true" } ) Helicone’s semantic cache can match similar queries even if they’re not identical, significantly reducing API costs for common questions. Configure cache settings and time-to-live (TTL) in your Helicone dashboard. Explore advanced caching options in the Helicone caching documentation. Streaming Responses Helicone fully supports streaming responses from Cerebras, logging complete metrics once the stream completes. Streaming is ideal for real-time applications where you want to display responses as they’re generated: Pythonimport os from openai import OpenAI from dotenv import load_dotenv load_dotenv() client = OpenAI( api_key=os.getenv("CEREBRAS_API_KEY"), base_url="https://cerebras.helicone.ai/v1", default_headers={ "Helicone-Auth": f"Bearer {os.getenv('HELICONE_API_KEY')}", "X-Cerebras-3rd-Party-Integration": "Helicone" } ) stream = client.chat.completions.create( model="gpt-oss-120b", messages=[ {"role": "user", "content": "Write a short story about AI."} ], stream=True ) for chunk in stream: if chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="") Streaming requests are logged with complete metrics including total tokens, latency, and cost once the stream completes. Request Tagging and Feedback Tag requests and add feedback scores to track quality and performance over time. This is particularly useful for evaluating model outputs and identifying areas for improvement: Pythonimport os from openai import OpenAI from dotenv import load_dotenv load_dotenv() client = OpenAI( api_key=os.getenv("CEREBRAS_API_KEY"), base_url="https://cerebras.helicone.ai/v1", default_headers={ "Helicone-Auth": f"Bearer {os.getenv('HELICONE_API_KEY')}", "X-Cerebras-3rd-Party-Integration": "Helicone" } ) response = client.chat.completions.create( model="gpt-oss-120b", messages=[ {"role": "user", "content": "Explain quantum computing."} ], extra_headers={ "Helicone-Request-Id": "req-123", "Helicone-Property-Prompt-Version": "v2.1" } ) # Later, add feedback via Helicone API # This helps track which responses were helpful Monitoring Your Usage After making requests, you can leverage Helicone’s comprehensive dashboard to gain insights into your AI application: View Request Logs - See all requests with timestamps, models, prompts, and responses in the Helicone dashboard Analyze Costs - Track spending across different models, users, and time periods with detailed cost breakdowns Monitor Performance - Visualize latency trends, identify slow requests, and optimize your application’s responsiveness Filter by Properties - Use custom properties to segment your analytics by environment, feature, user cohort, or any custom dimension Set Up Alerts - Configure notifications for usage thresholds, error rates, or cost limits to stay informed Export Data - Download logs and analytics for further analysis or compliance requirements The dashboard provides real-time insights and historical trends to help you understand your AI application’s behavior and make data-driven optimization decisions. Frequently Asked Questions How does Helicone affect request latency?Helicone adds minimal latency (typically 10-50ms) to your requests. The proxy architecture is optimized for performance, and the observability benefits far outweigh the small latency overhead. For latency-critical applications, you can use Helicone’s async logging mode.Can I use Helicone with multiple