{"id":23120,"library":"llama-index-llms-groq","title":"LlamaIndex Groq LLM Integration","description":"LlamaIndex integration for Groq LLMs, providing high-speed inference via Groq's hardware-accelerated API. Version 0.5.0 requires Python 3.10+ and supports LlamaIndex v0.11+ with the new import structure. Released on PyPI; updates follow LlamaIndex releases.","status":"active","version":"0.5.0","language":"python","source_language":"en","source_url":"https://github.com/run-llama/llama_index/tree/main/llama-index-integrations/llms/llama-index-llms-groq","tags":["llama-index","groq","llm","ai","integration"],"install":[{"cmd":"pip install llama-index-llms-groq","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core LlamaIndex dependency, provides base classes like BaseLLM","package":"llama-index-core","optional":false},{"reason":"Official Groq Python client for API calls","package":"groq","optional":false}],"imports":[{"note":"Correct import path; the class is named 'Groq' directly.","wrong":"from llama_index.llms.groq import Groq as GroqLLM","symbol":"Groq","correct":"from llama_index.llms.groq import Groq"},{"note":"No deprecated alias exists; use the standard import.","wrong":"from llama_index.llms.groq import GroqDeprecated","symbol":"Groq","correct":"from llama_index.llms.groq import Groq"}],"quickstart":{"code":"import os\n\nfrom llama_index.llms.groq import Groq\n\napi_key = os.environ.get(\"GROQ_API_KEY\", \"\")\nif not api_key:\n    raise ValueError(\"Set GROQ_API_KEY environment variable\")\n\nllm = Groq(model=\"mixtral-8x7b-32768\", api_key=api_key)\nresponse = llm.complete(\"What is Groq?\")\nprint(response)","lang":"python","description":"Instantiate Groq LLM and call complete()"},"warnings":[{"fix":"Run 'pip install llama-index-llms-groq' and update all import paths to 'from llama_index.llms.groq import Groq'","message":"LlamaIndex v0.11 introduced a new package structure: 'llama-index-llms-groq' instead of the old monolithic 'llama-index' plus 'llama-index[groq]'. Code using 'from llama_index.llms import Groq' from the old package must be updated to 'from llama_index.llms.groq import Groq'.","severity":"breaking","affected_versions":"<0.11"},{"fix":"Install 'llama-index-llms-groq' explicitly","message":"The 'llama-index' meta-package (version <0.11) included all integrations by default. As of v0.11, integrations are separate packages to reduce bloat. The meta-package no longer includes Groq automatically.","severity":"deprecated","affected_versions":"<0.11"},{"fix":"Always provide 'api_key' parameter or configure via environment variable in your code.","message":"The package does not automatically load the GROQ_API_KEY from environment variables; you must pass it explicitly or set it via 'llm = Groq(model=..., api_key=os.environ[\"GROQ_API_KEY\"])'.","severity":"gotcha","affected_versions":"all"},{"fix":"Use models with larger context windows (e.g., 'llama3-70b-8192' has 8k, 'gemma2-9b-it' has 8k) or chunk input.","message":"Some models are token-limited (e.g., 'mixtral-8x7b-32768' has 32k context). Exceeding the limit will raise a 'ValueError: Request too large for model...'. Check model limits before streaming long documents.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install llama-index-llms-groq' (installs 'llama-index-core' automatically). Alternatively, install full suite: 'pip install llama-index llama-index-llms-groq'.","cause":"LlamaIndex core is not installed; 'llama-index-llms-groq' only depends on 'llama-index-core', not the full 'llama-index' meta-package.","error":"ModuleNotFoundError: No module named 'llama_index'"},{"fix":"Use 'from llama_index.llms.groq import Groq'","cause":"Old-style import path. In LlamaIndex v0.11+, the LLM classes are in subpackages 'llama_index.llms.<provider>'.","error":"ImportError: cannot import name 'Groq' from 'llama_index.llms'"},{"fix":"Set environment variable 'GROQ_API_KEY' or pass 'api_key' parameter when initializing Groq.","cause":"Missing API key; the package does not read env vars automatically.","error":"AuthenticationError: API key not found. Pass your API key via the 'api_key' parameter or set the 'GROQ_API_KEY' environment variable."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}