API reference · Account
The month's spend forecast for the account and each key
GET/api/account/spend-forecastSigned in session
The signed in account's spend this UTC month and where the recent trend takes it, the month to date plus the mean of the last 7 full UTC days times what is left of the month, against its monthly cap, and the same for each of its live personal keys against the key's monthly budget. The figures are the usage rows the ceilings themselves count. Under 3 full days there is no projection. Once a month per scope, before the cap is reached, a forecast that passes it sends the webhook event spend.forecast_over_cap and an email where one is set up.
Answer 200
The forecasts.
| Field | Type | What it is |
|---|---|---|
| month | string | The UTC month, YYYY-MM. |
| account | object | |
| account. | string | One of "account", "key". |
| account. | integer | The account's user id, or the key's id. |
| account. | string | The key's name. |
| account. | object | ok false, with only monthToDateMicros and windowDays, under 3 full days of data: no figure is projected from fewer. |
| account. | boolean | |
| account. | integer | Spent this UTC month so far. |
| account. | integer | The mean of the last full UTC days, up to 7. |
| account. | integer | How many full days the mean rests on. |
| account. | number | What is left of the month, today included. |
| account. | integer | The month to date plus the mean times the days left. |
| account. | object or null | The forecast against the account's monthly cap or the key's monthly budget. |
| account. | integer | |
| account. | boolean | The projection passes the cap. |
| account. | boolean | The month to date has reached it. |
| account. | integer or null | About when the trend reaches it, in this month, in unix milliseconds. |
| account. | integer or null | When this month's warning went, if it did. |
| keys | array of object | |
| keys[] | string | One of "account", "key". |
| keys[] | integer | The account's user id, or the key's id. |
| keys[] | string | The key's name. |
| keys[] | object | ok false, with only monthToDateMicros and windowDays, under 3 full days of data: no figure is projected from fewer. |
| keys[] | boolean | |
| keys[] | integer | Spent this UTC month so far. |
| keys[] | integer | The mean of the last full UTC days, up to 7. |
| keys[] | integer | How many full days the mean rests on. |
| keys[] | number | What is left of the month, today included. |
| keys[] | integer | The month to date plus the mean times the days left. |
| keys[] | object or null | The forecast against the account's monthly cap or the key's monthly budget. |
| keys[] | integer | |
| keys[] | boolean | The projection passes the cap. |
| keys[] | boolean | The month to date has reached it. |
| keys[] | integer or null | About when the trend reaches it, in this month, in unix milliseconds. |
| keys[] | integer or null | When this month's warning went, if it did. |
| windowDays | integer | |
| minDays | integer |
Errors
- 401OpenAI shaped error.
- 429OpenAI shaped error.
Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.