Receipts and headers

Moth DocsProtocol

Every call says what it was and what it cost on the reply itself, and the account keeps a record of each call without its content.

Reply headers

HeaderWhat it says
moth-request-idThe call's id, req_ and 20 characters, on every reply including errors. The same id is in x-request-id and request-id, which the OpenAI and Anthropic SDKs read
moth-charged-microsWhat the call cost in millionths of a dollar, on a chat reply that succeeded and isn't streamed. A media job reports its cost as charged_usd once it ends
retry-afterSeconds to wait, on most 429, 503 and 529 errors
moth-shieldOn a call with Shield on, what was swapped for placeholders, in counts such as email=1, card=1, or none

Streams

A stream's headers are sent before its cost is known, so an OpenAI-format stream that ends normally reports the charge in its last usage chunk as charged_micros when you set stream_options.include_usage to true. A stream that ends in an error sends no usage chunk, and an Anthropic-format stream doesn't report the charge at all, so read those calls in activity.

json
{"object": "chat.completion.chunk", "choices": [], "usage": {"prompt_tokens": 290, "completion_tokens": 180, "total_tokens": 470}, "charged_micros": 447}

What is recorded

Each settled call is recorded by account, key, model, kind, request id, token counts or units, charge and time taken, and the prompt and the reply are not recorded anywhere. A call that ended in an error is recorded by account, key, model, kind, request id and status, with no error message and nothing of what was sent. Usage adds the settled records up by day and by model, and activity lists the latest 200 calls, failed ones included.

The Usage page in Moth Console with sample data, showing spend over the range as a chart, beside the cards for calls and tokens and for the saving against list
The same figures in Moth Console under Usage, shown with sample data.
The Logs page in Moth Console with sample data, showing the calls in the range in a sentence, a strip of calls over time, the search and filters, and the list of calls with model, source, status, size, time and cost
Each call in Moth Console under Logs, shown with sample data. There are no prompts or replies to show, since Moth keeps none.

How long it is kept

  • Each call's record is kept for 90 days, then folded into one total per day, account and model, without the key, and deleted.
  • A failed call's record is deleted after the same 90 days, and nothing of it is kept in any total.
  • Each account keeps its newest 1,000 failed-call records, and older ones are deleted within the hour once it has more.
  • Server logs hold ids, counts and statuses, never content, in one file per UTC day, deleted seven days after that day began.
  • A job's record is deleted 24 hours after the job ends, and its files can't be fetched after that.

Quote the request id. When you write to us about a call, send its moth-request-id within six days, while the logs still hold it.

On this page