Netra automatically instruments Cohere API calls when you initialize the SDK. The instrumentation captures chat completions, streaming responses, and rerank operations.
Associate Cohere operations with user sessions for better analytics:
from netra import Netraimport cohereNetra.init( app_name="my-cohere-app", headers=f"x-api-key={YOUR_NETRA_API_KEY}")# Set session contextNetra.set_session_id("session-123")Netra.set_user_id("user-456")co = cohere.ClientV2(api_key="your-cohere-api-key")# All subsequent calls are tracked under this sessionresponse = co.chat( model="command-r-plus", messages=[{"role": "user", "content": "Hello"}])
import { Netra } from "netra-sdk";import Cohere from "cohere-ai";await Netra.init({ appName: "my-cohere-app", headers: `x-api-key=${process.env.NETRA_API_KEY}`});// Set session contextNetra.setSessionId("session-123");Netra.setUserId("user-456");const cohere = new Cohere({ apiKey: process.env.COHERE_API_KEY});// All subsequent calls are tracked under this sessionconst response = await cohere.chat({ model: "command-r-plus", message: "Hello"});