Log LLM token consumption

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.

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

Request body

modelstring required

LLM model identifier (e.g. claude-sonnet-4-6, gpt-4o)

tokens_ininteger required

Input/prompt tokens consumed

tokens_outinteger required

Output/completion tokens generated

cost_usdnumber required

Actual dollar cost of this inference call

taskstring

Optional label for the task this call served

Response

Token usage recorded

Changes

No recorded changes to this operation across all 1 revision of this API.