record_usage
Record a single LLM API call with token counts and automatically compute cost. Use request_id to prevent duplicate entries.
Instructions
Record a single LLM API call with token counts.
Cost is computed automatically from the pricing table at insert time.
request_id enables idempotent recording — replaying a log file
won't double-count.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tags | No | ||
| model | Yes | ||
| project | No | ||
| success | No | ||
| metadata | No | ||
| provider | Yes | ||
| error_type | No | ||
| request_id | No | ||
| duration_ms | No | ||
| input_tokens | Yes | ||
| output_tokens | Yes | ||
| cache_read_tokens | No | ||
| cache_write_tokens | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| warning | Yes | ||
| cost_usd | Yes |