Groq Wrapper

Wrap your Groq client to automatically trace every chat.completions.create() call. Groq uses an OpenAI-compatible API, so the wrapper follows the same pattern.

Installation

pip install twosignal[groq]

Usage

from twosignal import TwoSignal
from twosignal.wrappers.groq import wrap_groq
from groq import Groq

ts = TwoSignal()
client = wrap_groq(Groq(api_key="your-key"))

response = client.chat.completions.create(
    model="llama-3.3-70b-versatile",
    messages=[{"role": "user", "content": "Hello"}],
)

What Gets Captured

FieldDescription
modelModel name (e.g., llama-3.3-70b-versatile)
inputInput messages array
outputResponse content
usage.prompt_tokensInput token count
usage.completion_tokensOutput token count
costEstimated cost in USD

Async

from groq import AsyncGroq

async_client = wrap_groq(AsyncGroq(api_key="your-key"))

Have questions? Join our community!

Connect with other developers and the 2Signal team.

Join Discord