API reference

API reference · Usage

Search the per request log

GET/api/logsSigned in session

A search inside a time window (at most 400 days; the last 7 by default) with filters, newest first, read on the account's own usage index and at most 2000 rows a page scanned; a page that scanned its share without filling says so in more: scan and its nextCursor looks further back. A bad filter is a 400 naming it. Also a session rollup (groupBy=session), one session's rows (session=) or a CSV export (format=csv).

Parameters

Path and query parameters
FieldTypeWhat it is
from (query)integerWindow start, epoch ms.
to (query)integerWindow end, epoch ms. Default now.
model (query)stringModel ids containing this text.
key (query)integerOne key's number.
status (query)stringA status class (2xx, 4xx, 5xx) or one status.
error (query)stringAn error type, such as rate_limit_exceeded.
request (query)stringA request id, req_...
costMin (query)integerBilled cost at least, micro USD.
costMax (query)integerBilled cost at most, micro USD.
cursor (query)stringContinue from a previous nextCursor.
limit (query)integerDefault 50. From 1 to 200.
session (query)stringOne x-antimatter-session label's rows.
groupBy (query)stringReturn session rollups. One of "session".
format (query)stringReturn a CSV attachment. One of "csv".

Answer 200

A page of the search, session rollups, or CSV.

Fields of the 200 answer
FieldTypeWhat it is
rowsarray of LogRow
rows[].idinteger
rows[].tsinteger
rows[].modelstring
rows[].upstreamstring
rows[].statusinteger
rows[].promptTokensinteger
rows[].completionTokensinteger
rows[].costMicrosinteger
rows[].ttftMsinteger or null
rows[].totalMsinteger or null
rows[].sessionIdstring or null
nextCursorstring or null
morestring or nullOne of "rows", "scan", null.
scannedinteger or nullRows the filters were checked on.
reachedTsinteger or nullHow far back this page looked, epoch ms.
windowobject
window.frominteger
window.tointeger
errorTypesarray of string

Errors

  • 400OpenAI shaped error.
  • 401OpenAI 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.

Antimatter