Skip to main content

Documentation Index

Fetch the complete documentation index at: https://traceroot.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Automatically capture all OpenAI Chat Completions and Responses API calls.

Setup

import traceroot
from traceroot import Integration

traceroot.initialize(integrations=[Integration.OPENAI])

Usage

Once initialized, all OpenAI calls are captured automatically:
import openai

client = openai.OpenAI()

# This call is automatically traced
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What is the capital of France?"},
    ],
)

print(response.choices[0].message.content)

What Gets Captured

AttributeDescription
Modelgpt-4o, gpt-4o-mini, o3, etc.
MessagesInput messages array
ResponseCompletion content
TokensPrompt, completion, and total tokens
CostCalculated from token usage and model pricing
LatencyRequest duration

Run the example

Clone the repo and run a complete agent end-to-end.

Python

Run the Python example

TypeScript

Run the TypeScript example