---
title: "Log LLM token consumption"
method: POST
path: "/tokens"
---

# Log LLM token consumption

`POST /tokens`

## Request

- Base URL: `https://getsanction.com/api/v1`
- URL: `https://getsanction.com/api/v1/tokens`
- Auth: API key in header `x-api-key`

Record the token and cost of an LLM inference call. Used for budget tracking and audit. Call this after every Claude, GPT, Gemini, or other LLM API call. Returns 402 if the daily token budget is exceeded.

## Request body

- LogTokensRequest
  - `model` string, required: LLM model identifier (e.g. claude-sonnet-4-6, gpt-4o)
  - `tokens_in` integer, required: Input/prompt tokens consumed
  - `tokens_out` integer, required: Output/completion tokens generated
  - `cost_usd` number, required: Actual dollar cost of this inference call
  - `task` string: Optional label for the task this call served

## Response `200`

Token usage recorded

## Other responses

- `401`: Invalid API key
- `402`: Daily token budget exceeded

---

[API](https://skmtc.dev/getsanction/apis/sanction-agent-governance-api.md) · [All operations](https://skmtc.dev/getsanction/apis/sanction-agent-governance-api/llms.txt) · [OpenAPI document](https://skmtc.dev/getsanction/apis/sanction-agent-governance-api/revisions/c645a9e4b72d?raw)
