Azure OpenAI allows developers to use powerful AI models such as GPT-4, GPT-4o, and GPT-3.5 directly from the Azure cloud. These models can be used to build chatbots, AI assistants, content generators, and many intelligent applications.
In this article, you will learn how to create an Azure OpenAI resource, deploy a model, and get the API key required to use the service in your application.
Prerequisites
Before starting, make sure you have:
An Azure account
Access to the Azure Portal
Azure OpenAI service is enabled for your subscription
If you do not have an Azure account, you can create one from the Azure website.
Step 1: Create Azure OpenAI Resource
First, you need to create an Azure OpenAI resource.
Open the Azure Portal:
Steps
Login to the Azure Portal.
In the search bar, type Azure OpenAI.
Click Create.
Now fill the required fields.
Configuration
Resource Group
Create a new resource group or select an existing one.
Region
Choose a supported region such as:
East US
Sweden Central
Name
Enter a unique resource name.
Example:
openai-demo
Pricing Tier
Select Standard.
After filling the details:
Click Review + Create
Then click Create to deploy the resource.
Deployment usually takes around one to two minutes.
Step 2: Deploy a Model
Once the resource is created, you need to deploy a model.
Steps
Open the Azure OpenAI resource you created.
In the left menu, click Model Deployments.
Click Deploy Model.
Now select a model.
Recommended Models
For most applications, these models work well:
gpt-4o-mini
Fast and cost efficient model.
gpt-35-turbo
Popular chat model.
Deployment Configuration
Model
Select the model you want.
Deployment Name
Example:
gpt-4o-mini
Click Deploy.
Azure will now create the model deployment.
Step 3: Get API Credentials
To call the Azure OpenAI API from your application, you need an API key and endpoint.
Steps
Open the Azure OpenAI resource.
Click Keys and Endpoint.
You will see the following information.
API Key 1
API Key 2
Endpoint
Example:
API KEY
xxxxxxxxxxxxxxxxxxxxxxxx
ENDPOINT
https://openai-demo.openai.azure.com/
You can use either Key 1 or Key 2 in your application.
Example API Endpoint
Your application will send requests to the endpoint.
Example:
https://openai-demo.openai.azure.com/openai/deployments/gpt-4o-mini/chat/completions?api-version=2024-02-15-preview
Your request must include:
API Key
Endpoint
Deployment Name
Conclusion
Azure OpenAI makes it easy to use powerful AI models in enterprise applications. The basic process involves three steps:
Create an Azure OpenAI resource
Deploy a model such as gpt-4o-mini
Get API credentials and endpoint
Once these steps are completed, you can start building AI-powered applications using Azure OpenAI.
