> For the complete documentation index, see [llms.txt](https://docs.opscanvas.io/oscar/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.opscanvas.io/oscar/commands/cost-management.md).

# Cost Management

Oscar provides cost tracking and analysis for your cloud infrastructure. Configure cost data sources, monitor warehouse status, and get AI-powered spending insights.

## Setup Cost Tracking

Configure cost data sources with `/cost setup`:

```bash
/cost setup
```

Supports:

* **AWS** - Cost and Usage Reports (CUR)
* **Azure** - Cost Management exports

The setup wizard guides you through selecting your cloud provider, configuring export locations, setting up access credentials, and validating the configuration.

**AWS setup:**

![AWS cost setup](https://545396582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYOS1iTqmWKUIHFRd1Kze%2Fuploads%2Fgit-blob-2e683986fa9fe2a1fea798ea1605f4f7de58bb5a%2Fcost_setup_aws.png?alt=media)

**Azure setup:**

![Azure cost setup](https://545396582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYOS1iTqmWKUIHFRd1Kze%2Fuploads%2Fgit-blob-101e2e4299b971c44b09a801b025bbd39669d69e%2Fcost_setup_azure.png?alt=media)

## Check Warehouse Status

View your cost data warehouse status with `/cost status`:

```bash
/cost status
```

![Cost warehouse status](https://545396582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYOS1iTqmWKUIHFRd1Kze%2Fuploads%2Fgit-blob-f3afd64b9224af88c0e03c5df9fa26062b9d27fe%2Fcost_status.png?alt=media)

Shows:

* Configured cost sources
* Last sync time
* Data freshness
* Available date ranges
* Any sync errors or warnings

## Get Cost Summary

Analyze spending patterns with `/cost summary`:

```bash
/cost summary
```

Oscar analyzes your cost data and provides month-over-month spending trends, top cost drivers by service, unusual spending patterns, and cost optimization opportunities.

**Cost breakdown by service:**

See your spending organized by cloud service with month-over-month comparisons and percentage changes.

![Cost summary table](https://545396582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYOS1iTqmWKUIHFRd1Kze%2Fuploads%2Fgit-blob-bb14599596f424c944b05103412dc44a2a3b3793%2Fcost_summary_table.png?alt=media)

**Flagged findings:**

Oscar identifies unusual spending patterns, cost spikes, and potential issues that need attention.

![Cost flagged findings](https://545396582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYOS1iTqmWKUIHFRd1Kze%2Fuploads%2Fgit-blob-025ba8f9ca153bec5901464741d0b512a9fc8455%2Fcost_flagged_findings.png?alt=media)

**Next steps:**

Get actionable recommendations for cost optimization and investigation priorities.

![Cost next steps](https://545396582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYOS1iTqmWKUIHFRd1Kze%2Fuploads%2Fgit-blob-7410b19713f8870daa4b4a220d0902eb503aca2f%2Fcost_next_steps.png?alt=media)

The summary is AI-generated based on your actual cost data, providing context-aware insights specific to your infrastructure.

## Cost Data Warehouse

Oscar uses DuckDB to create a local cost data warehouse. Cost data is:

* Synced from your cloud provider's cost exports
* Stored locally in `~/.config/oscar/cost/`
* Queried for analysis and reporting
* Never sent to external services (runs entirely locally)

## Notes

* Cost data requires initial setup via `/cost setup`
* First sync may take several minutes depending on data volume
* Data is refreshed automatically when you run `/cost status` or `/cost summary`
* Historical data availability depends on your cloud provider's export retention
* All cost analysis runs locally using DuckDB
