---
title: "record AI token usage for the calling user"
method: POST
path: "/w/{workspace}/ai/usage"
tags: ["ai"]
---

# record AI token usage for the calling user

`POST /w/{workspace}/ai/usage`

## Path parameters

- `workspace` string, required

## Request body

- object
  - `events` AITokenUsageEvent[], required
    - `provider` 'openai' | 'azure_openai' | 'azure_foundry' | 'anthropic' | 'mistral' | 'deepseek' | 'googleai' | 'groq' | 'openrouter' | 'togetherai' | 'aws_bedrock' | 'customai', required
    - `model` string, required
    - `session_id` string
    - `input_tokens` integer
    - `cache_read_tokens` integer
    - `cache_write_tokens` integer
    - `output_tokens` integer
    - `reported_cost_nano_usd` integer — only set by providers that bill back an exact figure
    - `requests` integer

## Response `204`

usage recorded

## Changes

- **2026-08-24** `0f7dfcd9c1f0` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/windmill/apis/windmill-api/changes/w/:workspace/ai/usage/post.md)

---

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