Tasks

Estimate a task's credit cost

Changed on

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
  • Auth
    API key in header Authorization

Query parameters

task_id, string

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

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

How the task fires.

cron_expression, string

Five-field cron schedule, for trigger_type: cron.

timezone, string

IANA time zone the cron expression is read in.

interval_seconds, integer

Seconds between runs, for trigger_type: interval.

runs_per_day, number

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

model_id, string

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

TaskCostEstimate required
object, string required
runs_per_day, number nullable required
credits_per_run, number required
basis, 'task_history' | 'account_history' | 'typical' required
sample_runs, number required
credits_per_day, number nullable required
credits_per_month, number nullable required
balance, number required
burn_rate_per_day, number required
refills_at, string nullable required
runs_out_at, string nullable required
runs_out_before_refill, boolean required
auto_top_up, boolean required

Changes

    • warning

      added the new idempotency_error enum value to the error/type response property for the response status

    • warning

      added the new idempotency_error enum value to the error/type response property for the response status

    • warning

      added the new idempotency_error enum value to the error/type response property for the response status

    3 more changes in this revision