Private LLM Chat
Open sourceMIT licensed · runs in your AWS account

Your own ChatGPT, on your own GPU, in your own AWS account.

Deploy open-source LLMs (Qwen, Llama, Gemma, DeepSeek…) on Amazon SageMaker with vLLM, with a private ChatGPT-style app in front: accounts with Google sign-in and 2FA, documents, images, OCR, and GPUs that switch themselves off.

Or try it on your laptop in 5 minutes, no GPU needed: make up

The chat screen: conversations on the left, a streamed answer with a table and a code block on the rightThe chat screen in dark mode, with a document and an image attached
Features

Everything a team needs from a private ChatGPT

A complete, secure app and the infrastructure to run it, from a laptop demo to a production deployment, with every step explained.

Private by design

The model, database and files stay in your AWS account and region. The model endpoint has no public URL, and prompts are never logged.

Any open model

Pick a preset (Qwen, Llama, Gemma, DeepSeek) or any Hugging Face model vLLM supports. Ollama and OpenAI-compatible servers work too.

Streaming chat

Answers stream token by token, with Markdown, code highlighting, tables and math. History, search, pin, regenerate and stop.

Documents & images

Attach PDFs, Word files, text and code: their text goes into the prompt, trimmed to fit. Vision models see images as images.

OCR

Extract text from photos, screenshots and scanned PDFs with a vision LLM, with Tesseract as a CPU fallback. Copy, download, or chat about it.

Accounts, Google & 2FA

Email and password with verification, Sign in with Google, two-factor auth with an authenticator app or email codes, recovery codes.

GPU on demand

Endpoints start when someone sends a message and are deleted after 30 idle minutes. A forgotten GPU can't run up a bill.

Infrastructure as code

The whole AWS stack in Terraform: CloudFront, load balancer, ECS Fargate, RDS, S3, SES, SageMaker, and CI/CD with GitHub OIDC.

How it works

The path of one message

From the moment you press Send to the first token on your screen.

  1. Your browser

    You press Send. The message and any attached files go to the API over HTTPS, with your session cookie.

    POST /api/conversations/{id}/messages/
  2. Django API

    Checks the model's GPU is awake (or wakes it), then builds the prompt: history, your files and instructions, trimmed to the context window.

    ensure_ready() → build_prompt()
  3. SageMaker + vLLM

    The request is IAM-signed and streamed to your private endpoint, where vLLM generates the answer on the GPU.

    InvokeEndpointWithResponseStream
  4. Streamed back

    Each token is relayed to the browser as a Server-Sent Event, so the answer appears as it is written. Stop works at any time.

    text/event-stream
Architecture

A standard AWS stack you can read in one sitting

Everything runs in your account, created by Terraform. Locally, Docker Compose runs the same web and api images with PostgreSQL, Mailpit, SearXNG for web search, and an open-source model on your own GPU.

