Skip to main content

Groq

https://groq.com/

We support ALL Groq models, just set groq/ as a prefix when sending completion requests

API Key​

# env variable
os.environ['GROQ_API_KEY']

Sample Usage​

from litellm import completion
import os

os.environ['GROQ_API_KEY'] = ""
response = completion(
model="groq/llama2-70b-4096",
messages=[
{"role": "user", "content": "hello from litellm"}
],
)
print(response)

Sample Usage - Streaming​

from litellm import completion
import os

os.environ['GROQ_API_KEY'] = ""
response = completion(
model="groq/llama2-70b-4096",
messages=[
{"role": "user", "content": "hello from litellm"}
],
stream=True
)

for chunk in response:
print(chunk)

Supported Models - ALL Groq Models Supported!​

We support ALL Groq models, just set groq/ as a prefix when sending completion requests

Model NameFunction Call
llama2-70b-4096completion(model="groq/llama2-70b-4096", messages)
mixtral-8x7b-32768completion(model="groq/mixtral-8x7b-32768", messages)