@aliou/pi-cohere

Pi provider extension for Cohere models.

Packages

Package details

extension

Install @aliou/pi-cohere from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@aliou/pi-cohere
Package
@aliou/pi-cohere
Version
0.1.0
Published
Jun 29, 2026
Downloads
373/mo · 31/wk
Author
aliou
License
MIT
Types
extension
Size
9.2 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "video": "https://assets.aliou.me/github/aliou/pi-cohere/demo.mp4",
  "extensions": [
    "./extensions/provider/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-cohere

Pi provider extension for Cohere models.

Installation

pi install npm:@aliou/pi-cohere

Set the API key before use:

export COHERE_API_KEY=...

What it provides

  • Registers a cohere provider in Pi.
  • Uses Cohere HTTP endpoints directly, not the Cohere SDK.
  • Fetches chat-capable models from GET https://api.cohere.com/v1/models when COHERE_API_KEY is available.
  • Falls back to a small hardcoded model list when model fetching is unavailable.
  • Uses Cohere's OpenAI-compatible endpoint at https://api.cohere.ai/compatibility/v1 with Pi's native openai-completions provider path.
  • Supports text, vision model metadata, tool calls, streamed usage, and context-overflow normalization.

Development

pnpm install
pnpm typecheck
pnpm lint

Layout

  • extensions/provider/: Pi extension entry point.
  • src/cohere/: Cohere model mapping and API helpers.

Notes

Cohere returns usage in response bodies and a num_tokens header for non-streaming chat. I did not see quota, remaining-credit, or rate-limit headers while probing.