Groq Python SDK

0.18.0 · active · verified Sat Feb 28

Official Python SDK for GroqCloud API. OpenAI-compatible interface for ultra-low-latency LLM inference on Groq LPU hardware. Model IDs change frequently as models are deprecated and replaced with no versioned aliases.

Warnings

Install

Imports

Quickstart

Minimal chat completion

import os
from groq import Groq

client = Groq(api_key=os.environ['GROQ_API_KEY'])

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

view raw JSON →