Registry / llm-agents / llama-index-llms-cohere

llama-index-llms-cohere

JSON →
library0.8.0pypypi✓ verified 84d ago

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.

pip install llama-index-llms-cohere
INSTALL
IMPORT
SIG · LLAMA-INDEX-LLMS-C
L
llama-index-llms-cohere
llm-agentspythonv0.8.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Cohere
from llama_index.llms.cohere import Cohere
Ensure nested module path matches package structure

Instantiate Cohere LLM and generate a completion.

import os from llama_index.llms.cohere import Cohere api_key = os.environ.get('COHERE_API_KEY', '') llm = Cohere(model='command-r', api_key=api_key) response = llm.complete('Hello, how are you?') print(response.text)
Debug
Known issues
deprecatedThe 'cohere' model parameter as string may be deprecated in favor of specific model classes. Always check the latest supported model names.
fix
Use explicit model names like 'command-r', 'command-r-plus', or 'command-light'.
affects: >=0.8.0
gotchaCohere API key must be set via environment variable COHERE_API_KEY or passed directly. Missing key raises a non-obvious authentication error.
fix
Set COHERE_API_KEY in environment or pass api_key parameter.
affects: all
breakingBreaking import path change from legacy llama_index.llms.cohere to llama_index.llms.cohere.Cohere. Previous imports may fail.
fix
Use from llama_index.llms.cohere import Cohere (capitalized class name).
affects: >=0.6.0
Errors
Common errors & fixes
ImportError: cannot import name 'Cohere' from 'llama_index.llms.cohere'
Incorrect import statement trying to import from legacy path.
fix
Use 'from llama_index.llms.cohere import Cohere' (capital C, nested import).
cohere.core.api_error.ApiError: Status code 401: unauthorized
Missing or invalid API key.
fix
Set the environment variable COHERE_API_KEY to your valid Cohere API key.
Upgrade
Version history
0.8.0latest on PyPI · released Mar 12, 2026
Audit
Dependencies
llama-index-corerequiredCore framework required for any LLM integration
cohererequiredOfficial Cohere Python client for API calls
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
llama-index-llms-cohere — pip install llama-index-llms-cohere · libregistry