The /v2/usage response now contains more usage types than Usage exposes.
Only character_*, document_* and team_document_* are parsed; everything else is silently dropped.
Note: this payload is only returned on Pro accounts — a Free key returns the short form, which is why the extra fields went unnoticed.
Actual response (Pro):
{
"character_count": 5947223,
"character_limit": 1000000000000,
"products": [
{
"product_type": "write",
"billing_unit": "characters",
"api_key_unit_count": 0,
"account_unit_count": 5643,
"api_key_character_count": 0,
"character_count": 5643
},
{
"product_type": "translate",
"billing_unit": "characters",
"api_key_unit_count": 636,
"account_unit_count": 5941580,
"api_key_character_count": 636,
"character_count": 5941580
},
{
"product_type": "speechToText",
"billing_unit": "minutes",
"api_key_unit_count": 30,
"account_unit_count": 30,
"api_key_character_count": 0,
"character_count": 0
},
{
"product_type": "speechToSpeech",
"billing_unit": "minutes",
"api_key_unit_count": 12,
"account_unit_count": 12,
"api_key_character_count": 0,
"character_count": 0
}
],
"api_key_character_count": 636,
"api_key_character_limit": 1000000000000,
"speech_to_text_milliseconds_count": 0,
"speech_to_text_milliseconds_limit": 0,
"speech_to_text_minutes_count": 30,
"speech_to_text_minutes_limit": 600,
"speech_to_speech_minutes_count": 12,
"speech_to_speech_minutes_limit": 600,
"start_time": "2025-05-13T09:18:42Z",
"end_time": "2025-06-13T09:18:42Z"
}
Missing:
api_key_character_* (per-key quota)
speech_to_text_milliseconds_*, speech_to_text_minutes_*
speech_to_speech_minutes_*
products[] (per-product breakdown, incl. billing_unit)
start_time / end_time (billing period)
Consequences: no way to check the API-key quota or the speech quotas, and anyLimitReached() returns false while one of them is exhausted.
Proposal: add the matching UsageDetail fields (buildUsageDetail() already handles any <prefix>_count / <prefix>_limit pair),
include them in anyLimitReached() and __toString(), and expose products, startTime, endTime.
All new fields nullable → no BC break, Free accounts keep null.
The
/v2/usageresponse now contains more usage types thanUsageexposes.Only
character_*,document_*andteam_document_*are parsed; everything else is silently dropped.Note: this payload is only returned on Pro accounts — a Free key returns the short form, which is why the extra fields went unnoticed.
Actual response (Pro):
{ "character_count": 5947223, "character_limit": 1000000000000, "products": [ { "product_type": "write", "billing_unit": "characters", "api_key_unit_count": 0, "account_unit_count": 5643, "api_key_character_count": 0, "character_count": 5643 }, { "product_type": "translate", "billing_unit": "characters", "api_key_unit_count": 636, "account_unit_count": 5941580, "api_key_character_count": 636, "character_count": 5941580 }, { "product_type": "speechToText", "billing_unit": "minutes", "api_key_unit_count": 30, "account_unit_count": 30, "api_key_character_count": 0, "character_count": 0 }, { "product_type": "speechToSpeech", "billing_unit": "minutes", "api_key_unit_count": 12, "account_unit_count": 12, "api_key_character_count": 0, "character_count": 0 } ], "api_key_character_count": 636, "api_key_character_limit": 1000000000000, "speech_to_text_milliseconds_count": 0, "speech_to_text_milliseconds_limit": 0, "speech_to_text_minutes_count": 30, "speech_to_text_minutes_limit": 600, "speech_to_speech_minutes_count": 12, "speech_to_speech_minutes_limit": 600, "start_time": "2025-05-13T09:18:42Z", "end_time": "2025-06-13T09:18:42Z" }Missing:
api_key_character_*(per-key quota)speech_to_text_milliseconds_*,speech_to_text_minutes_*speech_to_speech_minutes_*products[](per-product breakdown, incl.billing_unit)start_time/end_time(billing period)Consequences: no way to check the API-key quota or the speech quotas, and
anyLimitReached()returnsfalsewhile one of them is exhausted.Proposal: add the matching
UsageDetailfields (buildUsageDetail()already handles any<prefix>_count/<prefix>_limitpair),include them in
anyLimitReached()and__toString(), and exposeproducts,startTime,endTime.All new fields nullable → no BC break, Free accounts keep
null.