Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Cohere API for enterprise NLP — embeddings, reranking, RAG, and text generation. Use when building RAG pipelines, semantic search, document reranking, or enterprise NLP applications. Command R+ excels at tool use and retrieval-augmented generation; Embed v3 and Rerank 3 are best-in-class for search quality.
.claude/skills/terminalskills-cohere-api/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 137% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 34% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 198% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 70% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 83% | 0% |
Cohere provides enterprise-grade NLP models purpose-built for production use cases. Their flagship offerings are: Command R+ for RAG and agentic tasks, Embed v3 for state-of-the-art semantic embeddings, and Rerank 3 for dramatically improving search result relevance. All models are available via API with enterprise SLAs and on-premise deployment options.
bash# Python pip install cohere # TypeScript/Node npm install cohere-ai
bashexport COHERE_API_KEY=...
| Model | Type | Best For | |---|---|---| | command-r-plus | Generation | Complex RAG, tool use, long context | | command-r | Generation | Efficient RAG, cost-effective | | command | Generation | Simple text tasks | | embed-english-v3.0 | Embedding | English semantic search | | embed-multilingual-v3.0 | Embedding | 100+ language search | | rerank-english-v3 | Reranking | English document reranking | | rerank-multilingual-v3 | Reranking | Multilingual reranking |
pythonimport cohere co = cohere.ClientV2(api_key="your_api_key") # or reads COHERE_API_KEY response = co.chat( model="command-r-plus", messages=[ {"role": "user", "content": "Explain transformer architecture in plain English."}, ], ) print(response.message.content[0].text)
pythonimport 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-english-v3.0", input_type="search_document", # "search_document" for indexing embedding_types=["float"], ) embeddings = response.embeddings.float_ print(f"Embedding shape: {len(embeddings)} x {len(embeddings[0])}") # 3 x 1024
pythonimport 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-english-v3.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)) # (assuming doc_embeddings is a list of previously embedded documents) similarities = [cosine_similarity(query_vector, doc_emb) for doc_emb in doc_embeddings] top_idx = np.argsort(similarities)[::-1][:5]
pythonimport cohere co = cohere.ClientV2() query = "What are the benefits of renewable energy?" # Initial candidates (from vector search or keyword search) 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-english-v3", query=query, documents=documents, top_n=3, # Return top 3 most relevant ) for result in rerank_response.results: print(f"Rank {result.index}: Score {result.relevance_score:.3f}") print(f" {documents[result.index]}\n")
pythonimport cohere co = cohere.ClientV2() # RAG with grounding documents — Command R+ provides cited responses 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-r-plus", messages=[{"role": "user", "content": "What is the current state of renewable energy?"}], documents=documents, ) print(response.message.content[0].text) # Citations reference specific document sources if hasattr(response.message, "citations") and response.message.citations: for citation in response.message.citations: print(f"Citation: {citation}")
pythonimport cohere import json co = cohere.ClientV2() tools = [ { "type": "function", "function": { "name": "get_stock_price", "description": "Get the current stock price for a ticker symbol", "parameters": { "type": "object", "properties": { "ticker": {"type": "string", "description": "Stock ticker (e.g. AAPL)"}, }, "required": ["ticker"], }, }, } ] messages = [{"role": "user", "content": "What's the current Apple stock price?"}] response = co.chat( model="command-r-plus", messages=messages, tools=tools, ) if response.message.tool_calls: tool_call = response.message.tool_calls[0] args = json.loads(tool_call.function.arguments) print(f"Tool: {tool_call.function.name}, Args: {args}") # Execute tool and return result messages.append({"role": "assistant", "tool_calls": response.message.tool_calls}) messages.append({ "role": "tool", "tool_call_id": tool_call.id, "content": json.dumps({"price": 189.84, "change": "+1.2%"}), }) final = co.chat(model="command-r-plus", messages=messages, tools=tools) print(final.message.content[0].text)
pythonimport cohere import numpy as np co = cohere.ClientV2() def build_rag_pipeline(documents: list[str]): """Embed a corpus of documents.""" response = co.embed( texts=documents, model="embed-english-v3.0", input_type="search_document", embedding_types=["float"], ) return response.embeddings.float_ def retrieve_and_rerank(query: str, documents: list[str], doc_embeddings, top_k=10, top_n=3): """Vector search + rerank for best results.""" # Step 1: Embed query q_resp = co.embed( texts=[query], model="embed-english-v3.0", input_type="search_query", embedding_types=["float"], ) q_vec = q_resp.embeddings.float_[0] # Step 2: Cosine similarity search sims = [np.dot(q_vec, d) / (np.linalg.norm(q_vec) * np.linalg.norm(d)) for d in doc_embeddings] candidates_idx = np.argsort(sims)[::-1][:top_k] candidates = [documents[i] for i in candidates_idx] # Step 3: Rerank candidates reranked = co.rerank( model="rerank-english-v3", query=query, documents=candidates, top_n=top_n, ) return [candidates[r.index] for r in reranked.results] def answer_with_rag(query: str, context_docs: list[str]) -> str: """Generate answer grounded in retrieved documents.""" docs = [{"data": {"snippet": doc}} for doc in context_docs] response = co.chat( model="command-r-plus", messages=[{"role": "user", "content": query}], documents=docs, ) return response.message.content[0].text
input_type="search_document" when embedding docs and input_type="search_query" for queries — this matters for retrieval quality.documents parameter for best citation quality.embed-multilingual-v3.0 model supports 100+ languages with a single model.| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-03 | pass→pass | 11,067 | 9,311 | -16% | 1 | 1 | 0% | 2,464 | 4,382 | +78% | 0 | 0 | — |
case-01 | fail→pass | 7,821 | 6,594 | -16% | 1 | 1 | 0% | 1,579 | 3,747 | +137% | 0 | 0 | — |
case-02 | fail→pass | 15,609 | 9,565 | -39% | 1 | 1 | 0% | 3,234 | 4,325 | +34% | 0 | 0 | — |
case-04 | fail→pass | 4,789 | 3,945 | -18% | 1 | 1 | 0% | 1,005 | 2,999 | +198% | 0 | 0 | — |
case-05 | pass→pass | 7,380 | 7,331 | -1% | 1 | 1 | 0% | 1,671 | 3,561 | +113% | 0 | 0 | — |
case-06 | fail→pass | 10,795 | 6,746 | -38% | 1 | 1 | 0% | 2,169 | 3,692 | +70% | 0 | 0 | — |
case-07 | pass→pass | 8,654 | 4,672 | -46% | 1 | 1 | 0% | 1,808 | 3,305 | +83% | 0 | 0 | — |
case-08 | pass→pass | 6,538 | 5,287 | -19% | 1 | 1 | 0% | 1,222 | 3,413 | +179% | 0 | 0 | — |
case-09 | pass→pass | 9,394 | 4,216 | -55% | 1 | 1 | 0% | 1,815 | 3,204 | +77% | 0 | 0 | — |
case-10 | pass→pass | 2,900 | 1,848 | -36% | 1 | 1 | 0% | 468 | 2,614 | +459% | 0 | 0 | — |
case-11 | pass→pass | 6,652 | 2,304 | -65% | 1 | 1 | 0% | 1,165 | 2,690 | +131% | 0 | 0 | — |
case-12 | pass→pass | 6,462 | 2,360 | -63% | 1 | 1 | 0% | 1,153 | 2,712 | +135% | 0 | 0 | — |
case-21 | pass→pass | 6,272 | 2,636 | -58% | 1 | 1 | 0% | 1,114 | 2,840 | +155% | 0 | 0 | — |
case-13 | pass→pass | 3,220 | 2,214 | -31% | 1 | 1 | 0% | 533 | 2,641 | +395% | 0 | 0 | — |
case-14 | pass→pass | 4,466 | 2,874 | -36% | 1 | 1 | 0% | 858 | 2,738 | +219% | 0 | 0 | — |
case-15 | fail→pass | 12,887 | 11,969 | -7% | 1 | 1 | 0% | 2,767 | 5,066 | +83% | 0 | 0 | — |
case-16 | pass→pass | 5,998 | 2,693 | -55% | 1 | 1 | 0% | 1,009 | 2,819 | +179% | 0 | 0 | — |
case-22 | pass→pass | 5,201 | 2,038 | -61% | 1 | 1 | 0% | 780 | 2,610 | +235% | 0 | 0 | — |
case-17 | pass→pass | 6,927 | 1,985 | -71% | 1 | 1 | 0% | 1,224 | 2,550 | +108% | 0 | 0 | — |
case-18 | pass→pass | 4,562 | 3,384 | -26% | 1 | 1 | 0% | 908 | 3,039 | +235% | 0 | 0 | — |
case-19 | pass→pass | 15,618 | 11,901 | -24% | 1 | 1 | 0% | 1,967 | 4,571 | +132% | 0 | 0 | — |
case-20 | pass→pass | 6,202 | 2,458 | -60% | 1 | 1 | 0% | 1,027 | 2,678 | +161% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +23 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.