{"id":27928,"library":"llama-index-llms-cohere","title":"LlamaIndex LLMs Cohere","description":"Integration between LlamaIndex and Cohere's language models, enabling the use of Cohere's command and embed models within LlamaIndex workflows. Current version 0.8.0, supporting Python >=3.10. Release cadence is aligned with llama-index core updates, approximately bi-weekly.","status":"active","version":"0.8.0","language":"python","source_language":"en","source_url":"https://github.com/run-llama/llama_index","tags":["llama-index","llm","cohere","rag","genai"],"install":[{"cmd":"pip install llama-index-llms-cohere","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core framework required for any LLM integration","package":"llama-index-core","optional":false},{"reason":"Official Cohere Python client for API calls","package":"cohere","optional":false}],"imports":[{"note":"Ensure nested module path matches package structure","symbol":"Cohere","correct":"from llama_index.llms.cohere import Cohere"}],"quickstart":{"code":"import os\nfrom llama_index.llms.cohere import Cohere\n\napi_key = os.environ.get('COHERE_API_KEY', '')\nllm = Cohere(model='command-r', api_key=api_key)\nresponse = llm.complete('Hello, how are you?')\nprint(response.text)","lang":"python","description":"Instantiate Cohere LLM and generate a completion."},"warnings":[{"fix":"Use explicit model names like 'command-r', 'command-r-plus', or 'command-light'.","message":"The 'cohere' model parameter as string may be deprecated in favor of specific model classes. Always check the latest supported model names.","severity":"deprecated","affected_versions":">=0.8.0"},{"fix":"Set COHERE_API_KEY in environment or pass api_key parameter.","message":"Cohere API key must be set via environment variable COHERE_API_KEY or passed directly. Missing key raises a non-obvious authentication error.","severity":"gotcha","affected_versions":"all"},{"fix":"Use from llama_index.llms.cohere import Cohere (capitalized class name).","message":"Breaking import path change from legacy llama_index.llms.cohere to llama_index.llms.cohere.Cohere. Previous imports may fail.","severity":"breaking","affected_versions":">=0.6.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use 'from llama_index.llms.cohere import Cohere' (capital C, nested import).","cause":"Incorrect import statement trying to import from legacy path.","error":"ImportError: cannot import name 'Cohere' from 'llama_index.llms.cohere'"},{"fix":"Set the environment variable COHERE_API_KEY to your valid Cohere API key.","cause":"Missing or invalid API key.","error":"cohere.core.api_error.ApiError: Status code 401: unauthorized"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}