Try Bifrost Enterprise free for 14 days.
Request access

How to Get an Azure OpenAI API Key

Create an Azure OpenAI resource in the Azure portal, copy your key and endpoint, deploy a model in Azure OpenAI Studio, then integrate with Bifrost for enterprise routing, virtual keys, and cost governance.

Portal & deploymentsBearer authDeployment-based routingEnterprise AzureBifrost gateway

Azure OpenAI provider summary

Bifrost supports Azure OpenAI through OpenAI-compatible HTTP APIs. Route requests as azure/<deployment> using your deployment name from Azure OpenAI Studio.

PropertyDetails
DescriptionAzure OpenAI provides GPT, o-series, and embedding models via regional Azure resources with deployment-based routing.
Provider route on Bifrostazure/<deployment>
Provider docAzure OpenAI documentation
API endpoint for providerhttps://{resource}.openai.azure.com/openai/deployments/{deployment}
Supported endpoints/v1/models, /v1/completions, /v1/chat/completions, /v1/responses, /v1/images/generations, /v1/images/edits, /v1/embeddings, /v1/audio/speech, /v1/audio/transcriptions, /v1/files, /v1/batches

Official Azure OpenAI Resources

Use these Microsoft-hosted links for console access, API documentation, and authentication details.

Prerequisites

Before you begin, you will need:

Azure accountAzure subscriptionAzure OpenAI resource access approved
i
Azure trial: New Azure accounts may receive trial credits. Azure OpenAI requires access approval and a deployed model before you can call the API.

[ QUICK START ]

How Do You Get an Azure OpenAI API Key in 5 Steps?

1

Create or sign in to an Azure account

Use the Azure Portal.

Go to portal.azure.com and sign in with your work, school, or personal Microsoft account. Create or select a subscription for billing.

i
Access approval: If Azure OpenAI is not available in your subscription, apply for access from the Azure OpenAI overview page before creating a resource.
2

Create an Azure OpenAI resource

In the portal, search for Azure OpenAI, click Create, and choose your subscription, resource group, region, and name. Wait for deployment to finish.

Open the resource, then launch Azure OpenAI Studio from the overview blade to manage models and deployments.

3

Copy your API key and endpoint

Find both values under Keys and Endpoint in your resource.

In your Azure OpenAI resource, open Keys and Endpoint. Copy KEY 1 (or KEY 2) and the Endpoint URL. Store them as environment variables:

Terminal (macOS/Linux)
export AZURE_OPENAI_API_KEY="your-key-here"
export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/"
export AZURE_OPENAI_API_VERSION="2024-10-21"
!
Treat keys like passwords: Never expose API keys in client-side code or commit them to version control. Store in .env files and add to .gitignore.
4

Deploy a model in Azure OpenAI Studio

Deployments map a friendly name to a model in your region.

In Azure OpenAI Studio, go to DeploymentsCreate new deployment. Pick a model (for example gpt-4o) and set a deployment name such as gpt-4o. You will use this name in API URLs.

5

Make your first chat completion

Azure uses deployment-scoped URLs and an api-version query parameter.

Replace your-deployment with your deployment name. Use the api-key header:

Terminal
$ curl "$AZURE_OPENAI_ENDPOINT/openai/deployments/your-deployment/chat/completions?api-version=$AZURE_OPENAI_API_VERSION" \
  -H "Content-Type: application/json" \
  -H "api-key: $AZURE_OPENAI_API_KEY" \
  -d '{
    "messages": [{"role":"user","content":"Hello from Azure OpenAI!"}]
  }'

[ MODELS ]

Available Azure OpenAI Models

ModelAPI IDBest for
GPT-4.1gpt-4.1Latest GPT-4.1 when deployed in your resource.
GPT-4.1 minigpt-4.1-miniCost-efficient GPT-4.1 deployment.
GPT-4ogpt-4oMultimodal production workloads.
GPT-4o minigpt-4o-miniHigh-volume chat and assistants.
o3o3Reasoning models for complex analysis.
o3-minio3-miniFaster reasoning tier.
o4-minio4-miniCompact reasoning on Azure OpenAI.
GPT-4 Turbogpt-4-turboPrior-gen turbo with vision support.
GPT-3.5 Turbogpt-35-turboLegacy economical chat (where still available).
text-embedding-3-largetext-embedding-3-largeEmbeddings for RAG on Azure.
whisperwhisperTranscription when deployed.
DALL-E 3dall-e-3Image generation deployments.

Models and availability change over time. See the Azure OpenAI model documentation for the latest list and pricing.

[ TROUBLESHOOTING ]

Troubleshooting Common Azure OpenAI Errors

ErrorLikely CauseWhat to Do
401 UnauthorizedInvalid or missing API key.Verify your API key is correct. Generate a new key if needed.
400 Bad RequestInvalid request format or unsupported model.Wrong deployment name, missing api-version, or invalid JSON body.
404 DeploymentNotFoundDeployment name in URL does not exist in this resource.Confirm the deployment name in Azure OpenAI Studio matches your API path.
429 Rate LimitedRate limit exceeded for your plan.Upgrade your plan or implement exponential backoff. Use Bifrost for intelligent load distribution.
502/503 Service ErrorAzure region outage or deployment not ready.Retry with backoff. Check Azure status. Configure failover with Bifrost.

