API and Terraform

Manage cloud cost reporting as code

The Public API and the Terraform provider work with the same objects as the product. The Terraform modules that grant read-only access and the Kubernetes agent are open source.

Permanent Free plan with no time limit

Public API

Read costs and manage reporting from your own tools

The Public API queries cost data and manages workspaces, cost reports, folders, dashboards, segments, budgets, allocation rules and virtual tags. Requests authenticate with API tokens scoped to the capabilities a script needs.

API tokens are part of every plan, Free included. The Terraform provider uses one, so it comes with the API.

API reference Authentication and tokens The MCP server in the documentation The command line in the documentation The SDKs in the documentation

  1. Token

    An API token, part of every plan, scoped to the capabilities a script needs

  2. Serves
    • Public API

      Cost data queries and the managed objects

    • Terraform provider

      A cost structure reviewed like any other change, through the Public API

    • MCP server

      An AI assistant reads costs and anomalies, and changes reports and budgets where an owner allows it

  3. Objects

    The same objects as the product: workspaces, cost reports, folders, dashboards, segments, budgets, allocation rules and virtual tags

One scoped API token serves the Public API, the Terraform provider and the MCP server, which work with the same objects as the product

Terraform provider

Keep segments, budgets and reports in version control

The costfluent/costfluent Terraform provider manages workspaces, cloud connections, segments, allocation rules, budgets, cost reports, folders, dashboards, saved filters and virtual tags through the Public API, so a cost structure is reviewed like any other change.

Provider in the Terraform Registry Terraform guide

From the provider's examples: a workspace, and a saved report of this month's cost by service and team
resource "costfluent_workspace" "production" {
  name     = "Production"
  currency = "USD"
}

resource "costfluent_cost_report" "monthly_by_service" {
  workspace_id = costfluent_workspace.production.id
  title        = "Monthly cost by service"

  date_interval = "ThisMonth"
  date_bin      = "Day"
  chart_type    = "StackedBar"

  # Service, then the team tag within each service. `group_by = []` saves a single total.
  group_by = [
    { dimension = "ServiceName" },
    { dimension = "Tag", key = "team" },
  ]

  settings = {
    amortize               = true
    include_credits        = false
    include_refunds        = true
    include_tax            = true
    show_forecast          = false
    compare_to_last_period = true
  }
}

Open source

Read the code that touches your accounts

Everything that runs in or grants access to your cloud is published with its licence.

Read-only cloud access

  • AWS cost-access module

    Grants Costfluent read-only access to an AWS account's cost data. MIT licence.

    costfluent/terraform-aws-cost-access

  • Azure cost-access module

    Grants read-only access to one Azure subscription's cost data. MIT licence.

    costfluent/terraform-azure-cost-access

  • Google Cloud cost-access module

    Grants read-only access to one Google Cloud billing export. MIT licence.

    costfluent/terraform-gcp-cost-access

Kubernetes

  • Kubernetes agent

    Reports node, pod and container usage from a cluster. Apache 2.0 licence.

    costfluent/k8s-agent

  • Helm chart

    Installs the Kubernetes agent. Apache 2.0 licence.

    costfluent/helm-charts

SDKs and Terraform

  • Go SDK

    Typed methods for the Public API with paging, safe retries and exact decimal money, built on the standard library alone. Apache 2.0 licence.

    costfluent/costfluent-go

  • Python SDK

    Every Public API operation with typed models, sync and async, plus paging, safe retries and exact decimal money. Apache 2.0 licence.

    costfluent/costfluent-python

  • TypeScript SDK

    Every Public API operation typed from its OpenAPI document, for any runtime with fetch, plus paging, safe retries and exact decimal money. Apache 2.0 licence.

    costfluent/costfluent-typescript

  • Terraform provider

    The provider described above. Apache 2.0 licence.

    costfluent/terraform-provider-costfluent

Agents and automation

  • MCP server and command line

    Lets an AI assistant, or a script or CI job through the costfluent command, read costs, reports, budgets and anomalies with a scoped API token, and, where an owner allows it, create and change reports, budgets, alerts and dashboards, and search the Costfluent documentation for how to set Costfluent up; the costfluent command can sign in through the browser instead. Apache 2.0 licence.

    costfluent/costfluent-mcp

  • Agent skills

    Task skills and plugin manifests that teach a coding agent the common cost workflows, from where spend moved to budgets, savings, commitments and Kubernetes efficiency, through the read tools of the MCP server. Apache 2.0 licence.

    costfluent/agent-skills

  • Cost estimate GitHub Action

    Posts the Infracost estimate of each Terraform pull request to Costfluent and records the resources the apply created, so the estimate can be compared with the cost that followed. A shell script over curl and jq. Apache 2.0 licence.

    costfluent/cost-estimate-action

  • n8n nodes

    Starts an n8n workflow on a savings, connection, spend band, subscription or anomaly change, and reads costs, reports, budgets, alerts and anomalies. MIT licence.

    costfluent/n8n-nodes-costfluent

Modules in the Terraform Registry

Related pages

From the handbook

Start with the product, automate when you are ready

Create a Free workspace, connect a cloud read-only, and create an API token for the API and Terraform.

Permanent Free plan with no time limit

We value your privacy

We use essential storage to operate the site and, only if you allow it, Google Analytics to understand how it is used. Read more in our Privacy policy.

Cookie preferences

Essential cookies Always on

Required for the website to function properly. These cannot be disabled.

Google Analytics

Records page views and four named actions: sign-up and demo clicks, contact form submissions and lead requests. Google's script and its _ga cookies load only after you allow them. We do not send account, tenant, form, or resource identifiers.