Once initialized, all OpenAI calls are captured automatically:
import openaiclient = openai.OpenAI()# This call is automatically tracedresponse = 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)
import OpenAI from 'openai';const openai = new OpenAI();// This call is automatically tracedconst response = await openai.chat.completions.create({ model: 'gpt-4o', messages: [ { role: 'system', content: 'You are a helpful assistant.' }, { role: 'user', content: 'What is the capital of France?' }, ],});console.log(response.choices[0].message.content);