Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

1.8 KB
Raw Blame
"""Billing-facing exports for the tasks product.

The usage reporter (posthog/tasks/usage_report.py) lives in the ``posthog`` module,
which may only import ``products.tasks`` through the facade (see tach.toml).
"""

from products.tasks.backend.facade.contracts import TaskRunCost, TaskRunTokenUsage
from products.tasks.backend.logic.services.gateway_usage import (
    get_task_cost,
    get_task_run_cost,
    get_task_run_token_cost_microusd,
    get_task_run_token_usage,
    get_task_runs_spend,
    locked_task_run_spend,
    process_pending_gateway_usage,
)
from products.tasks.backend.logic.services.sandbox_pricing import ComputeRateCardConfigurationError
from products.tasks.backend.logic.services.sandbox_usage import (
    SandboxComputeUsageByTeam,
    SandboxUsageByTeam,
    get_billable_sandbox_compute_usage_by_team,
    get_task_sandbox_usage_by_team,
)
from products.tasks.backend.logic.services.task_usage import (
    TASK_USAGE_SIGNATURE_HEADER,
    TASK_USAGE_TIMESTAMP_HEADER,
    TaskTokenUsageUnavailable,
    TaskUsage,
    get_local_task_run_token_costs,
    get_local_task_token_cost,
    get_task_usage,
)

__all__ = [
    "ComputeRateCardConfigurationError",
    "TaskRunCost",
    "TaskRunTokenUsage",
    "SandboxComputeUsageByTeam",
    "SandboxUsageByTeam",
    "TaskUsage",
    "TaskTokenUsageUnavailable",
    "TASK_USAGE_SIGNATURE_HEADER",
    "TASK_USAGE_TIMESTAMP_HEADER",
    "get_billable_sandbox_compute_usage_by_team",
    "get_local_task_run_token_costs",
    "get_local_task_token_cost",
    "get_task_sandbox_usage_by_team",
    "get_task_usage",
    "get_task_run_cost",
    "get_task_cost",
    "get_task_run_token_cost_microusd",
    "get_task_run_token_usage",
    "get_task_runs_spend",
    "locked_task_run_spend",
    "process_pending_gateway_usage",
]