How do you keep model and server costs down?
16 posts
Playbook
Practitioners reduce costs by consolidating infrastructure to low-cost VPS hosts, auditing usage to eliminate redundant services, and optimizing agent workflows to minimize token consumption.
- Consolidate stack to single VPS
Migrate services from multiple platforms like Vercel and Railway to a single Hetzner or Contabo server using orchestration tools like Coolify. This approach can reduce monthly hosting costs from $60 to approximately $7 to $8, or keep total infrastructure spend between 20 to 40 euros . 4610
- Audit automation and API usage
Export task histories and analyze the last 30 days of runs to identify low-frequency automations or API calls. Move rarely used items to pay-per-use models or delete them, and use cached stable prompts to reduce costs by up to 88% for repeated inputs . 19
- Optimize agent CLI interactions
Restructure CLI tools for coding agents by using predicate flags to avoid complex command assembly and trimming JSON output to remove redundant fields. This reduces output tokens by up to 79% and API costs by up to 67% . 7
- Structure agent tasks for efficiency
Implement prompt guidelines that require writing a five-line plan before large tasks, reading files only once, and splitting code output into chunks of about 150 lines. This helps manage token usage and prevents rapid depletion of subscription limits . 3
Choosing between approaches
Self-hosting on a single server reduces monthly costs significantly but requires managing zero-downtime deployments and parallel running of services during migration, which can take 3 to 4 days 6. Additionally, while AI subscriptions are the largest cost line, the labor cost for reviewing agent output often exceeds the direct API costs 25.
Not covered yet
The material does not specify how to handle variable demand spikes or provide detailed strategies for negotiating enterprise pricing with model providers.
Posts
- Audit Zapier from its task history: 123 automations, 2 did 88% of the work, bill to zeroThe author's team used Zapier for 10 years and paid for 123 automations, of which 63 had not run in a month and just 2 did 88% of the work.

- Costing a 90-day agent run: the API was 3% of it, review time was the bulkThe author ran an agent on a Raspberry Pi 5 to draft content and answer support email for three small products, then tallied 90 days: $1,486 gross, $1,271 net, $126.90 on the LLM API, $270.90 in total cash spend.

- Why Claude usage limits drain fast, and a CLAUDE.md block to slow itThe author names five reasons a Claude subscription limit runs out fast: output token cost, cache writes, tool connections, extended thinking and peak hours, estimating output tokens at about 4 to 7 times input.

- A startup stack without cloud credits: Rails, Kamal and Hetzner for 20 to 40 euros a monthThe author's stack does not rely on credits: two Hetzner servers at 17 to 32 euros a month, Kamal for zero-downtime deploys, Terraform recording servers and domains, and Cloudflare's free tier, about 20 to 40 euros a month in all.

- Split a $583 monthly software bill by project: AI is the largest line on both sidesThe author breaks software costs down: $583.13 a month, of which $328.42 goes to three blogs and $254.71 to a self-built product.

- Collapsing three platforms at $60 a month into one Hetzner server cut costs by about 80%The author moved a stack of Vercel ($20), Railway ($15) and Appwrite Cloud ($25), $60 a month in all, onto one Hetzner CX33 at 8.99 pounds, orchestrated with Coolify and self-hosted Appwrite, with Cloudflare for edge and R2.
- Rework a CLI for coding agents: predicate flags and terse JSON cut output tokens up to 79%The Cost.dev team found coding agents burn many tokens calling CLIs and tend to hallucinate, so it restructured its CLI.
- Simple CSV whitespace task triggers 32k reasoning tokens and $14 API costPatch recounts how an AI agent over-engineered a request to remove trailing whitespace from a CSV parser.
- Official API hits 83.82% accuracy compared to 37% via cheap relays7 Years compared model performance between the official API and a cheap relay.
- Hetzner out of stock, so a solo dev runs a SaaS on Contabo for $7 to $8 a monthThe author planned to use Hetzner's Cost-Optimized line, but it was out of stock in every European location, and the next tier up made the smallest instance about $23.

- The full bill for shipping an AI prototype comes to about $31 a month
- Three production AI SaaS products on $5 a month of fixed infrastructure
- Running SaaS apps on one Hetzner ARM box with Kamal costs about $11 a month
6 more posts to see