---
title: "Get cost optimizations"
method: POST
path: "/api/burnrate/optimize"
tags: ["BurnRate"]
---

# Get cost optimizations

`POST /api/burnrate/optimize`

## Request

- Base URL: `https://plith.ai`
- URL: `https://plith.ai/api/burnrate/optimize`
- Auth: none required

Takes an agent plan and optional target budget, returns a cheaper equivalent plan via model substitution. Costs 1 credit.

## Request body

- object
  - `plan` object[], required: Non-empty array of plan steps.
    - `step` union, required
      - string
      - integer
    - `provider` string, required
    - `model` string, required
    - `estimated_input_tokens` integer, required
    - `estimated_output_tokens` integer, required
    - `cache_read_tokens` integer
  - `target_budget` number: Optional. Target budget in USD. Response includes whether the optimized plan fits within it.

## Response `200`

Optimized plan with model substitution recommendations

- object
  - `original` object
    - `total_cost_usd` number
    - `total_cost_usd_formatted` string
  - `optimized` object
    - `total_cost_usd` number
    - `total_cost_usd_formatted` string
    - `total_savings_usd` number
    - `total_savings_usd_formatted` string
    - `total_savings_pct` integer
  - `target_budget` object, nullable: Present only when target_budget was supplied.
    - `usd` number
    - `within_budget` boolean
    - `gap_usd` number
  - `steps` object[]
    - `step` unknown
    - `original` object
      - `provider` string
      - `model` string
      - `cost_usd` number
    - `recommendation` object, nullable
      - `provider` string
      - `model` string
      - `cost_usd` number
      - `savings_usd` number
      - `savings_pct` integer
      - `capability_retention` number
      - `note` string
    - `no_cheaper_alternative` boolean
  - `suggestions` string[]
  - `cross_product` object
  - `request_id` string
  - `credits_used` integer
  - `credits_remaining` integer
  - `fallback_behavior` string

## Other responses

- `400`: Missing or invalid plan or target_budget
- `401`: Invalid or missing API key
- `402`: Insufficient credits

---

[API](https://skmtc.dev/plith/apis/plith-api.md) · [All operations](https://skmtc.dev/plith/apis/plith-api/llms.txt) · [OpenAPI document](https://skmtc.dev/plith/apis/plith-api/revisions/4a03164b0d75?raw)
