You are not logged in.
I run a couple of headless scripts on my home server (systemd timers) that call LLM APIs for summarizing logs, drafting commit messages, and batch jobs. Sharing what cut my monthly bill from ~$35 to a few dollars, in case it helps anyone doing similar automation on Arch.
1) Audit your actual usage first. I logged a week of calls: ~80% were summarization/formatting that any small "flash" model handles. Only 20% needed real reasoning. I had been lazily routing everything to a flagship model.
2) Since everything already spoke the OpenAI SDK, I moved to an OpenAI-compatible relay (https://y-api.bestvirtualgoods.com) — the migration was literally changing base_url and the key. Billing is per token with no minimum, so cron jobs that sit idle cost nothing, and there are a few free models (deepseek-v4-flash, minimax-m2.7) I used to test before paying.
3) Route by tier in a small wrapper script:
model=deepseek/deepseek-v4-flash # trivial jobs
# model=openai/gpt-6-luna # hard jobs only
A few gotchas I hit:
- Cheap models truncate long context differently — test with your real inputs before switching.
- Check per-call latency in the console log; some relays are slower on long completions.
- Keep one API key per systemd unit so usage is attributable.
Net result: same workload, bill down ~90%. If anyone has other tricks for batch LLM jobs on a server (caching, batching, local fallbacks with llama.cpp), I'd like to hear them.
Offline