Azure OpenAI vs OpenAI API: the same models, different contracts
Azure OpenAI and the OpenAI API run the same GPT models and, with the v1 API, take almost the same code: the address, the key and the model name change. What differs is who processes your data, where, and under which agreement; how capacity is bought; and how fast new models arrive. Side-by-side code, the data rules from each side's own pages, and which to pick.
Tecyfy · Published · 8 min read

Azure OpenAI and the OpenAI API serve the same GPT models, and on Azure's v1 API the code changes only in the address, the key and the model name. The difference is the contract around the model. On Azure, Microsoft runs the model inside your Azure subscription: OpenAI never sees your prompts, sign-in can be Entra ID instead of a key, and capacity is bought per region and deployment type. On the OpenAI API, OpenAI runs it, on OpenAI's own release schedule, and limits rise with your spend.
If your company's data and security reviews live in Azure, use Azure OpenAI. If you have no Azure estate and want OpenAI's own service with the least setup, use OpenAI.
The code, side by side
Switch between the 2 and see exactly which lines change:
import osfrom openai import OpenAIclient = OpenAI( base_url="https://YOUR-RESOURCE-NAME.openai.azure.com/openai/v1/",Your resource api_key=os.getenv("AZURE_OPENAI_API_KEY"),Azure key)response = client.responses.create( model="my-gpt-deployment",Deployment name input="Summarise this contract clause: ...",)
6 lines change: the client points at your resource's /openai/v1/ address, takes an Azure key, and model is the name you gave the deployment. The request and response are the same.
Azure's v1 API (generally available since August 2025) takes the standard OpenAI client and needs no api-version. Older AzureOpenAI(...) code still works.
OpenAI:
from openai import OpenAI
client = OpenAI() # reads OPENAI_API_KEY
response = client.responses.create(
model="gpt-6.1-sol",
input="Summarise this contract clause: ...",
)
Azure OpenAI, v1 API:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://YOUR-RESOURCE-NAME.openai.azure.com/openai/v1/",
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
)
response = client.responses.create(
model="my-gpt-deployment", # the name you gave the deployment
input="Summarise this contract clause: ...",
)
The client, the request and the response are the same. The base_url points at your resource, and model is your deployment's name, which can be anything you chose. Older Azure code with AzureOpenAI(...) and an api_version still works, but the v1 API, generally available since August 2025, ends the monthly version changes. To drop keys, pass an Entra ID token provider as api_key; What is Microsoft Foundry shows it.
Who sees your data
Both sides say the same headline, no training on your data, but in different ways:
| OpenAI API | Azure OpenAI | |
|---|---|---|
| Used to train models | No, unless you opt in | No, without your permission or instruction, without your permission or instruction |
| Seen by OpenAI | Yes, OpenAI runs the service | No: Microsoft hosts the models and does not interact with OpenAI's services |
| Abuse monitoring | Logs kept up to 30 days | Microsoft's own, may include human review |
| Keep prompts out of monitoring logs | Zero data retention, by approval | Modified abuse monitoring, by application |
| Keep data in a region | Per project: US, Europe, UK, Japan and others; +10% on models from 5 March 2026 | Data Zone (US, EU, Asia Pacific) or one Azure geography; data at rest in your geography |
| Agreement | OpenAI's terms | Your Microsoft agreement |
On Azure, data processing is governed by the Microsoft Products and Services Data Protection Addendum.
Capacity, limits and price
- OpenAI: rate limits per organisation and project, raised automatically as spend grows through usage tiers.
- Azure: quota in tokens per minute per subscription, region, model and deployment type, which you split between deployments. A second region adds quota, and Provisioned deployments reserve throughput.
- Price: on Azure, Global Standard has the lowest price for real-time calls, and Global Batch costs 50% less than Global Standard. Compare the model you need on both sides' price pages before deciding; LLM API rate limits explains how each side counts tokens against limits.
- Batch: Azure's Global Batch costs 50% less than Global Standard with a 24-hour target turnaround; OpenAI's Batch API runs outside your synchronous rate limits.
Which to choose
- Azure OpenAI if: your data is in Azure; you need private networking or Entra sign-in; procurement wants one Microsoft contract; or you want OpenAI's models next to Anthropic, DeepSeek and Grok models in Foundry.
- OpenAI API if: you want OpenAI's tools and models as OpenAI releases them; you have no Azure estate; or your team is small and an API key is all the setup it wants. Check that the model you need is deployable in your Azure region before choosing Azure.
Moving later is cheap for plain chat and tool calls, because the SDK and request shape are the same. It costs more the more you lean on features one side has and the other lacks. The same choice for Claude on AWS is in Claude on Amazon Bedrock or the Claude API, and our cost calculator prices one job across OpenAI, Claude, Gemini and DeepSeek.
Questions
- What is the difference between Azure OpenAI and OpenAI?
- Both serve OpenAI's models. The OpenAI API is run by OpenAI. Azure OpenAI, now part of Microsoft Foundry, is run by Microsoft in Azure: prompts and outputs are not available to OpenAI, sign-in can use Microsoft Entra ID, and capacity is bought per Azure subscription, region and deployment type.
- Does OpenAI see my data on Azure OpenAI?
- No. Microsoft's data privacy page says prompts and completions are not available to OpenAI, are not used to train models without your permission or instruction without your permission or instruction, and that Microsoft hosts the models without interacting with services run by OpenAI. Microsoft runs its own abuse monitoring, which can include human review, unless you are approved for modified abuse monitoring.
- Is the code for Azure OpenAI different from OpenAI?
- Barely, on the v1 API. You use the same OpenAI SDK, set base_url to https://YOUR-RESOURCE-NAME.openai.azure.com/openai/v1/ and pass an Azure key or an Entra ID token, and the model parameter is your deployment's name instead of the model's. No api-version parameter is needed.
- Does OpenAI use API data for training?
- Not by default. OpenAI's data controls page says API data is not used to train models unless you opt in, and abuse-monitoring logs are kept for up to 30 days by default by default. Zero data retention is available by approval.
- Can I keep data in the EU with OpenAI or Azure OpenAI?
- Yes, on both. For eligible customers, OpenAI offers data residency per project in regions including Europe; regions outside the US also need approved abuse monitoring controls and a Modified Retention amendment, through eu.api.openai.com, with a 10% uplift for models released from 5 March 2026. Azure offers Data Zone deployments that process data inside the EU, and stores data at rest in your chosen geography.