Cohere
Trace Cohere chat calls with cetra from Python, with the OpenInference Cohere instrumentation.
Install
Section titled “Install”pip install "cetra-sdk[cohere]" cohereSet up
Section titled “Set up”import os
import cetraimport 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()What you get
Section titled “What you get”- Each chat call is an
llmspan with the providercohere. - Input and output token counts come from the response.
- Cost comes from the built-in prices.
Limits
Section titled “Limits”- 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.
- 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.