---
title: "Post Training Cost"
method: POST
path: "/api/billing/training-cost"
tags: ["billing"]
---

# Post Training Cost

`POST /api/billing/training-cost`

Record a training run's realized provider cost (COGS) for estimator accuracy.

Machine-to-machine: the flash control plane's reconciliation job calls this after a run
finishes, authenticated with the operator internal key (NOT a user key -- this is COGS, not
a customer charge). Upserts ``training_run_cost`` keyed by ``runId``; the org and the charged
estimate are joined in later (the ``training_cost_accuracy`` view), so no org id is needed
here. Idempotent: a re-pulled run (provider billing lags) records once.

## Request body

- TrainingCostBody
  - `runId` string, required
  - `realizedCostUsd` number, required
  - `provider` string, nullable
  - `gpu` string, nullable
  - `costByResource` object, nullable
  - `wallSeconds` number, nullable
  - `costBasis` string, nullable
  - `source` object, nullable

## Response `200`

Successful Response

- object

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/freesolo/apis/platform-backend.md) · [All operations](https://skmtc.dev/freesolo/apis/platform-backend/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/freesolo/platform-backend/revisions/5626e92675af/schema)
