Cost Model
What it does
Section titled “What it does”ixtract estimates the cost of each candidate plan before execution, then shows you the trade-off. You declare your rates; ixtract applies them to the planned workers, estimated duration, and estimated egress.
Cost is an estimate, not a guarantee. All rates default to zero. If you don’t declare rates, no cost is shown.
How cost is calculated
Section titled “How cost is calculated”cost = (workers × duration_estimate) × compute_rate + (estimated_output_gb) × egress_rate + (workers) × connection_ratecompute_rate: cost per worker-second (e.g., EC2 hourly ÷ 3600 ÷ vCPUs)egress_rate: cost per GB of output dataconnection_rate: cost per connection-second (for managed databases with per-connection pricing)
Duration estimate comes from the estimator (EWMA + context similarity blend). For first runs with no history, it uses the profiler’s latency estimate.
Cost comparison output
Section titled “Cost comparison output”ixtract generates candidate plans at different worker counts, filters dominated candidates, and shows the comparison:
Cost Comparison (estimated, rates user-declared)──────────────────────────────────────────────── workers duration cost 2 ~12s $0.13 ← planned 3 ~12s $0.13 4 ~13s $0.15 8 ~14s $0.21The planned option is the one ixtract selected. You can override with --max-workers if you prefer a different trade-off.
A candidate is “dominated” if another candidate is cheaper and faster. Dominated candidates are filtered from the comparison table.
Declaring rates
Section titled “Declaring rates”ixtract plan orders \ --compute-rate 0.05 \ --egress-rate 0.01 \ --connection-rate 0.001Or from a file:
ixtract plan orders --cost-file rates.jsonrates.json:
{ "compute_rate": 0.05, "egress_rate": 0.01, "connection_rate": 0.001}Python API
Section titled “Python API”from ixtract import CostConfig, plan
cost = CostConfig( compute_rate=0.05, egress_rate=0.01, connection_rate=0.001,)
result = plan(intent, cost_config=cost)
if result.cost_estimate: print(f"Estimated cost: ${result.cost_estimate.total:.2f}")CostConfig validates that all rates are non-negative and no unknown fields are present.
How to determine your rates
Section titled “How to determine your rates”Compute rate
Section titled “Compute rate”For a cloud VM running the extraction:
compute_rate = hourly_vm_cost / 3600 / vcpu_countExample: $0.192/hr VM, 4 vCPUs → compute_rate = 0.192 / 3600 / 4 = 0.0000133
For a managed service with per-hour billing, divide by the total seconds per hour.
Egress rate
Section titled “Egress rate”Cloud providers typically charge $0.08–$0.12 per GB for data leaving a region. Check your provider’s pricing page.
Example: AWS us-east-1 → egress_rate = 0.09
Connection rate
Section titled “Connection rate”For managed databases with per-connection pricing (e.g., RDS Proxy, Azure SQL serverless), declare the per-second cost of holding a connection open.
Most setups: connection_rate = 0.
Design principles
Section titled “Design principles”- No defaults are ever applied. If you don’t declare a rate, that component of cost is zero.
- Cost does not affect the plan. The planner optimizes for throughput; cost is displayed alongside the plan, not used to select it.
- Rates are user-declared, not system-measured. ixtract does not call any pricing API.
- Comparison uses the same estimator as the plan. Candidates are evaluated with identical assumptions.