What is Maxim?
Maxim is an AI observability and evaluation platform that helps teams monitor, trace, and improve their LLM applications in production. With Maxim, you can track model performance, debug issues, and gain insights into your AI workflows. Learn more at https://www.getmaxim.ai/Prerequisites
Before you begin, ensure you have:- Cerebras API Key - Get a free API key here.
- Maxim Account - Visit Maxim and create an account or log in.
- Go to Settings to generate your Maxim API key.
- Python 3.11 or higher
Configure Maxim
Configure environment variables
Create a
.env file in your project directory:You can find your
MAXIM_LOG_REPO_ID in your Maxim dashboard under Settings > Log Repositories.Initialize Maxim and instrument your client
Set up the Maxim logger to automatically track all API calls to Cerebras:
Make your first traced request
Make API calls to Cerebras as usual. Maxim will automatically capture all details:
View traces in your dashboard
Log in to your Maxim dashboard to see all logged requests. You can filter by model, date range, or custom metadata, and view detailed information including conversation history, token usage, latency metrics, and model parameters.
Advanced Usage
Custom Metadata with Headers
You can add custom metadata to your traces using extra headers. This helps organize and filter your logs in Maxim by user, session, or feature.Streaming Responses
Maxim supports tracing streaming responses from Cerebras. The instrumentation automatically handles streaming data and captures the complete response.Multi-Model Workflows
Track multiple LLM calls in sequence. Each call is automatically traced in your Maxim dashboard:Monitoring and Alerts
Maxim provides powerful monitoring capabilities to help you track your application’s performance and set up alerts for issues or anomalies.View Traces in Dashboard
- Log in to your Maxim dashboard
- Navigate to the Traces section to see all your logged requests
- Filter by model, date range, or custom metadata
- Click on individual traces to see detailed information including:
- Full conversation history
- Token usage and costs
- Latency metrics
- Model parameters
- Custom metadata
Set Up Alerts
You can configure alerts to notify you of issues or anomalies. Visit the Maxim alerts documentation to learn how to:- Create alerts for high latency or error rates
- Monitor token usage and costs
- Track model performance metrics
- Get notified via email, Slack, or webhooks
Evaluations and Testing
Maxim provides built-in evaluation capabilities through their dashboard to help you measure and improve your LLM application’s quality. All traced requests are automatically available for evaluation. To set up evaluations:- Log in to your Maxim dashboard
- Navigate to Evaluations to create custom evaluators
- Define metrics like accuracy, relevance, and coherence
- Run evaluations on your traced requests
- View results and insights in the dashboard
Troubleshooting
Traces not appearing in dashboard
Traces not appearing in dashboard
If your traces aren’t showing up in the Maxim dashboard:
- Verify your
MAXIM_API_KEYis correct and has the necessary permissions - Check that you wrapped your OpenAI client with
MaximOpenAIClientbefore making API requests - Ensure your network allows outbound connections to Maxim’s API
- Look for error messages in your application logs
- Verify you’re using the latest version of
maxim-py(runpip install --upgrade maxim-py)
Authentication errors
Authentication errors
If you’re seeing authentication errors:
- Double-check that both
CEREBRAS_API_KEYandMAXIM_API_KEYare set correctly in your.envfile - Ensure you’ve called
load_dotenv()before initializing the clients - Verify your API keys haven’t expired or been revoked
- Check that your Cerebras API key is active at cloud.cerebras.ai
Missing streaming data
Missing streaming data
If streaming responses aren’t being captured:
- Make sure you’re using the latest version of
maxim-py(runpip install --upgrade maxim-py) - Verify that the instrumentation is applied before creating streaming requests
- Check that you’re iterating through all chunks in the stream
- Ensure you’re not catching and suppressing exceptions during streaming
High latency in traces
High latency in traces
If you notice higher latency than expected:
- The instrumentation adds minimal overhead (typically less than 10ms)
- Check your network connection to both Cerebras and Maxim APIs
- Review your Maxim dashboard to identify if the latency is from the LLM call or logging
- Consider using async logging if you need to minimize impact on response times
- Verify you’re using the closest Cerebras region for optimal performance
Custom metadata not appearing
Custom metadata not appearing
If custom metadata isn’t showing up in your traces:
- Ensure you’re using the
log()context manager correctly - Verify that metadata is passed as a dictionary with string keys
- Check that you’re not exceeding metadata size limits (typically 10KB per trace)
- Make sure the metadata is added before the API call is made
Next Steps
Maxim Documentation
Explore advanced features and capabilities
Evaluations Guide
Learn about evaluation and testing
Agno Integration
Build multi-agent systems with Agno
Cerebras Models
Explore available Cerebras models
For additional support, visit the Maxim support page or contact their team directly.

