---
title: "Finalize Indexing"
method: POST
path: "/billing/internal/finalize-indexing"
tags: ["billing"]
---

# Finalize Indexing

`POST /billing/internal/finalize-indexing`

Called by Modal after successful doc generation to finalize credit debit.

Pricing is single-sourced here: when the indexer reports real token
counts we recompute the authoritative cost from ``llm_pricing``
(model-aware, 2× markup) rather than trusting the indexer-side
number. We also write the reconciled cost back onto the snapshot so
the displayed ``llm_cost_cents`` matches what was actually billed.

## Headers

- `x-service-token` string, required

## Request body

- FinalizeIndexingRequest
  - `snapshot_id` string, required
  - `actual_cost_cents` integer, required
  - `estimated_cost_cents` integer, required
  - `dodo_customer_id` string, required
  - `user_id` string, required
  - `provider` string
  - `model` string
  - `actual_input_tokens` integer
  - `actual_output_tokens` integer

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/repowise/apis/repowise-hosted-api.md) · [All operations](https://skmtc.dev/repowise/apis/repowise-hosted-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/repowise/repowise-hosted-api/revisions/40167ba9ab58/schema)
