Skip to main content

Cohere

@dsh-ai-providers/cohere is the native Cohere provider maintained by Firefox2100 as part of this project. It speaks Cohere's v2 API directly and covers language models, embeddings, and reranking. It is not an official DSH or Cohere package.

Supported capabilities​

CapabilityNative endpoint
Language modelsPOST /v2/chat (server-sent events)
Model discoveryGET /v1/models?endpoint=chat
EmbeddingsPOST /v2/embed
RerankingPOST /v2/rerank

Cohere has no TTS, STT, or image-generation API in this plugin's scope, so those services are not registered. The embedding and rerank transports come from the shared @dsh-ai-providers/jina-cohere library, which the Jina provider also uses; neither provider depends on the other.

Configure a connection​

Open Settings > Providers > Cohere connections. The default connection is:

A Cohere connection and credential reference in DSH settings

SettingDefault
Base URLhttps://api.cohere.com/v2
Credential referenceCOHERE_API_KEY
Stream silence limit5 minutes
Embedding and rerank timeout1 minute

The base URL includes the version. The key is stored through DSH's credential service, never in the profile, and sent as Authorization: Bearer. Model discovery reads /v1/models beside the versioned API.

Language models​

Create a route, select a connection, and add Cohere model names such as command-a-03-2025. List models on the account adds models with the context length Cohere reports and vision support where it says so.

The provider supports system prompts, text and image content (images as data URLs; use a vision model), tool declarations and results, streamed text, thinking, and tool calls, and token usage with cache reads. Words an assistant says before calling tools are Cohere's tool_plan: they stream as text and are sent back in that field. Tool choice works as DSH asks: required becomes tool_choice: REQUIRED, a named tool is REQUIRED with only that tool offered, and none offers no tools.

Sampling uses the common fields plus Cohere's own in the same object. Absent means the server's default.

FieldRequest fieldNotes
temperature, seed, frequencyPenalty, presencePenaltysame namesPenalties range from 0 to 1
topP, topKp, k
maxTokens, stopmax_tokens, stop_sequencesAt most 5 stop strings
minP, repetitionPenaltynoneCohere has no such control; ignored
thinking, thinkingBudgetthinking.type, thinking.token_budgetFor models that think
safetyModesafety_modeCONTEXTUAL, STRICT or OFF
strictToolsstrict_toolsFollow tool schemas exactly
citationModecitation_options.mode
responseFormatresponse_formatFor example { "type": "json_object", "json_schema": {...} }
prioritypriority
bodytop levelAnything else the API accepts, such as documents

Reasoning levels are request fragments, for example { "thinking": { "type": "enabled", "token_budget": 4000 } }, and win over the typed fields.

Embeddings and reranking​

Select Cohere in the Embedding or Reranking tab. Embeddings default to embed-v4.0 in batches of 96, the most Cohere accepts; the consumer's query or document choice is sent as search_query or search_document, and texts without a choice are sent as documents. Vector dimensions works for embed-v4 and newer. Reranking defaults to rerank-v3.5, with an optional limit on tokens read per document (max_tokens_per_doc). Cohere's v2 rerank has no return_documents, so it is not sent.

Two request options let a consumer change this per call. maxTokensPerDoc overrides the configured limit (Cohere's own default is 4096). queuePriority is sent as Cohere's priority, where lower numbers are served first; it is separate from the foreground/background priority the concurrency gate uses. relevant_spans, which newer rerank models can return, is not exposed, because the result contract has only an index and a score per document.

Errors and cancellation​

HTTP and stream failures are mapped to DSH language-model failure classes: authentication, rate limiting, payment or usage limits, invalid requests, context overflow (including Cohere's "too many tokens" answer), server failures, timeout, and cancellation. A message that ends with ERROR or TIMEOUT is raised as such.