简介
Command R+ 是 Cohere 旗舰企业 LLM —— 128K 上下文、原生工具使用、多语言(10+ 语言强流畅度)、专为 RAG 和 agent 工作负载调优。价格在 GPT-4o-mini 和 Claude Sonnet 之间,工具使用和多步推理 benchmark 上相当。适合企业 agent、多语言客户面 AI、需要引用的 RAG 流水线。兼容 Cohere API、AWS Bedrock、Azure、Oracle Cloud。装机时间 2 分钟。
Hello, Command R+
import cohere
co = cohere.Client(os.environ["COHERE_API_KEY"])
response = co.chat(
model="command-r-plus-08-2024",
message="Compare LFP and NMC battery chemistries.",
temperature=0.3,
)
print(response.text)原生工具使用
tools = [{
"name": "get_weather",
"description": "Get current weather",
"parameter_definitions": {
"city": {"description": "City name", "type": "str", "required": True},
},
}]
response = co.chat(
model="command-r-plus-08-2024",
message="What's the weather in Tokyo and Berlin? Compare.",
tools=tools,
)
# 循环直到没有更多工具调用
while response.tool_calls:
tool_results = []
for tc in response.tool_calls:
result = call_my_tool(tc.name, tc.parameters)
tool_results.append({"call": tc, "outputs": [{"result": result}]})
response = co.chat(
model="command-r-plus-08-2024",
message="",
tools=tools,
tool_results=tool_results,
)
print(response.text)内置 RAG 模式
documents = [
{"title": "Doc 1", "snippet": "PyTorch is..."},
{"title": "Doc 2", "snippet": "TensorFlow is..."},
]
response = co.chat(
model="command-r-plus-08-2024",
message="Compare PyTorch and TensorFlow",
documents=documents,
)
print(response.text)
# 输出按 doc ID 引用 —— 看 response.citations
for c in response.citations:
print(f"{c.text} → {c.document_ids}")价格快照(vs 其他)
| 模型 | 输入 $/百万 token | 输出 $/百万 token |
|---|---|---|
| Claude 3.5 Sonnet | $3 | $15 |
| Command R+ | $2.50 | $10 |
| GPT-4o | $2.50 | $10 |
| Command R | $0.50 | $1.50 |
| GPT-4o-mini | $0.15 | $0.60 |
FAQ
Q: Command R 免费吗? A: Cohere 注册送试用 credit。之后通过 cohere.com 按 token 付费,或通过 AWS Bedrock / Azure 用它们的计费。免费档够原型,生产要付费档。
Q: Command R+ 跟 Claude Sonnet 比怎样? A: 英文 benchmark Sonnet 略领先。Command R+ 在工具使用和多语言任务上有竞争力,价格更低。企业 / 多语言 / RAG 重的用例下 Command R+ 通常是更好的性价比。
Q: Command R 像 OpenAI 那样支持 function calling 吗?
A: 支持 —— 原生工具使用是一等公民。Schema 类似,但用 parameter_definitions 而非 parameters。Cohere SDK 帮你规整;裸 API 注意格式差异。