Skip to main content

Using the Cohere API

The Cohere API is centered around models.

Each model has a different amount of power (i.e. parameters), to be used for different tasks. Cohere has five baseline models: shrimp, otter, seal, shark, and orca.

Cohere also supports finetuning of baseline models to improve performance on downstream tasks or to teach the model large quantities of information which cannot be extracted with few-shot learning or prompt engineering.

SDKs#

Further SDK documentation is accompanied in the rest of the API Reference documentation.

Python#

Install package:

pip install cohere

Node.js#

Install the npm package:

npm install cohere-ai

Request Specification#

The URL shape is as follows:

https://api.cohere.ai/[MODEL-NAME]/[ENDPOINT]

To make a request to any model, you must pass in the Authorization Header and the request must be made through a POST request. The content of Authorization should be in the shape of BEARER [API_KEY]. All request bodies are sent through JSON.

Model names are found within the dashboard, and details about endpoints are available within the documentation. Detailed model information can be found in the Model Cards.