Compare/C3X vs Infracost

C3X vs Infracost

The original Terraform cost estimation tool; SaaS-first with paid recommendations and CloudFormation gating.

Quick verdict

Choose C3X if you want open-source, self-hostable, fully offline cost estimation without API keys or SaaS lock-in. Choose Infracost if you need enterprise support, OPA/Rego policy integration, or your team is already deep on the Infracost Cloud product.

Feature comparison

FeatureC3XInfracost
LicenseApache 2.0Apache 2.0 (CLI), proprietary (Cloud)
Public pricing APIFree, no API keyFree, requires API key
Self-hosted pricing APIYes (single Docker)Yes (cloud-pricing-api)
Terraform supportYesYes
CloudFormation supportYes (free)Yes (paid tier)
Terragrunt supportYesYes
Fully offline modeYesPartial (requires sync)
Cost recommendationsYes (free)Yes (paid Cloud tier)
CI integrationGitHub Actions, GitLab, BitbucketSame
Atlantis/SpaceliftYesYes
OPA/Rego policyRoadmapYes (mature)
Enterprise supportCommunity + commercial partnersYes (Infracost Cloud)
Annual cost (medium team)$0$1,000+/month (Cloud)

Where Infracost wins

Infracost has been in the market since 2019 and has built up a substantial ecosystem. Areas where it's still the right pick:

Where C3X wins

C3X was built differently from the start, optimizing for the most-asked-for things in the original Infracost open-source issues:

Migration: command translation

For most workflows, migration is mechanical. The CLI command structure is similar:

InfracostC3X
infracost breakdown --path .c3x estimate --path .
infracost diff --path .c3x estimate --diff
infracost configure get api_key(no key required)
infracost generate configc3x init
infracost run --config-file=infracost.ymlc3x estimate --config c3x.yml

Migration: GitHub Actions

The Infracost GitHub Action and C3X GitHub Action have similar structures. Replacing the action is typically 5-10 lines of YAML:

# Before (Infracost):
- uses: infracost/actions/setup@v3
  with:
    api-key: ${{ secrets.INFRACOST_API_KEY }}
- run: infracost breakdown --path . --format json --out-file infracost.json
- uses: infracost/actions/comment@v3
  with:
    path: infracost.json

# After (C3X):
- uses: c3xdev/c3x-action@v1
- run: c3x estimate --diff --format=github-comment > c3x.md
- uses: actions/github-script@v7
  with:
    script: |
      const fs = require('fs')
      github.rest.issues.createComment({
        issue_number: context.issue.number,
        owner: context.repo.owner,
        repo: context.repo.repo,
        body: fs.readFileSync('c3x.md', 'utf8')
      })

Pricing data source

Both tools pull from the same upstream sources but expose different public APIs:

C3X's pricing API (pricing.c3x.dev) is free to query without authentication. Infracost's cloud-pricing-api is also self-hostable but the SaaS endpoint requires an API key. For details on running the pricing API yourself, see self-hosting the pricing API on a €4 VPS.

When to keep Infracost

  1. You've already paid for Infracost Cloud and use OPA/Rego policies that don't have C3X equivalents.
  2. Your enterprise contract requires named-engineer SLAs with the tool vendor.
  3. You use Infracost-specific integrations (Atlantis with Infracost policy callbacks, etc.) that haven't been ported.

When to switch to C3X

  1. You're hitting Infracost's paid feature gates (CloudFormation, recommendations).
  2. You need fully offline mode for regulated environments.
  3. Your organization prefers open-source-only infrastructure.
  4. You want to avoid SaaS lock-in for cost-related tooling.
  5. Budget is a concern and the free tier doesn't cover your usage.

FAQ

Is C3X really a drop-in replacement for Infracost?

For the most common workflows (Terraform breakdown, diff in PRs, CI integration), yes. The command structure is similar: c3x estimate replaces infracost breakdown, c3x estimate --diff replaces infracost diff. CloudFormation is supported in C3X without paid tier. Some advanced Infracost features (Cloud-managed pricing, advanced policy via OPA/Rego) don't have direct C3X equivalents yet.

What does Infracost do better than C3X?

Infracost has a longer track record (since 2019), a larger community, more mature OPA/Rego policy integration via their Cloud product, and dedicated enterprise support contracts. If you need any of those, Infracost is the right pick.

Why is C3X free when Infracost is paid?

C3X is fully open-source (Apache 2.0) with a self-hostable pricing API. The maintainers fund development via partnerships and consulting, not SaaS subscriptions. Infracost's commercial model funds full-time staff, dedicated enterprise support, and the Cloud product.

Can I migrate from Infracost to C3X gradually?

Yes. Both tools can run side-by-side in CI initially. Compare outputs for accuracy, then switch the gating job from Infracost to C3X once confident. Most teams complete the migration in one sprint.

Does C3X support Infracost's usage file format?

C3X uses c3x-usage.yml with a similar structure to Infracost's usage file. Conversion is mechanical — most usage files are equivalent semantically. Detailed mapping is in the docs.

Related reading

Try C3X for your stack

Install in 30 seconds. No API key, no SaaS account, no credit card.