Tasks

Get task cost and usage

Returns the settlement status, final user cost, estimated cost, and token usage for a recent task. Public API keys can retrieve only tasks originally created by that same API key, even when another key belongs to the same organization. This lookup remains available after the key reaches its spending limit, but expired, revoked, or scoped keys are still rejected. When settled is false, cost is not final and must not be used for billing or reconciliation. Use estimated_cost only as a display estimate until final settlement completes. Older task execution records may be archived after the retention window and then return 404. Use billing records or billing exports for long-term reconciliation.

get/v1/tasks/{task_id}/cost

Request

  • Base URL: https://api.sandbase.ai
  • URL: https://api.sandbase.ai/v1/tasks/{task_id}/cost
  • Auth: HTTP bearer

Path parameters

task_idstring required

Opaque task ID returned by a billable operation, including an x-task-id response header when present.

Response

Task cost and usage

idstring required

SandBase task ID.

status'pending' | 'running' | 'completed' | 'failed' | 'timeout' required
settledboolean required

Whether final cost settlement has completed.

currency'USD' required
coststring required

USD amount with six decimal places. Not final while settled is false.

estimated_coststring required

Best-effort USD estimate with six decimal places. Informational while settled is false; matches cost once settled is true.

Example response

{
  "cost": "0.001234",
  "estimated_cost": "0.001234"
}

Changes

No recorded changes to this operation across all 1 revision of this API.