Skip to content

Azure OpenAI Setup

The ai init openai command allows selection or creation of an Azure OpenAI resource.

If you don't have the ai CLI installed ...

Before you begin, you'll need to install the ai CLI.

Install the ai CLI

Select or create Azure OpenAI resource
ai init openai

STEP 1: ⇛ Select your Azure subscription (if prompted)
STEP 2: ⇛ Select or create your Azure OpenAI resource
STEP 3: ⇛ Select or create an OpenAI chat1 model deployment (e.g. gpt-4o)
STEP 4: ⇛ Select or create an OpenAI embeddings2 model deployment (optional)

View Configuration

To view the persisted configuration, use the following commands:

Get chat endpoint
ai config @chat.endpoint
AI - Azure AI CLI, Version 1.0.0
Copyright (c) 2024 Microsoft Corporation. All Rights Reserved.

chat.endpoint (found at 'D:\src\book-of-ai\.ai\data')

  https://robch-future-900-oai-westus3.cognitiveservices.azure.com/
Get chat key
ai config @chat.key
AI - Azure AI CLI, Version 1.0.0
Copyright (c) 2024 Microsoft Corporation. All Rights Reserved.

chat.key (found at 'D:\src\book-of-ai\.ai\data')

  436172626F6E20697320636F6F6C2121

  1. Chat models are used to generate human-like text based on the input they are given 

  2. Embeddings models are used to interpret and quantify relationships and similarities in data.