Integrations
Cohere
Trace Cohere Command-R calls in Muster via the Cohere OpenAI Compatibility API.
Cohere exposes its Command and Command-R models via an OpenAI-compatible API, so you trace Cohere calls in Muster the same way you trace OpenAI: change the import and base URL.
Setup
%pip install openai langfuseimport os
os.environ["LANGFUSE_PUBLIC_KEY"] = "pk-lf..."
os.environ["LANGFUSE_SECRET_KEY"] = "sk-lf..."
os.environ["LANGFUSE_BASE_URL"] = "https://app.getmuster.io"
os.environ["COHERE_API_KEY"] = "..."Use Cohere via the OpenAI SDK
from langfuse.openai import openai
client = openai.OpenAI(
api_key=os.environ["COHERE_API_KEY"],
base_url="https://api.cohere.ai/compatibility/v1",
)Example
response = client.chat.completions.create(
model="command-r7b-12-2024",
messages=[
{"role": "system", "content": "You are an assistant."},
{"role": "user", "content": "Tell me about the benefits of using Cohere with Muster."},
],
name="Cohere-Trace",
)
print(response.choices[0].message.content)