feat: add usage columns to steps table (#9270)

* feat: add usage columns to steps table

Adds denormalized usage fields to the steps table for easier querying:
- model_handle: The model handle (e.g., "openai/gpt-4o-mini")
- cached_input_tokens: Tokens served from cache
- cache_write_tokens: Tokens written to cache (Anthropic)
- reasoning_tokens: Reasoning/thinking tokens

These fields mirror LettaUsageStatistics and are extracted from the
existing prompt_tokens_details and completion_tokens_details JSON columns.

🤖 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta <noreply@letta.com>

* chore: regenerate OpenAPI specs and SDK for usage columns

🤖 Generated with [Letta Code](https://letta.com)

Co-authored-by: Sarah Wooders <sarahwooders@users.noreply.github.com>

---------

Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com>
Co-authored-by: Sarah Wooders <sarahwooders@users.noreply.github.com>
This commit is contained in:
Sarah Wooders
2026-02-04 12:24:52 -08:00
committed by Caren Thomas
parent f957beaa37
commit e0a23f7039
7 changed files with 145 additions and 0 deletions

View File

@@ -42460,6 +42460,18 @@
"title": "Model",
"description": "The name of the model used for this step."
},
"model_handle": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Model Handle",
"description": "The model handle (e.g., 'openai/gpt-4o-mini') used for this step."
},
"model_endpoint": {
"anyOf": [
{
@@ -42520,6 +42532,42 @@
"title": "Total Tokens",
"description": "The total number of tokens processed by the agent during this step."
},
"cached_input_tokens": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Cached Input Tokens",
"description": "The number of input tokens served from cache. None if not reported by provider."
},
"cache_write_tokens": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Cache Write Tokens",
"description": "The number of input tokens written to cache (Anthropic only). None if not reported by provider."
},
"reasoning_tokens": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Reasoning Tokens",
"description": "The number of reasoning/thinking tokens generated. None if not reported by provider."
},
"completion_tokens_details": {
"anyOf": [
{