Prerequisites
Before you begin, ensure you have:- Cerebras API Key - Get a free API key here.
- Opik Account - Visit Opik and create a free account to access the logging and evaluation dashboard.
- Python 3.7 or higher
Configure Opik
1
Install required dependencies
Install the Opik SDK and OpenAI client library:The
opik package provides tracking and evaluation functionality, while openai is used to communicate with Cerebras’s OpenAI-compatible API.2
Setup Environment
Create a Replace the placeholder values with your actual API keys and workspace name.
.env file in your project directory with your API keys:The
OPIK_WORKSPACE is simply your Opik username - not a separate workspace name you need to create or find.3
Initialize the Cerebras client with Opik tracking
Set up the OpenAI client to point to Cerebras, and configure Opik to automatically track all requests:This configuration sets up both Opik tracking and the Cerebras client. Remember to add the
X-Cerebras-3rd-Party-Integration header to your API requests using extra_headers for proper tracking.4
Track your first conversation
Use Opik’s Every request made through
track_openai decorator to automatically log conversations:tracked_client will automatically appear in your Opik dashboard with full details including latency, token usage, and model parameters.5
Add custom metadata and tags
Enhance your tracking by adding custom metadata to help organize and filter your logs:This allows you to filter and analyze your logs by user, session, or any custom dimension you define.
Streaming Support
Opik also supports tracking streaming responses from Cerebras. This is useful for real-time applications where you want to display results as they’re generated:Next Steps
- Explore the Opik Dashboard - View your logged conversations, analyze performance metrics, and identify areas for improvement at app.comet.com
- Try Different Cerebras Models - Experiment with
llama-3.3-70b,qwen-3-32b,gpt-oss-120b,zai-glm-4.6, orllama3.1-8bto find the best model for your use case - Set Up Automated Evaluations - Create evaluation pipelines to continuously monitor your model’s quality as you iterate
- Read the Full Opik Documentation - Learn about advanced features like custom metrics, A/B testing, and prompt management at Opik Docs
- Migrate to GLM4.6: Ready to upgrade? Follow our migration guide to start using our latest model
FAQ
Why aren't my requests appearing in the Opik dashboard?
Why aren't my requests appearing in the Opik dashboard?
Make sure you’ve:
- Called
opik.configure()with your API key and workspace before making any requests - Used the
track_openai()wrapper on your client - Checked that your Opik API key is valid in your dashboard settings
- Waited a few seconds for logs to appear (there may be a slight delay)
Can I use Opik with the Cerebras SDK instead of OpenAI?
Can I use Opik with the Cerebras SDK instead of OpenAI?
While the Cerebras SDK is OpenAI-compatible, we recommend using the OpenAI client library (as shown in the examples above) for the best compatibility with Opik’s tracking features. The OpenAI client provides full support for all of Opik’s monitoring and evaluation capabilities.If you need to use the native Cerebras SDK for other reasons, you can still log traces manually using Opik’s manual logging API.
How much does Opik cost?
How much does Opik cost?
Opik offers a generous free tier that includes:
- Unlimited traces and logs
- Up to 5 team members
- 30 days of data retention
Can I self-host Opik?
Can I self-host Opik?
Yes! Opik is open-source and can be self-hosted. Visit the Opik GitHub repository for installation instructions and documentation.
What metrics does Opik support for LLM evaluation?
What metrics does Opik support for LLM evaluation?
Opik provides several built-in metrics including:
- Hallucination Detection - Identifies when the model generates information not supported by the input
- Answer Relevance - Measures how well the response addresses the user’s question
- Moderation - Checks for harmful or inappropriate content
- Custom Metrics - Define your own evaluation criteria using Python functions

