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

Cohere

Trace Cohere chat calls with cetra from Python, with the OpenInference Cohere instrumentation.

Terminal window
pip install "cetra-sdk[cohere]" cohere
import os
import cetra
import cohere
cetra.init(instrument=["cohere"])
client = cohere.ClientV2(api_key=os.environ["COHERE_API_KEY"])
response = client.chat(
model="command-a-03-2025",
messages=[{"role": "user", "content": "What is the capital of France?"}],
)
print(response.message.content[0].text)
cetra.flush()
  • Each chat call is an llm span with the provider cohere.
  • Input and output token counts come from the response.
  • Cost comes from the built-in prices.
  • Only non-streaming chat is captured.
  • Cohere’s response carries no model name, so the span shows the model in the request.
  • The fixtures were captured with cohere 7.3.1 and openinference-instrumentation-cohere 0.1.22.
  • If a field is missing, look at the span’s Attributes tab and compare it with Span attributes.