aisdk/cohere

Official Cohere provider for the PHP AI SDK.

Maintainers

Package info

github.com/phpaisdk/cohere

pkg:composer/aisdk/cohere

Transparency log

Fund package maintenance!

Open Collective

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.8.3 2026-07-22 07:10 UTC

This package is auto-updated.

Last update: 2026-07-22 07:11:02 UTC


README

GitHub Workflow Status Latest Version License

Official Cohere provider for the PHP AI SDK. Uses Cohere's native v2 Chat and Embed APIs.

Installation

composer require aisdk/cohere

Basic Usage

use AiSdk\Cohere;
use AiSdk\Generate;

Cohere::create(['apiKey' => $_ENV['COHERE_API_KEY']]);

$result = Generate::text('Explain vector databases in one sentence.')
    ->model(Cohere::model('command-a-03-2025'))
    ->run();

Embeddings

$result = Generate::embedding(['A document to index'])
    ->model(Cohere::model('embed-v4.0'))
    ->providerOptions('cohere', ['inputType' => 'search_document'])
    ->run();

Configuration

Variable Description Default
COHERE_API_KEY API key for authentication Required
COHERE_BASE_URL Base URL for API requests https://api.cohere.com

Supported Capabilities

Capability Support
Text generation and streaming Native v2 Chat API
Tools, structured output, reasoning, image input Native where supported by the selected model
Embeddings Native v2 Embed API

Use providerOptions('cohere', ['raw' => [...]]) for Cohere fields outside the portable SDK surface. Model IDs are opaque strings and are validated by Cohere.

Documentation