Skip to main content

Overview

Laminar automatically instruments the official Cohere Python SDK with a single line of code, allowing you to trace and monitor all your Cohere API calls without modifying your existing code. This provides complete visibility into your AI application’s performance, costs, and behavior.

Getting Started (Python)

1. Install Laminar and Cohere

2. Set up your environment variables

Store your API keys in a .env file:

3. Initialize Laminar and Cohere client

Just add a single line at the start of your application or file to instrument Cohere with Laminar.

Use Cohere as usual

After initialization, make API calls to Cohere exactly as you normally would. Laminar will automatically capture traces for Chat, Embed, and Rerank endpoints.

Chat (Command family)

Streaming Chat

RAG with Documents (Observed Pipeline)

Rerank

Semantic Search (Embeddings)

All Cohere API calls are now automatically traced in Laminar.

Monitoring Your Cohere Usage

After instrumenting your Cohere calls with Laminar, you’ll be able to:
  1. View detailed traces of each Cohere API call, including request and response
  2. Track token usage and cost across different models
  3. Monitor latency and performance metrics
  4. Open LLM span in Playground for prompt engineering
  5. Debug issues with failed API calls or unexpected model outputs
Visit your Laminar dashboard to view your Cohere traces and analytics.

Advanced Features

  • Enrich traces with sessions, user IDs, metadata, and tags via the SDK reference.
  • Wrap custom functions with observe to capture business logic alongside model calls (see the SDK reference).