groq
The official Python library for the groq API
Decision gist · record as of 2026-08-14
Yes. Groq is a well-maintained, actively developed official SDK with low install friction, permissive licensing, no known vulnerabilities, and strong type safety. Install it if you need to call the Groq API from Python; it handles authentication, retries, and error classification out of the box. The only prerequisite is Python 3.10+ and a valid API key.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; a valid GROQ_API_KEY environment variable or explicit api_key parameter is required to make API calls.
- Low install friction with a pure-Python wheel and six common dependencies.
- The package is actively maintained with a recent release (21 days old) and an active repository.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), allowing use in commercial and private projects with minimal restrictions beyond attribution.
last release 2026-07-24 (21 days) · last repo commit 2026-08-13 · 613 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 27,568,012 downloads/mo, #857 on PyPI
Alternatives
Verify before relying
pip install groq
import os
from groq import Groq
client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
chat_completion = client.chat.completions.create(
messages=[{"role": "user", "content": "Hello"}],
model="openai/gpt-oss-20b",
)
print(chat_completion.choices[0].message.content)- Whether the library's automatic retry behavior (2 times by default) and timeout handling (1 minute default) meet typical production requirements.
- Performance characteristics of the async client with httpx versus the optional aiohttp backend for high-concurrency workloads.
What it is and what it does
Groq is the official Python SDK for the Groq REST API, generated using Stainless. It wraps HTTP communication to Groq's inference service with type-safe request and response objects, offering both synchronous (Groq) and asynchronous (AsyncGroq) clients built on httpx. The library handles authentication via API key, includes full type hints for IDE autocomplete, and provides Pydantic models for responses with serialization helpers.
Developers use it to integrate Groq's language models into Python applications—typically for chat completions, audio transcription, and other inference tasks. The library manages connection pooling, automatic retries on transient failures, timeouts, and error classification (distinguishing network errors from API status errors). It supports both simple blocking calls and async/await patterns, with an optional aiohttp backend for improved concurrent performance.
Use it for
- Building chatbot or conversational AI applications that call Groq's LLM endpoints with typed message and model parameters.
- Integrating Groq inference into async Python services or event-driven architectures without blocking the event loop.
- Transcribing audio files using Groq's whisper model via the file upload interface with automatic async file reading.
- Handling API errors gracefully by catching specific exception types (RateLimitError, AuthenticationError, etc.) and implementing custom retry logic.
- Developing CLI tools or batch processing scripts that make multiple API calls with automatic exponential backoff on rate limits and server errors.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Groq is a well-maintained, actively developed official SDK with low install friction, permissive licensing, no known vulnerabilities, and strong type safety. Install it if you need to call the Groq API from Python; it handles authentication, retries, and error classification out of the box. The only prerequisite is Python 3.10+ and a valid API key.
Install
groq on PyPI
Before you install
Low install friction with a pure-Python wheel and six common dependencies. The package is actively maintained with a recent release (21 days old) and an active repository.
Requires Python 3.10 or later; a valid GROQ_API_KEY environment variable or explicit api_key parameter is required to make API calls.
License in practice
Licensed under Apache-2.0 (permissive), allowing use in commercial and private projects with minimal restrictions beyond attribution.
Quickstart
pip install groq
import os
from groq import Groq
client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
chat_completion = client.chat.completions.create(
messages=[{"role": "user", "content": "Hello"}],
model="openai/gpt-oss-20b",
)
print(chat_completion.choices[0].message.content)
Verify before relying
- Whether the library's automatic retry behavior (2 times by default) and timeout handling (1 minute default) meet typical production requirements.
- Performance characteristics of the async client with httpx versus the optional aiohttp backend for high-concurrency workloads.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 6 packagesanyiodistrohttpxpydanticsniffiotyping-extensions |
| Maintenance | Actively maintained 21 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 27,568,012 / month, #857 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: POSIXOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python ModulesTyping :: Typed |
Evidence: groq-1.6.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “groq api client python”
- groqProvides a Python client library for accessing the Groq REST API with…
- langchain-groqConnects Groq's inference API to LangChain, enabling language model…
- livekit-plugins-groqIntegrates Groq's fast inference API with LiveKit Agents, enabling…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also openai · sambanova · together · llama-api-client · arcadepy · hiddenlayer-sdk · opencode-ai · llama-stack-client · linq-python · postgrid-python