Architecture on AWSThe browser reaches CloudFront over HTTPS. CloudFront forwards to an Application Load Balancer, which routes by path to two ECS Fargate services: web (Next.js) and api (Django). A third service, the gpu-controller, starts and stops the SageMaker endpoint. The api stores data in RDS PostgreSQL, files in a private S3 bucket, sends email with SES, and calls the SageMaker endpoint (vLLM on a GPU) with IAM-signed, streaming requests.Your AWS accountECS Fargate (ARM64)HTTPSone originby path: /api/* → api, rest → webSQL · files · emailIAM-signed, streamingstart / stopBrowseryour teamCloudFrontHTTPS, one domainLoad balanceraccepts CloudFront onlywebNext.js (this page)apiDjango REST, SSEgpu-controllerstarts & stops GPUsRDS PostgreSQLusers, chatsS3private filesSESemailSageMaker endpointvLLM on a GPU · no public URL
  1. Browseryour team
  2. CloudFrontHTTPS, one domain for the app and the API
  3. Load balancerroutes /api/* to api, the rest to web
  4. ECS Fargate (ARM64)
    webNext.js
    apiDjango, SSE
    gpu-controllerstarts & stops GPUs
  5. RDSPostgreSQL
    S3private files
    SESemail
  6. SageMaker endpointvLLM on a GPU · no public URL
One request path for everything; the GPU is the only expensive part, and it only exists while it is needed.
  • No public model URL. The SageMaker endpoint is only reachable through the AWS API, signed with the api task's IAM role. There is no API key to leak.
  • The controller owns the GPU. Terraform creates the (free) model configuration; the gpu-controller creates the endpoint when someone chats and deletes it when idle.
  • One origin. CloudFront serves the UI and the API on one domain, so HttpOnly session cookies and CSRF protection need no cross-site setup.
  • Your data stays put. Prompts are never logged, SageMaker data capture is off, and files live in a private bucket behind 5-minute presigned links.
Read the architecture docs
Models

Tested presets, one command to deploy

Each preset runs on AWS's own vLLM container, so there is nothing to build: python ml/sagemaker/deploy.py deploy qwen3-vl-8b. Or any model vLLM supports.

ModelInstanceGPU$/hourNotes
Qwen3-VL 8B (FP8)Qwen/Qwen3-VL-8B-Instruct-FP8ml.g6e.xlarge1x NVIDIA L40S, 48 GB$2.61Vision / OCR
Qwen3-VL 4BQwen/Qwen3-VL-4B-Instructml.g6.xlarge1x NVIDIA L4, 24 GB$1.13Vision / OCR
Qwen3 8B (FP8)Qwen/Qwen3-8B-FP8ml.g6.xlarge1x NVIDIA L4, 24 GB$1.13Text
Llama 3.1 8B Instructmeta-llama/Llama-3.1-8B-Instructml.g5.xlarge1x NVIDIA A10G, 24 GB$1.41Gated
DeepSeek-R1 Distill (Qwen 7B)deepseek-ai/DeepSeek-R1-Distill-Qwen-7Bml.g5.xlarge1x NVIDIA A10G, 24 GB$1.41Text
Gemma 3 12Bgoogle/gemma-3-12b-itml.g6e.xlarge1x NVIDIA L40S, 48 GB$2.61Vision / OCRGated
Qwen3 32B (FP8)Qwen/Qwen3-32B-FP8ml.g6e.2xlarge1x NVIDIA L40S, 48 GB$2.80Text
Llama 3.3 70B Instructmeta-llama/Llama-3.3-70B-Instructml.g6e.12xlarge4x NVIDIA L40S, 192 GB$13.12Gated

…or any model vLLM supports. Prices are us-east-1 on-demand SageMaker rates; see the cost guide and how to size a GPU.

Cost

Pay for the GPU only while someone is using it

A small always-on baseline for the app, plus GPU hours: $1.13–$2.61 per hour for the single-GPU presets.

The app on AWS, always on
≈ $80–90 / month
  • Load balancer$17–20
  • 3 small Fargate tasks (ARM)$29
  • Public IPv4 addresses$18
  • RDS PostgreSQL (db.t4g.micro)$14
  • Logs, secrets, images, S3$3–7
One GPU: ml.g6e.xlarge (NVIDIA L40S, 48 GB) at $2.61/hour
always_on, 24/7≈ $1,905/month
on_demand, used 2 h a day≈ $157/month
Started by the first message (5–15 min cold start), deleted after 30 idle minutes.
A forgotten GPU is the classic surprise bill. With on_demand it can't happen by accident.
The full cost breakdown
Tech stack

Boring, well-documented building blocks

  • vLLMmodel serving
  • Amazon SageMakerGPUs
  • Django 5.2API
  • Django REST Framework
  • Next.js 16web
  • React 19
  • TypeScript
  • PostgreSQLRDS
  • Amazon S3files
  • Amazon SESemail
  • CloudFrontHTTPS
  • ECS FargateARM64
  • Terraforminfrastructure
  • Docker
  • GitHub ActionsCI/CD
  • Ollamalocal models
FAQ

Questions people ask

Do I need a GPU on my laptop?
No. The first two levels run on any machine (the second is faster with a GPU or Apple Silicon). The GPU lives on SageMaker.
Why SageMaker and not a plain EC2 GPU?
Managed health checks, automatic restarts, IAM-only access to the model, and GPU quota is often easier to get. The serving container is standard vLLM, so moving to EC2, EKS or on-prem later is easy: the app only needs an OpenAI-compatible URL.
Why not Amazon Bedrock?
Bedrock is great for managed models, but you can't run any open model you like with your own settings, and there's less to learn. A Bedrock provider is on the roadmap for comparisons.
How much does it cost?
The app itself is roughly $80–90/month (load balancer, small Fargate tasks, a small RDS instance, public IPs). GPUs are billed per hour while the endpoint exists: about $1.13–2.61/hour for the single-GPU presets. With on_demand scaling you only pay for hours actually used. See the cost guide.
Is it production ready?
It's a solid, secure base: auth with 2FA, IAM, encrypted storage, tests and CI. Before putting company data in it, review the settings for your needs (backups, SES production access, WAF, monitoring): SECURITY.md.
Can I use it with OpenAI or another API?
Yes: any OpenAI-compatible endpoint is a model entry with a base_url. Handy for comparing quality, though then your data leaves your account.

Run it locally

You only need Docker. Pick an open-source model and it runs on your laptop: no GPU and no AWS account needed to try it.

terminal
$ git clone https://github.com/codewithmuh/private-llm-chat-sagemaker-aws.git
$ cd private-llm-chat-sagemaker-aws
$ make up