Groq free tier limits
Quick answer
Groq offers a free tier with limited monthly usage quotas, typically including a set number of tokens or requests per month for their models like llama-3.3-70b-versatile. Exact limits vary and are subject to change, so check Groq's official pricing page for the latest details.
PREREQUISITES
Python 3.8+Groq API key (free tier available)pip install openai>=1.0
Setup
To use Groq's API, install the openai Python package and set your API key as an environment variable.
- Install the package:
pip install openai - Set your API key in your shell:
export GROQ_API_KEY='your_api_key'
pip install openai Step by step
Here is a simple example to call Groq's API using the free tier. Replace os.environ["GROQ_API_KEY"] with your environment variable.
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["GROQ_API_KEY"], base_url="https://api.groq.com/openai/v1")
response = client.chat.completions.create(
model="llama-3.3-70b-versatile",
messages=[{"role": "user", "content": "Hello from Groq free tier!"}]
)
print(response.choices[0].message.content) output
Hello from Groq free tier!
Common variations
You can use different Groq models or enable streaming for real-time token output. The free tier usage applies across all models.
response = client.chat.completions.create(
model="llama-3.1-8b-instant",
messages=[{"role": "user", "content": "Stream this response."}],
stream=True
)
for chunk in response:
print(chunk.choices[0].delta.content or '', end='', flush=True) output
Streamed response text here...
Troubleshooting
If you exceed the free tier limits, you will receive quota errors. Check your usage dashboard on Groq's website and consider upgrading your plan or optimizing token usage.
Also, ensure your GROQ_API_KEY is set correctly to avoid authentication errors.
Key Takeaways
- Groq's free tier includes monthly usage limits on tokens and requests.
- Use the openai SDK with base_url="https://api.groq.com/openai/v1" to access Groq models.
- Monitor your usage to avoid hitting free tier quotas and authentication issues.