You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
caption:"Photo credit: [**nicola since 1972**](https://www.flickr.com/photos/15216811@N06/54308248466/)"
10
10
---
11
11
12
12
Azure OpenAI Service provides REST API access to OpenAI's powerful language models including o1, o1-mini, GPT-4o, GPT-4o mini, GPT-4 Turbo with Vision, GPT-4, GPT-3.5-Turbo, and Embeddings model series. These models can be easily adapted to your specific task including but not limited to content generation, summarization, image understanding, semantic search, and natural language to code translation.
@@ -17,27 +17,30 @@ By using Azure API Manager in front of Azure Open AI instances, enterprises can
17
17
18
18
Combining Azure Open AI with Azure API Manager enables enterprises to efficiently distribute and manage their AI capabilities while maintaining high standards of security and performance.
19
19
20
-
----------------------------
20
+
**In this post I show a collection of recipes for API Management that I have seen used by customers and partners who needed to expose one or more instances of Azure OpenAI.**
21
21
22
-
obiettivo di questa serie di post é quello di mostrate alcuni dei pattern da usare per esporre Azure Open AI attraversoAPIM.
22
+
>In these posts we will focus on configuring policies and implementing some usage patterns with them. Network configuration and integration with an Enterprise-scale landing zone (ESLZ) is out of scope. For a walkthrough that guides the integration ofAPIM and AOAI in a hub & spoke context, you can also refer to[my article](https://github.com/nicolgit/hub-and-spoke-playground/blob/main/scenarios/aoai.md) available as part of[the hub-and-spoke playground project](https://github.com/nicolgit/hub-and-spoke-playground).
23
23
24
-
In this context, the following architecturea and implementation in Azure Architecture Center are**developed** and**maintained** by Azure Pattern and Practices team. I suggest yout to bookmark them for further information.
24
+
>The following architecture and implementation in Azure Architecture Center are**developed** and**maintained** by the Azure Patterns and Practices team. I suggest you bookmark them for further information:
The lab used for these walk-throughs consists of the following resources:
28
29
29
-
in questi post ci focalizzeremo sulla configurazione delle policy e di implementazione di alcuni pattern di utilizzo con esse. La parte di configurazione della rete e l'integrazione con una ESLZ é out of scope. Per un walktrough che guidi l'integrazione di APIM ed AOAI in un contesto di hub & spoke, è possibile fare riferimento anche[al mio articolo](https://github.com/nicolgit/hub-and-spoke-playground/blob/main/scenarios/aoai.md) disponibile nell'ambito del progetto[the hub-and-spoke playground](https://github.com/nicolgit/hub-and-spoke-playground)
30
-
31
-
32
-
Il laboratorio su cui lavoró prevede le seguenti risorse:
33
-
34
-
* Azure API Management service (developer SKU) enterpriseapim
30
+
* Azure API Management service (developer SKU)`nicold-apim`
35
31
* 2 x Azure OpenAI service (S0 SKU)`apimaoai01` and`apimaoai02`
Here are the key recipes we'll cover in this article:
36
+
37
+
-[Add Azure Open AI as backend resource](#add-azure-open-ai-as-backend-resource)
38
+
-[Show apim-001 endpoint as root API](#show-apim-001-endpoint-as-root-api)
39
+
-[Implement throttling](#implement-throttling)
40
+
-[Show in a Response header (_aoai-origin_) the host of the OpenAI API Called](#show-in-a-response-header-aoai-origin-the-host-of-the-openai-api-called)
41
+
-[Round robin calls between 2 instances of Open AI](#round-robin-calls-between-2-instances-of-open-ai)
42
+
-[Fallback on a second openAI instance for 30 secs. If the first send a 4xx error](#fallback-on-a-second-openai-instance-for-30-secs-if-the-first-send-a-4xx-error)
43
+
41
44
#Add Azure Open AI as backend resource
42
45
43
46
Go to API Management services >`nicold-apim` > Backends > Add
@@ -86,7 +89,7 @@ To test this endpoint go to: API Management Services > `nicold-apim` > APIs > Al
86
89
87
90
here also a powershell script to test this configuration:
88
91
89
-
```
92
+
```ps1
90
93
$openai = @{
91
94
api_key = "my-api-key"
92
95
api_base = "https://nicold-apim.azure-api.net/" # your endpoint