Skip to main content
Available for: Python and TypeScript.
Wrap your Cohere ClientV2 with wrapCohere() (TypeScript) to trace chat() and chatStream() calls — or patch the cohere module with patch_cohere() (Python).

Installation

Setup

In TypeScript, wrapCohere() returns a wrapped client instance. In Python, patch_cohere() patches ClientV2.chat and ClientV2.chat_stream at the class level, so every client constructed afterward is traced automatically.

Example

chatStream() (TypeScript) and chat_stream() (Python) are traced end-to-end in both languages, including time-to-first-token — parsed from Cohere’s content-delta, tool-call-start/tool-call-delta, and message-end stream events.

What gets captured

Cohere’s response text lives in message.content, a list of typed blocks ({type: "text", text: "..."}) rather than a plain string — the wrapper flattens this automatically before storing prompt/completion text.