Skip to main content

Cloud guides

Deploying AI models in the cloud: from calling an API to running GPUs, and keeping costs down

There are three common ways to run an AI application in the cloud: call a model API, run a small model on CPU, or host an open model on GPU. This guide explains when each fits, the matching services on AWS and Google Cloud, and how to keep costs under control.

By NiceCloud TeamPublished 4 min read
Deploying AI in the cloud — a GPU with a cooling fan connects to a cloud through glowing traces.
On this page

When you build an AI application, the pivotal decision isn’t which GPU hardware to procure, but whether you truly need to host a model yourself. Many projects achieve better performance and lower overhead by consuming model APIs. Self-hosting only yields a return on investment when specific latency, data privacy, or fine-tuning requirements necessitate dedicated infrastructure.

Three ways to deploy

Approach Suits Cost profile Difficulty
Call a model API Most chat, writing, summarizing and RAG apps Pay per call, no idle cost Low
Small model on CPU Embeddings, classification, small quantized models A regular VM is enough, low cost Medium
Open model on GPU Private deployment, fine-tuning, image generation, high-throughput inference GPUs bill by the hour, even when idle High

Option 1: call a model API

Run your application logic on a standard, lightweight VM or a serverless function, offloading intelligence to a managed model endpoint:

  • AWS: Amazon Bedrock provides consolidated access to various foundation models via a single API.
  • Google Cloud: Vertex AI offers native access to the Gemini family and other models.
  • Hosting the app: Use serverless compute like Cloud Run or AWS Lambda to host your application logic; these services bill per request and incur minimal costs during periods of inactivity.

Validate your product architecture using an API first. Only pivot to self-hosting once your traffic patterns and model requirements are mature.

Option 2: a small model on CPU

Tasks like embeddings, text classification, and quantized language models often perform adequately on CPU-only instances. Select a general-purpose or memory-optimized VM instance, and deploy your model via container orchestration. This approach is ideal for predictable traffic volumes where sub-millisecond GPU latency is not a requirement.

Option 3: an open model on GPU

Reserve GPUs for high-intensity private deployments, custom fine-tuning, or generative image tasks. Keep these operational realities in mind:

  • Resource Sizing: GPU memory determines whether a model fits; evaluate your requirements based on parameter count and quantization precision.
  • Inference vs. Training: Treat these as distinct workloads. Inference typically requires a single GPU or a small cluster, whereas training necessitates larger memory pools and high-bandwidth interconnects.
  • Availability: GPU quota, zone support and physical availability must each be checked; trial accounts cannot request quota increases (Google Compute Engine). Popular configurations may face regional shortages, so verify availability in the console during the design phase.

Five habits that keep costs down

  1. API first, hosting later: Do not commit to GPU hardware before your MVP is validated.
  2. Separate the bill: Use project-level tagging or separate accounts to isolate AI infrastructure costs.
  3. Set budget alerts: Configure active monitoring in AWS Budgets or Google Cloud budget alerts. Note that billing alerts can lag actual charges and a notification alone does not stop resources (AWS Budgets).
  4. Limit API usage: Implement rate limiting and quotas on your application’s API consumption to prevent cost spikes from unexpected traffic.
  5. Scale to zero where you can: Automate the shutdown of development environments and staging clusters during non-working hours.

For further cost-saving strategies, see the guide to cloud discounts.

Which cloud

  • Use Google Cloud to integrate Gemini models with BigQuery data workflows.
  • Use AWS to access multi-provider model libraries on scalable infrastructure.
  • Use Alibaba Cloud for Asia Pacific deployments or if your team requires a Chinese-language management console.

You can register an official account via NiceCloud to pay by bank transfer, card or PayPal, bypassing the need for an overseas credit card. Learn more at how to open an official cloud account.

Common questions

Do individual developers need a GPU server

Start with model APIs to validate your product. Rent hourly GPU instances only when you are ready to host your own private or fine-tuned model.

How do I estimate model API costs

APIs charge per input and output token. Calculate your monthly costs by multiplying your expected request volume by the average token count per request observed during testing.

Do I need an ICP filing if I deploy overseas

Check both the origin server and the CDN coverage. A public website hosted in Hong Kong or another region outside mainland China generally does not need a mainland hosting filing when it uses only offshore nodes. Alibaba Cloud requires a filing for the acceleration domain when its CDN serves through mainland nodes. Alibaba Cloud CDN filing requirements

About the author

NiceCloud TeamCloud advisory team

NiceCloud is an authorized partner of 7 global clouds, helping companies open and top up official cloud accounts.

Related articles

Back to the blog
Top upOpen account