Mac hosting guide

Cap API Spending for Agents on a Rented Mac

Use three layers: a provider-side spend cap, a per-job ceiling checked after every call, and a launchd watchdog that unloads the agent. A network-bound agent runs on a Figment Intel Mac VM ($25 a month).

Figment editorial teamPublished Updated Facts checked November 10, 2026

Figment Mac plans

US East. Pay before use. Hourly and daily too.

Intel Mac VM4 shared vCPUs, 4GB RAM, 80GB SSD$25per monthApple Silicon Mac VM4 shared vCPUs, 4GB RAM, 65GB SSD$39per monthDedicated M4 Pro12-core CPU, 24GB RAM, 512GB SSD$199per month

Minimum first purchase: $25 of account credit, used for your rental.

Keep an unattended agent inside its budget with three layers that back each other up: a spend cap at the API provider, a per-job ceiling your code checks after every response, and a launchd watchdog that unloads the agent when daily spend crosses a line. A single retry loop can burn hundreds of dollars of token requests before anyone notices, so set all three before the first overnight run.

Which Figment plan should host the agent?

Most API-orchestration agents are network-bound, so the Intel Mac VM ($25 a month, $2 a day, $0.15 an hour) is enough. It has 4 shared vCPUs, 4GB of RAM and an 80GB SSD, and runs macOS Sequoia with Intel-compatible toolchains (Xcode 26.0 to 26.3). It makes outbound HTTPS calls to your LLM provider as normal, and you reach it over SSH, encrypted remote desktop or the browser.

Choose another plan when the agent does more than call an API:

  • Apple Silicon Mac VM ($39 a month, $6 a day): arm64-only binaries, Vision or Core ML calls, or a small local model. It has 4 shared vCPUs and 4GB of RAM.
  • Dedicated M4 Pro 48 GB ($349 a month, or $299 a month on a 12-month term): a larger local model in memory, or an agent you want isolated on a whole Mac (M4 Pro, 48GB RAM, 512GB SSD).

A paused agent still costs the plan price: an hourly or daily Mac bills until you stop it in Figment, and a monthly plan until you cancel. Figment runs the Mac and network layer; your agent code, keys and provider accounts are yours.

How do I set the provider-side cap?

Set it in the provider's console before you deploy, not after the first incident. Every major LLM provider exposes one.

ProviderWhere to set itVerify on vendor docs
OpenAIPlatform → Settings → Limits (per project / per org)openai.com/api
AnthropicConsole → Plans & Billing (workspace spend limit)anthropic.com/pricing
Google AIAI Studio / Cloud billing budget on the projectai.google.dev/pricing
OpenRouterPer-API-key credit limit on a prepaid balanceopenrouter.ai/docs

Enforcement differs. Prepaid balances stop at zero, while metered plans may lag by a short window as usage events roll up. Read the current enforcement wording on your provider's pricing or limits page, and treat the cap as a backstop, not the first line of defence. The client-side counter below keeps a single run from eating the whole month.

How do I stop one job from overspending?

Add up estimated cost during the run and raise an exception when it crosses a ceiling. The example is untested illustrative code. Take cost_per_m_in and cost_per_m_out from your model's current per-million-token prices on the provider's pricing page.

# budget_guard.py
PER_JOB_LIMIT_USD = 0.05   # stop this run at five cents

class BudgetGuard:
    def __init__(self, ceiling: float):
        self.ceiling = ceiling
        self.spent = 0.0

    def charge(self, input_tokens: int, output_tokens: int,
               cost_per_m_in: float, cost_per_m_out: float) -> None:
        cost = (input_tokens / 1_000_000) * cost_per_m_in \
             + (output_tokens / 1_000_000) * cost_per_m_out
        self.spent += cost
        if self.spent >= self.ceiling:
            raise RuntimeError(
                f"Per-job budget exceeded: ${self.spent:.5f} >= ${self.ceiling}"
            )

    def log_summary(self) -> str:
        return f"spent={self.spent:.5f}"

Call guard.charge(...) after every API response, using the token counts in the provider's usage field. When the ceiling is hit, the agent exits non-zero instead of retrying. Write guard.log_summary() to the log file so the watchdog can parse it. If your provider returns a cost value in the response payload, prefer it over a client-side calculation.

How do I work out my ceilings?

Fill in this table once with your model's published per-token prices. Run one sample job first to measure real token counts, because a ceiling built on guessed averages is the main way these setups fail in production.

