Prerequisites
- An Azure OpenAI resource with a deployed model
openaiPython package (Azure OpenAI uses the same SDK)
| Value | Where to find it |
|---|---|
AZURE_OPENAI_API_KEY | Azure portal → your OpenAI resource → Keys and Endpoint |
AZURE_OPENAI_ENDPOINT | Azure portal → your OpenAI resource → Keys and Endpoint |
AZURE_OPENAI_DEPLOYMENT | Azure AI Studio → Deployments → your deployment name |
AZURE_OPENAI_API_VERSION | Use 2024-02-01 or the latest stable version |
Quickstart
Using environment variables
Streaming responses
Full working example
See examples/azure-openai/ for a complete FastAPI web chat example with Docker and a pre-configured.env.example.