account

API usage and cost report

Characters and cost over a window of days, broken down by API key, endpoint, day and month. The body is optional.

post/api/v1/reporting/api_usage

Request

  • Base URL: https://api.sapling.ai
  • URL: https://api.sapling.ai/api/v1/reporting/api_usage
  • Auth: one of:
    • HTTP bearer
    • none

Request body

end_days_backinteger

Window end, in days before today.

keystring

Sapling API key. Required when no "Authorization: Bearer <key>" header is sent; when both are sent, the body key takes precedence over the header.

return_usageboolean

When true, a successful JSON-object response additionally carries "usage": {"characters": <n>} — the billable character count this request submitted (0 for unbilled requests; the 2.5x adjustment for logographic languages is included, so CJK requests report more than their raw length). Repeat texts inside the billing deduplication window are still counted here even though they are not re-charged, so the number is an upper bound on the final charge. Responses whose body is not a JSON object (e.g. bare-array response formats) cannot carry the field. An existing usage field (such as account/status or completion token usage) is preserved unchanged.

start_days_backinteger

Window start, in days before today. Defaults to the first of this month.

Response

Usage report.

by_api_keyobject
by_endpointobject
currencystring
daily_usageunknown
end_datestring
last_updatedunknown
monthly_usageunknown
start_datestring
total_charactersinteger
total_cost_usdnumber

Changes

No recorded changes to this operation across all 1 revision of this API.