Using Langtrace to monitor your xAI apps is quick and easy. Follow these steps:

Setup

  1. Install the Langtrace and xAI SDKs.

Note: You’ll need API keys from Langtrace and xAI. Sign up for Langtrace and/or xAI if you haven’t done so already.

Python
# Install the SDK
pip install -U langtrace-python-sdk openai
  1. Setup environment variables:
Shell
export LANGTRACE_API_KEY=YOUR_LANGTRACE_API_KEY
export XAI_API_KEY=YOUR_OPENAI_API_KEY

Usage

Generate a simple output with your deployment’s model:

You can now view your traces on the Langtrace dashboard: