How to Deploy DeepSeek-R1 & Qwen on Azure with Scale-to-Zero ($0 Idle Bill)
If you are building AI applications, you quickly hit a fork in the road:
Proprietary APIs (OpenAI/Anthropic): Great to start, but per-token costs ramp up quickly with volume, and enterprise clients often restrict sending sensitive data to external third-party endpoints.
Self-Hosting Open Models (DeepSeek-R1, Qwen 2.5, Llama 3.2): Total data privacy, but traditional cloud deployments on Azure require dedicated GPU virtual machines running 24/7. That can easily cost $600 to $1,800 every month —even when nobody is using the app overnight.
In this guide, I'll walk through how we solved this by building a lightweight FastAPI gateway deployed to Azure Container Apps (ACA) configured with automated scale-to-zero .
The Architecture at a Glance
The gateway sits between client applications and the underlying Hugging Face Transformers model:
100% Drop-in OpenAI Compatibility: Implements /v1/chat/completions and /v1/models .…