Skip to content
GitHubLog inStart free
cetra is not released yet. These docs describe the development version.

aisuite

Trace aisuite calls with cetra through the instrumentation of each provider SDK it wraps.

Terminal window
pip install "cetra-sdk[openai,anthropic]" "aisuite[openai,anthropic]"
import aisuite as ai
import 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()
  • The spans come from the instrumentation of the provider SDK that aisuite calls, for the providers that cetra.init instruments.
  • Token counts and cost come from those spans.
  • aisuite calls each provider’s own SDK, so the spans come from that SDK’s instrumentation; a provider without an instrumentation in cetra-sdk is not traced.
  • If a field is missing, look at the span’s Attributes tab and compare it with Span attributes.