many-forest-60185
09/02/2025, 8:10 AMtall-airline-16756
09/02/2025, 8:10 AMtall-airline-16756
09/02/2025, 8:10 AMpip install "livekit-agents[groq]~=1.2" to grab the package you need.
2. Set Up Authentication: Head over to the Groq Console to get your Groq API key, then pop it into your .env file like this: GROQ_API_KEY=<your-groq-api-key>.
3. Initialize the Groq LLM Instance: Create your instance using the groq.LLM class. Here’s a quick example:
from livekit.plugins import groq
llm_instance = groq.LLM(
model="llama3-8b-8192",
temperature=0.8,
parallel_tool_calls=True,
tool_choice="auto"
)
4. Integrate into an Agent Session: You can mix the LLM with other cool services like STT and TTS to build a full pipeline. For example:
session = AgentSession(
stt=groq.STT(model="whisper-large-v3-turbo"),
llm=llm_instance,
tts=groq.TTS(model="playai-tts", voice="Cheyenne-PlayAI"),
vad=silero.VAD.load()
)
If you want to dive deeper, check out the plugin reference or explore the Groq Voice Assistant GitHub repository. Happy coding!
Sources: Groq LLM integration guide | LiveKit Docs | Groq and LiveKit | LiveKit Docs | Large language model (LLM) integrations | LiveKit Docs | livekit-plugins/livekit-plugins-groq/livekit/plugins/groq/tts.py | Groq integration guide | LiveKit Docsmany-forest-60185
09/02/2025, 8:11 AMtall-airline-16756
09/02/2025, 8:12 AMGROQ_API_KEY is ready—either set in your environment or included in the request headers.
2. Make an HTTP POST Request: Use the endpoint <GROQ_API_BASE_URL>/openai/v1/chat/completions. Your request body should look something like this:
{
"model": "llama-3.3-70b-versatile",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is the weather today?"
}
],
"temperature": 0.7,
"max_tokens": 100
}
3. Example Using Python: Here’s a quick Python snippet using the requests library to get you started:
import requests
url = "<GROQ_API_BASE_URL>/openai/v1/chat/completions"
headers = {
"Authorization": f"Bearer {your_api_key}",
"Content-Type": "application/json"
}
data = {
"model": "llama-3.3-70b-versatile",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the weather today?"}
],
"temperature": 0.7,
"max_tokens": 100
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
This method makes it super simple to plug Groq LLM into any system that supports HTTP requests, including RPC frameworks. If you run into any questions or want a hand with anything else, just let me know—I’m here to help!