# Cohere API

CreateWithAI Hub page: https://createwithaihub.com/apis-sdks/cohere-api
Latest version of this file: https://createwithaihub.com/apis-sdks/cohere-api.md

- Type: API / SDK · Category: APIs & SDKs
- Publisher: Cohere
- Pricing: Free plan plus paid plans
- Runs on: API (cloud)

Cohere's API for Command chat models, Embed and Rerank, with official Python, TypeScript, Java and Go SDKs and free trial keys.

The Cohere API at api.cohere.com provides Chat (Command models), Embed, Embed Jobs, Rerank, Tokenize, Parse and audio transcription endpoints, with v2 as the default version. An OpenAI-compatible Compatibility API covers chat completions, embeddings and transcriptions. Official SDKs exist for Python, TypeScript, Java and Go, and free trial keys allow limited non-commercial use before switching to a pay-as-you-go production key.

Useful for: Adding semantic search to an app with Embed plus Rerank, or building a RAG chatbot on Command models.

## Key features

- Chat endpoint for Command models with tool use and RAG
- Embed and batch Embed Jobs endpoints
- Rerank endpoint for search relevance
- OpenAI-compatible Compatibility API
- Official SDKs: Python, TypeScript, Java, Go
- Also available through Amazon Bedrock, Azure and Oracle OCI

## Connection

- Modality: Text, Image, Audio
- SDK language: Python, TypeScript / JS, Go, Java
- Free tier: Has a free tier

## Before you start

- Cohere account
- API key

## Install steps from the official documentation

Python SDK:

```
python -m pip install cohere --upgrade
```

TypeScript SDK:

```
npm i -s cohere-ai
```

Go SDK:

```
go get github.com/cohere-ai/cohere-go/v2
```

## Limitations

- Trial keys are limited to 1,000 API calls a month and cannot be used commercially
- Production keys require an application
- Rerank is billed per search, with long documents split into chunks

## Official links

- Website: https://cohere.com
- Source repository: https://github.com/cohere-ai/cohere-python
- Documentation: https://docs.cohere.com/v2/reference/about
- Source: https://docs.cohere.com/v2/reference/about (API overview and SDK install commands (Python, TypeScript, Java, Go))
- Source: https://docs.cohere.com/v2/reference/chat (Base URL https://api.cohere.com/v2/chat)
- Source: https://docs.cohere.com/docs/compatibility-api (OpenAI-compatible Compatibility API)
- Source: https://docs.cohere.com/docs/rate-limits (Trial key limits, 1,000 calls per month)
- Source: https://cohere.com/pricing (Free trial keys, pay-as-you-go production billing; Command A+ $2.50/$10.00 per 1M tokens; Rerank billed per search unit (one query, up to 100 documents))
- Source: https://github.com/cohere-ai/cohere-python (Official Python SDK, MIT)
- Source: https://github.com/cohere-ai/cohere-typescript (Official TypeScript SDK, MIT)
