Activity

Moth DocsReference

GEThttps://api.runmoth.si/v1/activity

Lists the account's latest 200 calls, newest first, with what each one cost and how it ended.

curl https://api.runmoth.si/v1/activity \
  -H "Authorization: Bearer $MOTH_API_KEY"
Response
{
  "data": [
    {
      "id": "req_9Hs2mVq4Yc8Nd3Ke7TbW",
      "created_at": "2026-10-30T09:14:05Z",
      "model": "unknown",
      "kind": "chat",
      "key_id": "key_0b6f3c1e-8d2a-4f7e-9a51-2c4d6e8f0a1b",
      "key_name": "Server",
      "input_tokens": 0,
      "output_tokens": 0,
      "charged_usd": "0.000000",
      "latency_ms": null,
      "status": 429
    },
    {
      "id": "req_4Gk9tQ2wXb7Lm1Pz8RcV",
      "created_at": "2026-10-30T09:14:02Z",
      "model": "gemini-3.8-flash",
      "kind": "chat",
      "key_id": "key_0b6f3c1e-8d2a-4f7e-9a51-2c4d6e8f0a1b",
      "key_name": "Server",
      "input_tokens": 290,
      "output_tokens": 180,
      "charged_usd": "0.000447",
      "latency_ms": 1240,
      "status": 200
    }
  ]
}

kind is chat, image, video or music. Media calls list outputs instead of tokens, which counts what was billed, so it is the images delivered, the seconds of a clip, or 1 for a song job. Calls made from the apps have no key.

The call's id

An entry's id is the call's moth-request-id, the one your code received on the reply, so a call can be found here by the id in its header. A media job is listed under the id of the request that started it. A call made before Moth kept request ids has a record number in its place, such as req_0002k1.

Failed calls

A call that ended in an error is listed too, with the status it answered in status, zero tokens or outputs, a charge of zero and no latency_ms. That covers a refusal for balance or for a key's cap, a rate limit, a request an endpoint turned down and a failure at the model's host. A stream that failed before its first word and a job that failed after it was accepted are listed with 529, the status the same failure answers with before a reply begins.

model is unknown when the call named no model in the catalog, or was refused before Moth read it, as a rate limit refuses it. kind is then chat on the chat endpoints and image on the media ones. Only the status is kept, never the error's message or any part of what you sent.

A failed call is in no total, so usage and a key's spend cap count settled calls only. A request that didn't sign in isn't listed, since there is no account to list it under, and neither is a call you closed before it was answered. For one account Moth keeps a burst of 30 failed calls and then one every two seconds, so a loop of refused requests can't push your settled calls off the list.

Errors

401authentication_errorThe key is missing, revoked or expired
429rate_limit_errorToo many reads from the key, so wait for retry-after