Cohere
Cohere provides language models accessible through its OpenAI-compatible Compatibility API.
Cohere’s Compatibility API rejects the stream_options request field. The Python
provider lets you unset it (shown below); the TypeScript provider always sends it,
so it does not work with Cohere.
Installation
Section titled “Installation”The OpenAI provider is an optional dependency. To install, run:
pip install 'strands-agents[openai]'Create an API key in the Cohere Dashboard, export
it as COHERE_API_KEY, and point the provider at the Compatibility API:
import os
from strands import Agentfrom strands.models.openai import OpenAIModel
model = OpenAIModel( client_args={ "api_key": os.environ["COHERE_API_KEY"], "base_url": "https://api.cohere.ai/compatibility/v1", }, model_id="command-a-03-2025", # The Compatibility API rejects stream_options; unset the SDK default params={"stream_options": None},)
agent = Agent(model=model)response = agent("Explain tool calling in one sentence.")print(response)Configuration
Section titled “Configuration”Two client settings connect the provider to Cohere:
- API key: from the Cohere Dashboard
- Base URL:
https://api.cohere.ai/compatibility/v1
Model IDs come from the Cohere model catalog,
for example command-a-03-2025 or command-r-plus. Keep
params={"stream_options": None} in every configuration. For other provider
options, see the
OpenAI provider guide.