Tasks

Estimate a task's credit cost

Estimate what a scheduled task costs before you create or change it, and whether the credit balance still lasts until the next refill with it running. Pass task_id to price an existing task (any schedule field you also pass overrides the task's), or describe a new one with trigger_type and its schedule. credits_per_run is the median of the task's own recent completed runs, else of the account's tasks on the same model, else a typical agent run (basis says which). Runs per day come from the cron expression or interval; for an event trigger pass runs_per_day, or task_id to use the task's observed rate. burn_rate_per_day, runs_out_at and runs_out_before_refill describe the account with the task running at that rate (an active task_id replaces its own recent spend rather than adding to it). A condition script that skips runs makes the real cost lower.

get/tasks/cost_estimate

Request

  • Base URL: https://api.crevio.co/v1
  • URL: https://api.crevio.co/v1/tasks/cost_estimate
  • Auth: API key in header Authorization

Query parameters

task_idstring

An existing task to price (task_...).

trigger_type'cron' | 'interval' | 'once' | 'immediate' | 'event'

How the task fires.

cron_expressionstring

Five-field cron schedule, for trigger_type: cron.

timezonestring

IANA time zone the cron expression is read in.

interval_secondsinteger

Seconds between runs, for trigger_type: interval.

runs_per_daynumber

Expected runs per day; overrides the schedule. Use it for event triggers.

model_idstring

Model tier (fast, balanced, quality) or model id the task runs on.

kind'agent' | 'script'

agent (a model turn per run, the default) or script (no model).

Response

Cost estimate

objectstring required
runs_per_daynumber nullable required
credits_per_runnumber required
basis'task_history' | 'account_history' | 'typical' required
sample_runsnumber required
credits_per_daynumber nullable required
credits_per_monthnumber nullable required
balancenumber required
burn_rate_per_daynumber required
refills_atstring nullable required
runs_out_atstring nullable required
runs_out_before_refillboolean required
auto_top_upboolean required

Changes

No recorded changes to this operation across all 2 revisions of this API.