Skip to content

OpenAI

SideSeat automatically extracts model information, token usage, and costs from OpenAI API calls.

  • SideSeat running locally (sideseat)
  • SDK installed (pip install sideseat / uv add sideseat or npm install @sideseat/sdk)
  • OpenAI API credentials configured
from sideseat import SideSeat
SideSeat()
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-5-mini",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)

SideSeat extracts these attributes from OpenAI traces:

AttributeSource
gen_ai.systemopenai
gen_ai.request.modelRequest model parameter
gen_ai.response.modelResponse model field
gen_ai.usage.input_tokensusage.prompt_tokens
gen_ai.usage.output_tokensusage.completion_tokens
gen_ai.request.temperatureTemperature parameter
gen_ai.request.max_tokensMax tokens parameter

Streaming responses are fully captured:

stream = client.chat.completions.create(
model="gpt-5-mini",
messages=[{"role": "user", "content": "Tell me a story"}],
stream=True
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")

Token counts are aggregated from stream chunks.

Tool calls are traced with full details:

tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string"}
}
}
}
}]
response = client.chat.completions.create(
model="gpt-5-mini",
messages=[{"role": "user", "content": "What's the weather in Paris?"}],
tools=tools
)

Image inputs are captured (image data base64-encoded):

response = client.chat.completions.create(
model="gpt-5-mini",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "What's in this image?"},
{"type": "image_url", "image_url": {"url": "data:image/png;base64,..."}}
]
}]
)

SideSeat automatically calculates costs based on:

  • Model pricing (updated regularly)
  • Input token count
  • Output token count

Costs appear in the trace detail view.