[ PRODUCTION-READY ]

Use Azure OpenAI with Bifrost

Bifrost is a drop-in replacement for Azure OpenAI SDKs. Update your base URL and keep your client code. Bifrost handles cost tracking, virtual keys, budgets, and intelligent failover.

Step 1: Start Bifrost and register Azure OpenAI

Run the Bifrost gateway and configure your Azure OpenAI credentials in the Web UI.

Terminal
$ npx -y @maximhq/bifrost
OUTPUT
 Bifrost started
├─ HTTP server listening on http://localhost:8080
├─ Web UI available at   http://localhost:8080
└─ Configure providers and virtual keys in the dashboard
Add the Azure OpenAI integration in the Web UI. For details, read Azure OpenAI on Bifrost.

Step 2: Point your Azure OpenAI SDK at Bifrost

Update your SDK to route through Bifrost's OpenAI-compatible gateway.

example.py
from openai import AzureOpenAI

# BEFORE
# client = AzureOpenAI(
#     api_key=os.environ["AZURE_OPENAI_API_KEY"],
#     azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
#     api_version=os.environ["AZURE_OPENAI_API_VERSION"],
# )

# AFTER: route via Bifrost + virtual key
client = AzureOpenAI(
    api_key="sk-bf-your-virtual-key",
    azure_endpoint="http://localhost:8080/azure",
    api_version="2024-10-21",
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello from Bifrost!"}],
)

print(response.choices[0].message.content)
Virtual keys can be sent as x-bf-vk or Authorization: Bearer sk-bf-* per the Bifrost documentation.

Ready to Route Azure OpenAI Through Bifrost?

Bifrost is open source and production-ready. Get started in minutes with cost tracking, virtual keys, and failover built in.

[ BIFROST FEATURES ]

Open Source & Enterprise

Everything you need to run AI in production, from free open source to enterprise-grade features.

01 Governance

SAML support for SSO and Role-based access control and policy enforcement for team collaboration.

02 Adaptive Load Balancing

Automatically optimizes traffic distribution across provider keys and models based on real-time performance metrics.

03 Cluster Mode

High availability deployment with automatic failover and load balancing. Peer-to-peer clustering where every instance is equal.

04 Alerts

Real-time notifications for budget limits, failures, and performance issues on Email, Slack, PagerDuty, Teams, Webhook and more.

05 Log Exports

Export and analyze request logs, traces, and telemetry data from Bifrost with enterprise-grade data export capabilities for compliance, monitoring, and analytics.

06 Audit Logs

Comprehensive logging and audit trails for compliance and debugging.

07 Vault Support

Secure API key management with HashiCorp Vault, AWS Secrets Manager, Google Secret Manager, and Azure Key Vault integration.

08 VPC Deployment

Deploy Bifrost within your private cloud infrastructure with VPC isolation, custom networking, and enhanced security controls.

09 Guardrails

Automatically detect and block unsafe model outputs with real-time policy enforcement and content moderation across all agents.

[ SHIP RELIABLE AI ]

Try Bifrost Enterprise with a 14-day Free Trial

[quick setup]

Drop-in replacement for any AI SDK

Change just one line of code. Works with OpenAI, Anthropic, Vercel AI SDK, LangChain, and more.

1import os
2from anthropic import Anthropic
3
4anthropic = Anthropic(
5 api_key=os.environ.get("ANTHROPIC_API_KEY"),
6 base_url="https://<bifrost_url>/anthropic",
7)
8
9message = anthropic.messages.create(
10 model="claude-3-5-sonnet-20241022",
11 max_tokens=1024,
12 messages=[
13 {"role": "user", "content": "Hello, Claude"}
14 ]
15)
Drop in once, run everywhere.

[ FAQ ]

Frequently Asked Questions

Azure OpenAI runs OpenAI models in your Azure subscription with regional deployments, private networking, and Microsoft enterprise controls. You use deployment names in URLs instead of model IDs on api.openai.com.

Yes. Most subscriptions must request access before creating an Azure OpenAI resource. Apply in the Azure portal under Azure OpenAI and wait for approval before deploying models.

Yes. Use the AzureOpenAI client from the openai package with your resource endpoint, API key, and api-version. Bifrost also accepts OpenAI-compatible requests routed to azure/<deployment>.

A deployment is your named instance of a model in Azure OpenAI Studio (for example gpt-4o). API calls use the deployment name in the URL path, not the raw model name from the catalog.

Use Azure Cost Management and metrics in the portal. For unified tracking across providers, route traffic through Bifrost to aggregate spend per team and virtual key.

Yes. Register your Azure OpenAI credentials in the Bifrost Web UI and route SDK calls to http://localhost:8080/azure with a virtual key for governance and failover.