Cohere
Cohere 的 Command 模型為 RAG 而生:一把金鑰搞定嵌入、重排序和長文件對話。試用金鑰永不過期、不要卡,但授權只允許原型,不允許正式環境。
Cohere 的 Command 模型為 RAG 而生:一把金鑰搞定嵌入、重排序和長文件對話。試用金鑰永不過期、不要卡,但授權只允許原型,不允許正式環境。
每月 1,000 次請求、每分鐘 20 次,Command A(command-a-03-2025)可達 256K 上下文。Command A+ 是 command-a-plus-05-2026。OpenAI 形狀的路徑是 /compatibility/v1;Cohere 自家 API 在 /v2。
- 免費模型
- 12
- 最大上下文
- 256K
- 免費額度
- 每月 1,000 次請求
- 註冊要求
- 只要電子郵件,不要卡
端點
基底網址
https://api.cohere.com/compatibility/v1環境變數
COHERE_API_KEY速率限制
20 requests/minute, 1,000 requests/month- OpenAI 相容
- 官方 SDK:Cohere SDK
- 文字
- 影像
程式碼範例
npm install openaiimport OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://api.cohere.com/compatibility/v1',
apiKey: process.env.COHERE_API_KEY
})
const response = await client.chat.completions.create({
model: 'command-a-03-2025',
messages: [{ role: 'user', content: 'Explain closures in one paragraph.' }]
})
console.log(response.choices[0].message.content)pip install openaiimport os
from openai import OpenAI
client = OpenAI(
base_url="https://api.cohere.com/compatibility/v1",
api_key=os.environ["COHERE_API_KEY"],
)
response = client.chat.completions.create(
model="command-a-03-2025",
messages=[{"role": "user", "content": "Explain closures in one paragraph."}],
)
print(response.choices[0].message.content)curl https://api.cohere.com/compatibility/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $COHERE_API_KEY" \
-d '{
"model": "command-a-03-2025",
"messages": [{"role": "user", "content": "Explain closures in one paragraph."}]
}'npm install cohere-aiimport { CohereClientV2 } from 'cohere-ai'
const cohere = new CohereClientV2({ token: process.env.COHERE_API_KEY })
const response = await cohere.chat({
model: 'command-a-03-2025',
messages: [{ role: 'user', content: 'Explain closures in one paragraph.' }]
})
console.log(response.message.content?.[0].text)pip install cohereimport os
import cohere
client = cohere.ClientV2(api_key=os.environ["COHERE_API_KEY"])
response = client.chat(
model="command-a-03-2025",
messages=[{"role": "user", "content": "Explain closures in one paragraph."}],
)
print(response.message.content[0].text)值得注意
- 免費金鑰是試用金鑰:做原型沒問題,授權不允許正式使用。
- Cohere 自家 v2 端點在 /v2 —— /compatibility/v1 才是 OpenAI 形狀的那個。
- Command A 的 id 是 command-a-03-2025(256K)。command-a-218b 不是 API id。
你能免費使用的模型12
- Command A
command-a-03-2025 - Command A+
command-a-plus-05-2026 - Command R+
command-r-plus-08-2024 - Command R
command-r-08-2024 - Command R7B
command-r7b-12-2024 - Command A Reasoning
command-a-reasoning-08-2025 - Command A Translate
command-a-translate-08-2025 - Embed V4
embed-v4.0 - Embed English V3
embed-english-v3.0 - Embed Multilingual V3
embed-multilingual-v3.0 - Rerank V3.5
rerank-v3.5 - Rerank English V3
rerank-english-v3.0