Skip to main content
Back to Writing

Technical Writing

Published August 2026 · 10 min read

What It Would Cost to Run PolicyGPT for 10,000 Queries

A transparent cost model for running an evidence-gated policy RAG workload, covering token usage, local embeddings, model selection, infrastructure, fallback behaviour, observability, and the assumptions behind every estimate.

RAG Cost ModellingOpenAI APISentenceTransformersFastAPIPostgreSQLChromaDBDocker ComposeObservability

Why estimate cost before deployment?

A RAG system can look inexpensive during development because local testing uses a small document set, low traffic, and sometimes a free provider tier. Production economics are different.

Costs can come from:

  • model input and output tokens
  • embedding generation
  • application compute
  • PostgreSQL and vector storage
  • document ingestion and re-indexing
  • logs, metrics, backups, and data transfer
  • retries, provider failures, and inefficient retrieval
  • engineering and operational support

This article estimates what it could cost to process 10,000 PolicyGPT queries. It is a planning model, not an invoice or a claim that PolicyGPT currently serves production traffic.

PolicyGPT is presently a portfolio engineering project with a verified local Docker Compose release. The cloud configurations below are hypothetical deployment scenarios.

PolicyGPT’s current cost-relevant architecture

PolicyGPT uses:

  • Next.js for the review interface
  • FastAPI for document and question-answering APIs
  • PostgreSQL for document lifecycle metadata
  • ChromaDB for persistent vector retrieval
  • SentenceTransformers for local embeddings
  • an evidence gate before optional answer generation
  • page-level citations
  • controlled unsupported-question rejection
  • citation-only fallback when generation is unavailable
  • structured logs and request IDs
  • Docker Compose for the local release

Because embeddings are generated locally with SentenceTransformers, this model does not include a per-token embedding API charge. Embedding still consumes CPU time and memory, but that consumption is included in the infrastructure estimate.

Architecture Flow

6 stages
  1. 01Stage

    Receive question

    Validate the request and assign a request ID

  2. 02Stage

    Create local embedding

    Run the SentenceTransformer model on application compute

  3. 03Stage

    Retrieve evidence

    Search ChromaDB and load document metadata from PostgreSQL

  4. 04Stage

    Evaluate answerability

    Inspect retrieval strength, lexical coverage, numbers, direct support, and scope risk

  5. 05Stage

    Choose an outcome

    Generate an answer, return citation-only evidence, or reject the unsupported request

  6. 06Stage

    Record operational evidence

    Log latency, evidence state, provider state, citations, and errors without retaining unnecessary sensitive text

Workload assumptions

The estimate uses the following explicit assumptions:

AssumptionValue
Total questions10,000
Workload period30 days
Average questions per day333
Average model input per generated answer2,000 tokens
Average model output per generated answer300 tokens
Total input if all questions use generation20 million tokens
Total output if all questions use generation3 million tokens
Query embeddingsLocal SentenceTransformer
Document corpusSmall-to-medium internal policy collection
CurrencyUSD
TaxesExcluded
Engineering labourExcluded

The 2,000-token input budget includes the system instructions, user question, retrieved policy excerpts, citation metadata, and evidence-gate context sent to the generation provider.

Actual usage should be measured from provider response metadata rather than estimated from character counts.

Scenario 1: citation-only local operation

PolicyGPT can remain useful without an external generation model. When evidence is answer-ready but the provider is unavailable, it can return the relevant excerpts and page citations.

In this mode:

  • query embeddings remain local
  • retrieval remains local
  • the evidence gate still runs
  • no generation API tokens are purchased
  • users receive evidence rather than a synthesized answer

If the system runs on an existing developer machine, the incremental cloud bill can be close to zero, excluding electricity, maintenance, backups, and the value of the hardware.

That is suitable for development and controlled demonstrations. It is not equivalent to a secure, highly available production deployment.

Scenario 2: one small cloud server

For an illustrative self-managed deployment, the Next.js frontend, FastAPI service, PostgreSQL, ChromaDB, and local embedding model could run on one Linux server.

A safer starting point than a 2 GB instance is approximately:

  • 2 virtual CPUs
  • 8 GB RAM
  • 160 GB SSD storage
  • Docker Compose
  • HTTPS reverse proxy
  • scheduled backups
  • resource and uptime monitoring

An AWS Lightsail Linux instance with 8 GB RAM is listed at approximately $44 per month with public IPv4. Pricing varies by region and can change, so this is an illustrative baseline rather than a vendor recommendation. See the official AWS Lightsail instance pricing documentation.

Illustrative Base Infrastructure

$44/month

One self-managed 8 GB Linux instance. This does not include managed database separation, high availability, dedicated backup storage, enterprise monitoring, a web application firewall, support, or engineering labour.

A single-server design keeps the estimate understandable, but it also creates a single point of failure. A production system handling confidential policies would normally separate services and add security, backup, recovery, and availability controls.

Scenario 3: generation with GPT-5 mini

As of August 2026, OpenAI lists GPT-5 mini at:

  • $0.25 per million input tokens
  • $2.00 per million output tokens

Current rates should always be checked on the official GPT-5 mini model page before approving a budget.

For 10,000 generated answers:

Input cost
20 million tokens × $0.25 per million = $5.00

Output cost
3 million tokens × $2.00 per million = $6.00

