liveBook · Manning

Cost optimization

Cost optimization is the practice of managing or reducing the resources and expenditure required to operate a system while preserving required outcomes and capabilities.

How 4 Manning books explain it

Machine Learning Platform Engineering

Cost optimization is the systematic reduction of computational and operational expenses while maintaining required system performance and quality.

How it is used
Manages production LLM spending through economic planning, model routing, token reduction, caching, and continuous monitoring.
How deep it goes
Explains API economics, routing trade-offs, monitoring procedures, and implementation patterns, but does not derive detailed infrastructure cost models.
Examples
Uses a documentation assistant, three-tier Gemini routing, minimal classification prompts, Langfuse traces, budgets, and per-query cost alerts.
What you can do after
Apply tiered model selection, semantic caching, prompt optimization, and Langfuse-based cost monitoring to production LLM workloads.

Read how Machine Learning Platform Engineering explains cost optimization →

Build Python Web Apps with Streamlit

Cost optimization is the practice of reducing the resources or money required to operate a system while preserving required outcomes.

How it is used
Reduces LLM operating costs in an AI-powered trivia application.
How deep it goes
Explains token-based pricing and practical reductions, but does not quantify savings or compare model quality.
Examples
Uses an OpenAI tokenizer, gpt-5.1 pricing, max_tokens, batched trivia questions, and user-provided API keys.
What you can do after
Apply token counting, prompt reduction, output limits, batching, and model selection to lower LLM costs.

Read how Build Python Web Apps with Streamlit explains cost optimization →

Generative AI in Action

Cost management is the planning, monitoring, and control of resources and expenditures to achieve objectives within financial constraints.

How it is used
Guides production teams in monitoring and controlling generative-AI spending while maintaining reliable service.
How deep it goes
Covers practical controls and tradeoffs but stops short of financial formulas or detailed infrastructure-cost modeling.
Examples
Uses prompt trimming, concise outputs, caching, quotas, rate limits, auto-scaling, and cost-performance tradeoffs as operational examples.
What you can do after
Operate production generative-AI services with monitored usage, controlled demand, and deliberate cost-performance decisions.

Read how Generative AI in Action explains cost optimization →

Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform

Cost optimization is the practice of controlling infrastructure spending by aligning resource usage and capacity with demand and organizational requirements.

How it is used
Guides infrastructure-as-code decisions that control cloud waste, resource capacity, and changing operational costs.
How deep it goes
Explains iterative practices, demand measurement, deployment safeguards, and architectural trade-offs, but defers provider-specific implementation.
Examples
Uses on-demand environments, regional infrastructure changes, production testing, and seasonal conference-platform demand as concrete cases.
What you can do after
Apply cost optimization by measuring demand, changing capacity, testing infrastructure safely, and selecting suitable pricing arrangements.

Read how Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform explains cost optimization →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.