Skip to documentation

Platform

Cost & schedules

Two operational surfaces: a cost dashboard that accounts every token spent, and scheduled agentsthat run on a cron with zero external orchestration — the durable "individual running" story, entirely self-hosted.

The cost dashboard

/w/<workspace>/cost aggregates llm_calls over a window (default 30 days). Because every model call — chat, extraction, judge, embeddings, retries, agent steps — funnels through accounting middleware, nothing escapes the total. Money is a Postgres numeric(12,6), always returned as a 6-decimal string.

  • Totals — cost, tokens in/out, cache read/write split, call count, and how many rows are estimated vs. finalized vs. errored.
  • By slot — spend broken down by chat / agent / extraction / judge / embeddings.
  • By model — per-model cost, tokens, and call count.
  • By day — a daily time series (UTC).
  • By agent and recent runs — spend attributed to each agent.
  • Spend counters — the per-workspace monthly counters that back all-trigger admission.

Beyond per-run budgets: workspace admission

Before a UI, API, or scheduled start, the month's workspace spend is checked against the monthly spend cap; over it, the start is denied or skipped and one deduplicated budget.cap alert is raised for the month. Queued and running work also consumes the workspace active-run cap. There is no general per-key request throttle (see Errors & rate limits), so per-run budgets plus workspace admission are the spend wall.

Endpoints: GET /api/w/:workspaceId/cost, …/cost/by-agent, …/cost/recent.

Scheduled agents

A schedule fires an agent run with a preset input on a cron, via pg-boss in the worker. Manage them at /w/<workspace>/schedules.

  1. Pick an agent and input

    Choose an existing agent and the input string each run should receive (e.g. "Summarize this week's new interviews and flag open questions").
  2. Set a cron expression

    A standard 5-field cron: minute hour day-of-month month day-of-week, with *, ranges, lists, and /step. Invalid expressions are rejected with a 400.
  3. Save

    The desired schedule is committed to scheduled_jobs and reconciled to pg-boss with a stable key; audit rows remain history. Scheduled runs execute in the worker and count against the same budgets and admission caps.
cron examplestext
0 9 * * 1      # every Monday at 09:00
*/30 * * * *   # every 30 minutes
0 6 1 * *      # 06:00 on the 1st of each month

Cloud-OK workspaces

Workspaces whose allowlist permits Anthropic may instead use Anthropic scheduled deployments (Tier 2). The self-hosted pg-boss cron is the default and needs no external service.

Endpoints

  • GET/POST /api/w/:workspaceId/schedules — list / create.
  • DELETE /api/w/:workspaceId/schedules/:agentSlug — unschedule.

See also Multi-provider AI for cost accounting internals and Creating agents for per-agent budgets.