None
Cohere Python SDK
The Cohere Python SDK allows access to Cohere models across many different platforms: the cohere platform, AWS (Bedrock, Sagemaker), Azure, GCP and Oracle OCI. For a full list of support and snippets, please take a look at the SDK support docs page.
Documentation
Cohere documentation and API reference is available here.
Installation
pip install cohere
Usage
import cohere
co = cohere.Client(
api_key="YOUR_API_KEY",
)
chat = co.chat(
message="hello world!",
model="command"
)
print(chat)
[!TIP]
You can set a system environment variable CO_API_KEY to avoid writing your api key within your code, e.g. add export CO_API_KEY=theapikeyforyouraccount
in your ~/.zshrc or ~/.bashrc, open a new terminal, then code calling cohere.Client() will read this key.
Streaming
The SDK supports streaming endpoints. To take advantage of this feature for chat,
use chat_stream.
import cohere
co = cohere.Client(
api_key="YOUR_API_KEY",
)
stream = co.chat_stream(
- RPM
- python3-cohere-5.20.6-1.lbn42.noarch.rpm
- Summary
- None
- URL
- https://pypi.org/project/cohere
- Group
- Unspecified
- License
- ZPL
- Source
-
python-cohere-5.20.6-1.lbn42.src.rpm
- Checksum
- e8b6774c23dfe65d6318d59df2419299aa556d01488c3d1863e638ea09eec2c7
- Signing Signature
- HEX_SIG:8902330400010a001d1621045d5e2fa2
- Build Date
- 2026/06/04 19:49:37
- Requires
-
python3.13dist(fastavro) >= 1.9.4
python3.13dist(httpx) >= 0.21.2
python3.13dist(pydantic) >= 1.9.2
python3.13dist(pydantic-core) >= 2.0.2
python3.13dist(requests) >= 2
python3.13dist(types-requests) >= 2
python3.13dist(typing-extensions) >= 4
- Provides
-
python-cohere = 5.20.6-1.lbn42
python3-cohere = 5.20.6-1.lbn42
python3.13-cohere = 5.20.6-1.lbn42
python3.13dist(cohere) = 5.20.6
python3dist(cohere) = 5.20.6
- Obsoletes