Budget itemFormulaYour value
Input tokens per call (avg)measure on a sample runn/a
Output tokens per call (avg)measure on a sample runn/a
Cost per call (USD)(in/1M × rate_in) + (out/1M × rate_out)n/a
Max calls per job runset in your agent confign/a
Per-job ceiling (USD)cost_per_call × max_callsn/a
Job runs per day86 400 ÷ StartInterval secondsn/a
Daily ceiling (USD)per_job × runs_per_dayn/a
Monthly ceiling (USD)daily × 30n/a
Provider cap (USD)monthly + headroom you toleraten/a

Worked example: a call averages 2,000 input tokens at $3 per million and 500 output tokens at $15 per million, so (2000/1M × 3) + (500/1M × 15) = 0.006 + 0.0075 = $0.0135 per call. Three calls per job gives a per-job ceiling of $0.0405. Round up to $0.05 to leave room for a retry. One run every two hours is 12 runs a day × $0.0405 = $0.486 a day, or $14.58 for a 30-day month. Compare that with the $25 monthly Intel VM that hosts the agent: it is a useful check on the agent's unit economics.

Act on the first of these stop conditions that triggers:

  1. BudgetGuard raises RuntimeError: exit 1 and do not retry inside the same run.
  2. The provider returns a billing or rate error (HTTP 429 or a documented spend-limit response): log it, back off, exit 1, do not loop.
  3. Parsed daily spend reaches 90% of the daily ceiling: pause the remaining runs for the day.
  4. Month-to-date spend reaches 80% of the monthly ceiling: unload the launchd agent and alert.

How do I schedule the agent and the watchdog?

Create two plists in ~/Library/LaunchAgents/. Apple documents the full key reference in Creating Launchd Jobs.

Agent job (com.yourname.agent.plist):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
  <key>Label</key><string>com.yourname.agent</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/bin/python3</string>
    <string>/Users/agent/jobs/run_agent.py</string>
  </array>
  <key>StartInterval</key><integer>7200</integer>
  <key>StandardOutPath</key><string>/Users/agent/logs/agent.log</string>
  <key>StandardErrorPath</key><string>/Users/agent/logs/agent-err.log</string>
</dict></plist>

The daily watchdog (com.yourname.budget-watchdog.plist) parses the log and unloads the agent if daily spend crosses the line. Replace 0.49 with your daily ceiling:

#!/bin/bash
# budget_watchdog.sh
set -euo pipefail
DAILY_CEILING=0.49
LOG=/Users/agent/logs/agent.log
PLIST="$HOME/Library/LaunchAgents/com.yourname.agent.plist"

spent=$(grep "$(date +%Y-%m-%d)" "$LOG" \
  | grep -oE 'spent=[0-9.]+' \
  | cut -d= -f2 \
  | awk '{s+=$1} END{print (s>0)?s:0}')

if awk "BEGIN{exit !($spent >= $DAILY_CEILING)}"; then
  launchctl unload "$PLIST" 2>/dev/null || true
  echo "$(date -u +%FT%TZ) agent paused spent=${spent} ceiling=${DAILY_CEILING}" \
    >> /Users/agent/logs/watchdog.log
fi

Schedule the watchdog with its own plist, using StartCalendarInterval once a day or a short StartInterval for finer control. Load both with launchctl load <plist>. For a notification when the watchdog fires, wrap the final echo with the macOS Shortcuts command line tool: shortcuts run "Alert Agent Paused", where the Shortcut sends you a Message or Mail.

How do I resume after the watchdog trips?

Find out which stop condition fired, fix the cause, then reload the agent:

  1. Read watchdog.log and agent-err.log to see which stop condition fired.
  2. Reconcile the number against the provider's own usage dashboard, because client-side estimates can drift from billed cost.
  3. Adjust PER_JOB_LIMIT_USD, max calls or StartInterval in the worksheet, not through ad hoc edits to the script.
  4. Reload with launchctl load ~/Library/LaunchAgents/com.yourname.agent.plist.

The Intel Mac VM hosts this setup. Move to an Apple silicon plan when you need arm64 execution or more memory. Compare the Mac hosting plans.

Related reading

Which Figment Mac fits this work?

Intel Mac VM from $25 a month, Apple Silicon Mac VM from $39, or a Dedicated M4 Pro for $199. Hourly and daily plans too. You pay before use, starting with at least $25 of account credit.

Choose a Mac plan