Skip to content

Reference

API: Activity and logs

Markdown version

MethodPathWhat it doesScope
GET/v1/activityUsage over a time window (default the last 30 days, at most 92), grouped by model, key, provider or day: requests, errors, tokens, list cost and what was chargedgateway:read
GET/v1/generationsRequests, newest first: model, provider, key, tokens, list cost and what was charged, latency. Filter by model, key, status and time; prompts and completions are on each request's own page when logging is ongateway:read
GET/v1/generations/:idOne request: its model, provider, tokens, cost, charge and timing, and its prompt and completion when logging was on and they're within the retention you chosegateway:read
GET/v1/generations/exportThe requests as a CSV file (oldest first, at most 100,000 rows, and the X-Export-Truncated header says when there were more: narrow it with from and to; prompts and completions are never exported). Same filters as the listgateway:read
GET/v1/settings/loggingWhether prompts and completions are kept (off unless an owner turned it on) and for how many dayssettings:read
PUT/v1/settings/loggingOwners, in the web app: keep prompts and completions for 1, 7 or 30 days, or stop keeping them (turning it off deletes the kept ones at once). Request metadata is kept either way (web app only)settings:write

Examples

GET /v1/activity

Usage over a time window (default the last 30 days, at most 92), grouped by model, key, provider or day: requests, errors, tokens, list cost and what was charged

curl -s "https://manage.restolayer.com/v1/activity" \
  -H "Authorization: Bearer $LG_API_KEY"
const res = await fetch(`https://manage.restolayer.com/v1/activity`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.LG_API_KEY}` },
});
const data = await res.json();

GET /v1/generations

Requests, newest first: model, provider, key, tokens, list cost and what was charged, latency. Filter by model, key, status and time; prompts and completions are on each request's own page when logging is on

curl -s "https://manage.restolayer.com/v1/generations" \
  -H "Authorization: Bearer $LG_API_KEY"
const res = await fetch(`https://manage.restolayer.com/v1/generations`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.LG_API_KEY}` },
});
const data = await res.json();

GET /v1/generations/$ID

One request: its model, provider, tokens, cost, charge and timing, and its prompt and completion when logging was on and they're within the retention you chose

curl -s "https://manage.restolayer.com/v1/generations/$ID" \
  -H "Authorization: Bearer $LG_API_KEY"
const res = await fetch(`https://manage.restolayer.com/v1/generations/${id}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.LG_API_KEY}` },
});
const data = await res.json();

GET /v1/generations/export

The requests as a CSV file (oldest first, at most 100,000 rows, and the X-Export-Truncated header says when there were more: narrow it with from and to; prompts and completions are never exported). Same filters as the list

curl -s "https://manage.restolayer.com/v1/generations/export" \
  -H "Authorization: Bearer $LG_API_KEY"
const res = await fetch(`https://manage.restolayer.com/v1/generations/export`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.LG_API_KEY}` },
});
const data = await res.json();

GET /v1/settings/logging

Whether prompts and completions are kept (off unless an owner turned it on) and for how many days

curl -s "https://manage.restolayer.com/v1/settings/logging" \
  -H "Authorization: Bearer $LG_API_KEY"
const res = await fetch(`https://manage.restolayer.com/v1/settings/logging`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.LG_API_KEY}` },
});
const data = await res.json();

Request and response schemas: https://www.restolayer.com/openapi.json. All resources: API reference.

Send feedback

Tell us what's broken, confusing or missing on this page, or an idea. It goes to the team that builds the product.
Please don't include passwords or card numbers.
Only to reply about this. Never added to any mailing list.