# Cohere on the Microsoft Azure Platform

> This page describes how to work with Cohere models on Microsoft Azure.

In this document, you learn how to use [Azure AI Foundry](https://ai.azure.com/) to deploy the Cohere Command, Emebbing, and Rerank models on Microsoft's Azure cloud computing platform. You can read more about Azure AI Foundry in its documentation[here](https://learn.microsoft.com/en-us/azure/ai-foundry/what-is-azure-ai-foundry).

The following models are available through Azure AI Foundry with pay-as-you-go, token-based billing:

* Command A
* Embed v4
* Embed v3 - English
* Embed v3 - Multilingual
* Cohere Rerank V4.0 Pro
* Cohere Rerank V4.0 Fast
* Cohere Rerank V3.5
* Cohere Rerank V3 (English)
* Cohere Rerank V3 (multilingual)

## Prerequisites

Whether you're using Command, Embed, or Rerank, the initial set up is the same. You'll need:

* An Azure subscription with a valid payment method. Free or trial Azure subscriptions won't work. If you don't have an Azure subscription, create a [paid Azure account](https://azure.microsoft.com/pricing/purchase-options/pay-as-you-go) to begin.
* An [Azure AI hub resource](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/create-azure-ai-resource). Note: for Cohere models, the pay-as-you-go deployment offering is only available with AI hubs created in the `East US`, `East US 2`, `North Central US`, `South Central US`, `Sweden Central`, `West US` or `West US 3` regions.
* An [Azure AI project](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/create-projects) in Azure AI Studio.
* Azure role-based access controls (Azure RBAC) are used to grant access to operations in Azure AI Studio. To perform the required steps, your user account must be assigned the Azure AI Developer role on the resource group. For more information on permissions, see [Role-based access control in Azure AI Studio](https://learn.microsoft.com/en-us/azure/ai-studio/concepts/rbac-ai-studio).

For workflows based around Command, Embed, or Rerank, you'll also need to create a deployment and consume the model. Here are links for more information:

* **Command:** [create a Command deployment](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/deploy-models-cohere-command#create-a-new-deployment) and then [consume the Command model](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/deploy-models-cohere-command#create-a-new-deployment).
* **Embed:** [create an Embed deployment](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/deploy-models-cohere-embed#create-a-new-deployment) and [consume the Embed model](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/deploy-models-cohere-embed#consume-the-cohere-embed-models-as-a-service).
* **Rerank**: [create a Rerank deployment](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/deploy-models-cohere-rerank) and [consume the Rerank model](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/deploy-models-cohere-rerank#consume-the-cohere-rerank-models-as-a-service).

## Text Generation

We expose two routes for Command R and Command R+ inference:

* `v1/chat/completions` adheres to the Azure AI Generative Messages API schema;
* ` v1/chat` supports Cohere's native API schema.

You can find more information about Azure's API [here](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/deploy-models-cohere-command#chat-api-reference-for-cohere-models-deployed-as-a-service).

Here's a code snippet demonstrating how to programmatically interact with a Cohere model on Azure:

```python PYTHON
import urllib.request
import json