VX Agents

OpenAPI Marketplace · AI & ML

Cohere Chat, Embed & Rerank

v1.0.0 · 8 endpoints · 0 connections · shared by vx.ai

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.

MethodPathOperationDescription
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

  1. Sign in to the Cohere dashboard at https://dashboard.cohere.com.
  2. Open API Keys.
  3. Copy the default trial key, or click New Production Key for production traffic (trial keys are rate-limited and not for commercial use).
  4. 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, missing input_type for embed v3+ models, empty documents); 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

  1. 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.
  2. Call checkApiKey once to confirm the key works.
  3. Pin the models you use as presets, e.g. chat command-a-03-2025, embed embed-v4.0, rerank rerank-v3.5. Call listModels (filter endpoint=chat, embed or rerank) to see what your account has.

Answer a question from documents (RAG)

  1. embedV2 the user's query with input_type: search_query (documents you index use search_document), embedding_types: ["float"].
  2. Retrieve candidate passages from your own store using those vectors.
  3. rerankV2 with query, the candidate texts in documents and top_n (e.g. 5) to keep the most relevant ones.
  4. chatV2 with model, messages: [{role: "user", content: "..."}] and the top passages in documents ([{data: {text: "..."}}]). The answer comes back in message.content[0].text with citations pointing to the documents.
  5. For long inputs, tokenize first and compare the count with the model's context_length from getModel.

Good to know

  • Leave stream false (or unset): the tool reads a single JSON response.
  • Use the same embed model and input_type pairing for indexing and querying, or similarity scores are meaningless.
  • rerankV2 returns results[].index (position in your documents list) and relevance_score (0–1).
  • Chat history is stateless: send the whole conversation in messages each turn; set a system message 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

  1. Create a free VX Agents account (sandbox tools included).
  2. Open the marketplace and connect “Cohere Chat, Embed & Rerank” to an agent.
  3. Expose it as an MCP server for Claude/ChatGPT, or chat with it directly.

Related APIs