Estimated generation cost
$5.00 + $6.00 = $11.00

Adding the estimated $44 monthly infrastructure baseline gives:

Estimated total with GPT-5 mini
$44 infrastructure + $11 model usage = $55 per month

Comparing model choices

The same workload changes substantially depending on the generation model.

ModelInput costOutput costEstimated model costEstimated total
GPT-5 mini$5.00$6.00$11.00$55.00
GPT-5.4 mini$15.00$13.50$28.50$72.50
GPT-5.4$50.00$45.00$95.00$139.00

GPT-5.4 mini calculation

At $0.75 per million input tokens and $4.50 per million output tokens:

Input: 20M × $0.75 = $15.00
Output: 3M × $4.50 = $13.50

Estimated model cost
$15.00 + $13.50 = $28.50

Estimated monthly total
$44.00 + $28.50 = $72.50

GPT-5.4 calculation

At $2.50 per million input tokens and $15.00 per million output tokens:

Input: 20M × $2.50 = $50.00
Output: 3M × $15.00 = $45.00

Estimated model cost
$50.00 + $45.00 = $95.00

Estimated monthly total
$44.00 + $95.00 = $139.00

These figures are planning estimates, not quotations. Actual cost depends on prompt length, retrieved context, response length, cached input, retry behaviour, regional processing, and the model selected at runtime.

Why evidence gating can reduce cost

PolicyGPT does not need to call a generation model for every request.

The answerability layer can reject unsupported questions when retrieval does not provide adequate evidence. A rejected request may still consume API, retrieval, embedding, and logging resources, but it can avoid unnecessary generation tokens.

For example, assume that 20% of 10,000 requests are rejected before generation:

Requests received: 10,000
Requests sent to generation: 8,000
Generation calls avoided: 2,000

If token usage scales proportionally, the GPT-5 mini model estimate could fall from approximately $11.00 to about $8.80.

That saving is useful, but the more important benefit is reliability: the system avoids producing an answer when the retrieved evidence does not support one.

Costs not included

This estimate intentionally excludes several expenses that a production deployment may require:

  • engineering and maintenance time
  • authentication and identity management
  • backups and disaster recovery
  • security monitoring and vulnerability management
  • document OCR or commercial parsing services
  • private networking and regional data-residency premiums
  • observability platforms
  • external reranking APIs
  • support, compliance, and incident response
  • load testing and penetration testing

These omissions matter. A small technical deployment can be inexpensive while the complete operational system still requires meaningful engineering and governance investment.

Latency and capacity considerations

Cost is only one deployment constraint. At 10,000 monthly queries, average traffic is low, but production traffic is rarely uniform.

The system should still be tested for:

  • concurrent uploads and queries
  • database connection limits
  • vector-search latency
  • model-provider timeouts
  • retry amplification
  • large-document ingestion
  • response streaming
  • queueing and back-pressure
  • degraded operation during provider failure

PolicyGPT already separates readiness checks, retrieval, evidence assessment, generation, and fallback behaviour. That separation makes it easier to measure where latency and cost are introduced.

Logging without storing unnecessary content

Operational measurement should record enough information to diagnose behaviour without unnecessarily preserving sensitive policy text or user questions.

Useful fields include:

  • request ID
  • document identifiers and versions
  • retrieved page and chunk identifiers
  • retrieval scores
  • answerability decision
  • selected provider and model
  • input and output token counts
  • latency by processing stage
  • fallback state
  • final request status

Raw prompts, complete documents, and generated answers should not automatically be retained indefinitely. Retention must follow the organization’s privacy, security, and audit requirements.

What should be measured in a real deployment

Before treating this estimate as a budget, I would run a representative workload and measure:

  1. average input tokens per supported request
  2. average output tokens per generated answer
  3. percentage of unsupported questions rejected before generation
  4. cache-hit rate
  5. retrieval and generation latency
  6. retry and provider-failure rates
  7. document-ingestion volume
  8. database and vector-store growth
  9. logging volume and retention
  10. peak concurrent traffic

These measurements would replace assumptions with observed evidence.

Practical planning range

For the stated assumptions, a reasonable monthly planning range is:

Lower-cost configuration:
Approximately $55 per month with GPT-5 mini

Balanced configuration:
Approximately $72.50 per month with GPT-5.4 mini

Higher-capability configuration:
Approximately $139 per month with GPT-5.4

A production budget should include additional contingency for traffic growth, retries, monitoring, backups, and provider-price changes.

Final perspective

For 10,000 monthly queries, model inference is not necessarily the largest expense. Infrastructure, observability, security, maintenance, and governance can matter more than token charges.

The correct design is therefore not simply to choose the cheapest model. It is to:

  • retrieve only the evidence required
  • reject unsupported requests before generation
  • limit unnecessary context
  • measure token use and latency
  • log decisions without retaining excessive sensitive data
  • select the smallest model that satisfies the evaluated quality threshold

That is the production lesson behind this estimate: cost control should be designed into the evidence workflow rather than added after deployment.

Pricing references

Pricing should be rechecked before making a purchasing decision because provider rates can change.

The case study shows the implemented local architecture and measured holdout results. PolicyGPT Enterprise case study.

Chintan Patel

Applied AI Engineer · ML · RAG · Full-Stack AI Systems

Privacy