cohere-api
БесплатноБез исполняемых скриптовНе проверенCohere API for enterprise NLP — embeddings, reranking, RAG, and text generation. Use when building RAG pipelines, semantic search, document reranking, or…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Cohere API
Overview
Cohere provides enterprise-grade NLP models purpose-built for production use cases. Their main offerings are the Command A family for RAG and agentic tasks, Embed models for semantic embeddings, and Rerank models for improving search result relevance. Models are available through Cohere's API and through AWS, Azure and Oracle platforms.
Setup
# Python
pip install cohere
# TypeScript/Node
npm install cohere-ai
export COHERE_API_KEY=...
Available Models
| Model | Type | Best For |
|---|---|---|
command-a-plus-05-2026 |
Generation | Newest; vision input, agents, reasoning, translation (128k context) |
command-a-03-2025 |
Generation | Tool use, RAG, multilingual (256k context) |
command-r7b-12-2024 |
Generation | Small, fast RAG and tool use |
command-r-08-2024, command-r-plus-08-2024 |
Generation | Older but live; dated names only |
embed-v5.0-pro, embed-v5.0-fast |
Embedding | Text and images, 2048 dims by default |
embed-v4.0 |
Embedding | Text and images, 1536 dims by default |
embed-english-v3.0, embed-multilingual-v3.0 |
Embedding | Text, 1024 dims, 512-token context |
rerank-v5.0-pro, rerank-v5.0-fast |
Reranking | Multilingual, 32k context, relevant spans |
rerank-v3.5 |
Reranking | Older multilingual reranker |
The bare aliases command-r and command-r-plus, plus command-r-03-2024, command-r-plus-04-2024, command-light and command, were deprecated on 2025-09-15, and all embed-*-v2.0 models were retired on 2026-04-04. The v2 rerank models were shut down on 2025-04-30. Check the model list and the deprecations page before pinning a model.
Instructions
Chat / Text Generation
import cohere
co = cohere.ClientV2() # reads COHERE_API_KEY from the environment
response = co.chat(
model="command-a-plus-05-2026",
messages=[
{"role": "user", "content": "Explain transformer architecture in plain English."},
],
)
print(response.message.content[0].text)
Document Embeddings
import cohere
co = cohere.ClientV2()
# Embed documents for indexing
docs = [
"Cohere provides enterprise NLP solutions.",
"Embeddings convert text into dense vectors.",
"RAG improves LLM answers with retrieved context.",
]
response = co.embed(
texts=docs,
model="embed-v4.0",
input_type="search_document", # "search_document" for indexing
embedding_types=["float"],
) # at most 96 texts per call
embeddings = response.embeddings.float_
print(f"Embedding shape: {len(embeddings)} x {len(embeddings[0])}") # 3 x 1536 for embed-v4.0 (output_dimension picks 256/512/1024/1536)
Query Embeddings for Search
import cohere
import numpy as np
co = cohere.ClientV2()
# Query embedding — use "search_query" for queries
query = "How do embeddings work?"
query_response = co.embed(
texts=[query],
model="embed-v4.0",
input_type="search_query", # Different from "search_document"!
embedding_types=["float"],
)
query_vector = query_response.embeddings.float_[0]
# Find most similar documents using cosine similarity
def cosine_similarity(a, b):
return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))
similarities = [cosine_similarity(query_vector, doc_emb) for doc_emb in doc_embeddings]
top_idx = np.argsort(similarities)[::-1][:5]
Reranking for RAG Improvement
import cohere
co = cohere.ClientV2()
query = "What are the benefits of renewable energy?"
documents = [
"Solar panels convert sunlight into electricity efficiently.",
"Wind energy reduces carbon emissions significantly.",
"The history of fossil fuels dates back centuries.",
"Renewable energy creates jobs in local communities.",
"Nuclear power is debated as a clean energy source.",
"Oil prices fluctuate based on global demand.",
]
rerank_response = co.rerank(
model="rerank-v5.0-pro",
query=query,
documents=documents,
top_n=3, # Return top 3 most relevant
)
for rank, result in enumerate(rerank_response.results, start=1):
print(f"#{rank} (document {result.index}): score {result.relevance_score:.3f}")
print(f" {documents[result.index]}\n")
Examples
RAG with Citations
import cohere
co = cohere.ClientV2()
# RAG with grounding documents — the model returns cited answers
documents = [
{"id": "doc1", "data": {"title": "Renewable Energy", "snippet": "Solar energy capacity grew 25% in 2024, reaching 1.5 TW globally."}},
{"id": "doc2", "data": {"title": "Climate Policy", "snippet": "The EU Green Deal targets 55% emissions reduction by 2030."}},
]
response = co.chat(
model="command-a-plus-05-2026",
messages=[{"role": "user", "content": "What is the current state of renewable energy?"}],
documents=documents,
)
print(response.message.content[0].text)
# Ea
Установить cohere-api в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл cohere-api?
Cohere API for enterprise NLP — embeddings, reranking, RAG, and text generation. Use when building RAG pipelines, semantic search, document reranking, or enterprise NLP applications. The Command A models handle tool use and retrieval-augmented generation with citations; Embed and Rerank models improve search quality.
Как установить скилл cohere-api?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cohere-api запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic