aisuite
Trace aisuite calls with cetra through the instrumentation of each provider SDK it wraps.
Install
Section titled “Install”pip install "cetra-sdk[openai,anthropic]" "aisuite[openai,anthropic]"Set up
Section titled “Set up”import aisuite as aiimport cetra
cetra.init(instrument=["openai", "anthropic"])
client = ai.Client()response = client.chat.completions.create( model="openai:gpt-4o-mini", messages=[{"role": "user", "content": "What is the capital of France?"}],)print(response.choices[0].message.content)
cetra.flush()What you get
Section titled “What you get”- The spans come from the instrumentation of the provider SDK that aisuite calls, for the providers that
cetra.initinstruments. - Token counts and cost come from those spans.
Limits
Section titled “Limits”- aisuite calls each provider’s own SDK, so the spans come from that SDK’s instrumentation; a provider without an instrumentation in
cetra-sdkis not traced. - If a field is missing, look at the span’s Attributes tab and compare it with Span attributes.
- Traces: read the trace as a tree and a timeline.
- Cost and tokens: how cost is computed from the token counts.
- Custom model prices: price a model the built-in prices do not cover.