Integrations / Groq

Trace Groq API calls

To trace Groq with Tracify, wrap the Groq client with the Tracify SDK. Its chat.completions calls are recorded with the model, tokens, latency and any error. The OpenAI client pointed at Groq works the same way.

Your code

Groq

Tracify

One run.

  • 01Groq model name
  • 02Prompt and completion tokens
  • 03Latency, including streamed responses
  • 04Rate-limit errors in order

Setup

5 steps.

  1. 01

    Install

    Use Groq's own library, or the OpenAI one if you prefer.

    bash
    pip install tracify-sdk groq
  2. 02

    Set your project key

    Create a project in Tracify, copy its API key and put it in the environment where your code runs. The SDK reads it from there, so nothing is hard-coded.

    bash
    export TRACIFY_API_KEY="tracify_sk_live_..."
  3. 03

    Wrap the Groq client

    Groq's library has the same chat.completions shape as OpenAI's, so the OpenAI wrapper records it. GROQ_API_KEY is read by Groq's library as usual.

    python
    import tracify
    from groq import Groq
    
    groq = tracify.wrap_openai(Groq())
    
    reply = groq.chat.completions.create(
        model="llama-3.3-70b-versatile",
        messages=[{"role": "user", "content": "Hello"}],
    )
  4. 04

    Or use the OpenAI client

    Point the OpenAI library at Groq's compatible endpoint. In TypeScript this is the simplest route.

    typescript
    import OpenAI from "openai";
    import { wrapOpenAI } from "tracify-sdk";
    
    const groq = wrapOpenAI(
      new OpenAI({
        apiKey: process.env.GROQ_API_KEY,
        baseURL: "https://api.groq.com/openai/v1",
      }),
    );
    
    const reply = await groq.chat.completions.create({
      model: "llama-3.3-70b-versatile",
      messages: [{ role: "user", content: "Hello" }],
    });
  5. 05

    Run it once and look

    Run your code one time, then open the Tracing page of your project. Your Groq call shows up as a run with its steps in order, plus the tokens, time and any error for each call.

Good to know

Shown with the OpenAI label

The wrapper reads the OpenAI call format, so calls are labeled as OpenAI-style in the trace. The model name you send is always the one shown, so you can still tell models apart.

Good to know

Fast models, many calls

Groq is quick, so agents tend to make many calls. In the run you can see every call in order with its time, which makes slow tool steps stand out.

Good to know

About cost

Tracify records the tokens the provider returns. A dollar cost is shown when you give the wrapper your own rates with calculate_cost (Python) or calculateCost (TypeScript), so the number always matches your real price plan.

Full details in the documentation. All integrations are listed on the integrations page.

Does tracing Groq change my requests or responses?
No. The wrapper passes your call straight through and records a copy. Your request, the response and any error reach your code unchanged.
Does streaming work?
Yes. The wrapper records streamed responses, including the time to first token, and the stream reaches your code unchanged.
Will rate-limit errors show up?
Yes. A 429 from Groq is recorded on the call and raised again, so you can see exactly when you were limited.

Send your first trace.

Free to start.