Compatible Gateways

Cohere

Use Cohere's OpenAI-compatible models with Anvia.

Cohere exposes an OpenAI-compatible chat, embeddings, and audio surface at https://api.cohere.ai/compatibility/v1. In Anvia, configure OpenAIClient with that baseUrl, then pass Cohere model ids to completionModel(...). The Compatibility API is a thin OpenAI-shaped layer over the underlying Cohere Chat, Embed, and Audio APIs.

Create the Client

import { AgentBuilder } from "@anvia/core";
import { OpenAIClient } from "@anvia/openai";

const client = new OpenAIClient({
  baseUrl: "https://api.cohere.ai/compatibility/v1",
  apiKey: process.env.COHERE_API_KEY,
});

const model = client.completionModel("command-a-plus-05-2026");

const agent = new AgentBuilder("support", model)
  .instructions("Answer support questions clearly.")
  .build();

const response = await agent.prompt("Write a haiku about recursion.").send();

console.log(response.output);

baseUrl makes Anvia use the OpenAI-compatible chat completion adapter. The model id is the Cohere id, not an Anvia-specific alias.

Embeddings

import { embedDocuments } from "@anvia/core/embeddings";

const embeddings = client.embeddingModel("embed-v4.0");

const embedded = await embedDocuments(embeddings, documents, {
  id: (doc) => doc.id,
  content: (doc) => `${doc.title}\n${doc.body}`,
});

Use embedding models for document preprocessing and retrieval.

Audio Transcriptions

Cohere's Compatibility API exposes audio transcription through the OpenAI-shaped audio.transcriptions.create call. The language parameter is required, the file parameter must be the last form-data field, and the supported formats are FLAC, MP3, MPEG, MPGA, OGG, and WAV.

Available Models

ModelTypeNotes
command-a-plus-05-2026ChatFlagship Command A+ chat model
embed-v4.0EmbeddingsLatest Cohere embedding model
cohere-transcribe-03-2026AudioSpeech-to-text

Notes

  • Cohere API keys are passed as bearer tokens in the Authorization header.
  • Supported chat parameters include model, messages, stream, response_format, tools, temperature, max_tokens, stop, seed, top_p, frequency_penalty, presence_penalty, and reasoning_effort (only "none" and "high").
  • Unsupported chat parameters include store, metadata, logit_bias, top_logprobs, n, modalities, prediction, audio, service_tier, and parallel_tool_calls.
  • Embeddings support input, model, and encoding_format (float or base64). The OpenAI dimensions and user parameters are not supported.
  • Cohere-native parameters such as connectors, documents, citation_options, input_type, images, and truncate are not part of the OpenAI surface and are not supported through the Compatibility API.
  • Structured outputs use the OpenAI JSON Schema shape. The tool-call strict: true flag is supported and guarantees tool calls match the supplied schema.

For current Cohere API details, see the Cohere Compatibility API docs and the Cohere model catalog.