Cohere Chat, Embed & Rerank
Lets an agent call Cohere's language models: generate chat answers (optionally grounded in documents), create embeddings for semantic search, and rerank search results by relevance. It can also list available models and count tokens before sending long inputs. Curated from Cohere's official OpenAPI specification.
Connect this API to an AI agent Browse all specs
What you can do with Cohere Chat, Embed & Rerank via MCP
Every endpoint below becomes a governed tool your AI agent (Claude, ChatGPT, or a customer-facing VX agent) can call — with scoped permissions, sandbox testing, and audit logs.
| Method | Path | Operation | Description |
|---|---|---|---|
| POST | /v1/check-api-key |
checkApiKey | Check that the Cohere API key is valid |
| GET | /v1/models |
listModels | List the models available to your account |
| GET | /v1/models/{model} |
getModel | Get details of one model (context length, endpoints) |
| POST | /v2/chat |
chatV2 | Generate a chat answer, optionally grounded in documents |
| POST | /v2/embed |
embedV2 | Create embeddings for texts or images |
| POST | /v2/rerank |
rerankV2 | Rank documents by relevance to a query |
| POST | /v1/tokenize |
tokenize | Split text into tokens to count its length |
| POST | /v1/detokenize |
detokenize | Turn tokens back into text |
Authentication
bearerAuth
Bearer token — sent as Authorization: Bearer <token>
How to get a credential
- Sign in to the Cohere dashboard at https://dashboard.cohere.com.
- Open API Keys.
- Copy the default trial key, or click New Production Key for production traffic (trial keys are rate-limited and not for commercial use).
- Send it as
Authorization: Bearer <key>.
Permissions used
| Scope | Operations |
|---|---|
| API key (no scopes; full account access) | chatV2, embedV2, rerankV2, listModels, getModel, tokenize, detokenize, checkApiKey |
Common errors
- 401 Unauthorized: key is missing, mistyped or revoked; create a new key in the dashboard.
- 403 Forbidden: the key cannot use this model or feature; check your plan.
- 400 Bad Request: invalid body (unknown
model, missinginput_typefor embed v3+ models, emptydocuments); fix the request. - 429 Too Many Requests: trial key or rate limit reached; slow down or switch to a production key.
Store the key as a VX Agents credential (Bearer token); never paste it into chat.
Usage guide
Setup
- Add your Cohere API key as a Bearer credential (dashboard.cohere.com > API Keys). Use a production key for real traffic; trial keys are rate-limited.
- Call
checkApiKeyonce to confirm the key works. - Pin the models you use as presets, e.g. chat
command-a-03-2025, embedembed-v4.0, rerankrerank-v3.5. CalllistModels(filterendpoint=chat,embedorrerank) to see what your account has.
Answer a question from documents (RAG)
embedV2the user's query withinput_type: search_query(documents you index usesearch_document),embedding_types: ["float"].- Retrieve candidate passages from your own store using those vectors.
rerankV2withquery, the candidate texts indocumentsandtop_n(e.g. 5) to keep the most relevant ones.chatV2withmodel,messages: [{role: "user", content: "..."}]and the top passages indocuments([{data: {text: "..."}}]). The answer comes back inmessage.content[0].textwithcitationspointing to the documents.- For long inputs,
tokenizefirst and compare the count with the model'scontext_lengthfromgetModel.
Good to know
- Leave
streamfalse (or unset): the tool reads a single JSON response. - Use the same embed model and
input_typepairing for indexing and querying, or similarity scores are meaningless. rerankV2returnsresults[].index(position in yourdocumentslist) andrelevance_score(0–1).- Chat history is stateless: send the whole conversation in
messageseach turn; set asystemmessage first for instructions. - Every call is billed per token: confirm with the user before large batch embeddings or long multi-document chats.
- 429 means a rate limit: wait and retry with fewer or smaller requests.
How to use this spec
- Create a free VX Agents account (sandbox tools included).
- Open the marketplace and connect “Cohere Chat, Embed & Rerank” to an agent.
- Expose it as an MCP server for Claude/ChatGPT, or chat with it directly.