{"id":23973,"library":"livekit-plugins-xai","title":"LiveKit Plugins xAI","description":"Plugin for the LiveKit Agents framework integrating xAI's Grok models for LLM and TTS inference. Current version 1.5.7, released as part of the livekit-agents monorepo with weekly releases.","status":"active","version":"1.5.7","language":"python","source_language":"en","source_url":"https://github.com/livekit/agents/tree/main/livekit-plugins/livekit-plugins-xai","tags":["livekit","xai","grok","agent","plugin","tts","llm"],"install":[{"cmd":"pip install livekit-plugins-xai","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core framework dependency; plugin cannot be used without it","package":"livekit-agents","optional":false},{"reason":"xAI plugin inherits from OpenAI plugin classes due to API compatibility","package":"livekit-plugins-openai","optional":true}],"imports":[{"note":"Class is named LLM, not xAILLM","wrong":"from livekit.plugins.xai import xAILLM","symbol":"LLM","correct":"from livekit.plugins.xai import LLM"},{"note":"TTS class available since v1.5.5","symbol":"TTS","correct":"from livekit.plugins.xai import TTS"}],"quickstart":{"code":"import os\nfrom livekit.plugins.xai import LLM, TTS\n\n# Ensure XAI_API_KEY is set in environment\nllm = LLM()\ntts = TTS()\n\nresult = llm.chat([{\"role\": \"user\", \"content\": \"Hello\"}])\nprint(result)\n\n# TTS example\naudit = tts.synthesize(\"Hello from xAI\")\nprint(audio)","lang":"python","description":"Initialize xAI LLM and TTS with API key from environment variable XAI_API_KEY."},"warnings":[{"fix":"Use only basic chat completion features; avoid function calling and response_format with JSON schema.","message":"The xAI plugin inherits from the OpenAI plugin's LLM and TTS classes, but xAI does not support all OpenAI features (e.g., structured output, function calling). Errors may occur if those are used.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Run `pip install livekit-plugins-xai` and update imports to `from livekit.plugins.xai import ...`","message":"The xAI plugin was previously part of the main livekit-agents package and imported from `livekit.plugins.xai` only after becoming a separate plugin. Users migrating from older livekit-agents must install `livekit-plugins-xai`.","severity":"breaking","affected_versions":"pre-1.0.0 vs >=1.0.0"},{"fix":"Replace `LLM.with_groq(...)` with `LLM(...)`.","message":"The `livekit.plugins.xai.LLM.with_groq` alias from earlier beta is removed. Use `LLM()` directly.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `pip install livekit-plugins-xai`","cause":"The xai plugin package is not installed.","error":"ModuleNotFoundError: No module named 'livekit.plugins.xai'"},{"fix":"Set the model via `LLM(model='grok-2-latest')` or check available models in xAI docs.","cause":"Using a model name that xAI does not support or the API key does not have access to.","error":"openai.NotFoundError: 404 (request ID: ...) - The model `grok-1` does not exist or you do not have access to it."},{"fix":"Use `from livekit.plugins.xai import LLM` instead.","cause":"Incorrect import name from earlier documentation.","error":"AttributeError: module 'livekit.plugins.xai' has no attribute 'xAILLM'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}