Skip to main content

Overview

Groq provides ultra-fast inference for open-source LLMs like Llama, Mixtral, and Gemma with speeds up to 500+ tokens/second.

Installation

Basic Usage

Constructor Options

string
required
Groq model name
string
Groq API key (defaults to GROQ_API_KEY env variable)
number
Sampling temperature
number
Maximum tokens in response
number
default:1
Nucleus sampling parameter

Supported Models

Llama 3.1

  • llama-3.1-405b-reasoning: Most capable
  • llama-3.1-70b-versatile: Balanced performance
  • llama-3.1-8b-instant: Fastest

Llama 3

  • llama3-70b-8192: 70B parameter model
  • llama3-8b-8192: 8B parameter model

Mixtral

  • mixtral-8x7b-32768: Mixtral MoE model

Gemma

  • gemma-7b-it: Google Gemma 7B
  • gemma2-9b-it: Gemma 2 9B

Streaming

Function Calling

Structured Output

Configuration

Environment Variables

Global Settings

Performance

Groq’s LPU (Language Processing Unit) delivers exceptional speed:
Typical speeds: 300-500 tokens/second

With LlamaIndex

Model Selection Guide

Rate Limits

Groq has generous free tier limits:
  • Free: 30 requests/minute
  • Paid: Higher limits based on plan
Handle rate limits:

Best Practices

  1. Use for production: Groq’s speed excellent for real-time applications
  2. Choose right model: Balance speed vs capability
  3. Monitor usage: Track API calls and costs
  4. Stream responses: Even better UX with Groq’s speed
  5. Handle rate limits: Implement retry logic

See Also