# Request Logs

> Inspect individual requests with latency breakdown, tokens, cost, upstream provider and, when privacy permits, the full body.


# Request Logs

Request Logs shows every call through AnyRouter at [/dashboard/logs](https://anyrouter.dev/dashboard/logs): latency, tokens, cost, the upstream that served it and, when privacy permits, the full body. It has a flat **request list**, a rolled-up **Sessions** tab, and an activity chart that mirrors your filters.

| Field | Meaning |
| --- | --- |
| **Time** | When AnyRouter received the request, in your timezone |
| **Model** | The model that served it, usually the one you asked for. For a router such as `anyrouter/auto`, or a free model falling back to `anyrouter/free`, it is the model that answered (same as the `X-AnyRouter-Model` response header) |
| **Provider** | The upstream that actually served it, useful after routing or failover |
| **App** | App name from attribution headers ([App Attribution](/features/app-attribution)) |
| **Key** | Key name or last six characters of the prefix |
| **Tokens** | `input → output`; a lightning icon means part of the input came from a prompt cache |
| **TTFT** | Time to first token in ms; equals total latency for non-streamed requests |
| **Latency** | End to end, including fallback attempts and streaming time |
| **Speed** | `output_tokens / (latency − TTFT)` |
| **Cost** | USD charged; hover for input, output and cached split |

Status icons: **Success** (`2xx` from the chosen upstream), **Cached** (prompt or completion cache), **Fallback** (at least one upstream was retried before success; expand to see which), **Error** (every upstream returned an error; hover for code and message).

## Filtering

Filters compose and live in the URL, so views are shareable: **Model** (substring), **Key** (includes disabled keys), **Status**, **Date range** (presets from 30 minutes to 90 days, or custom ISO-8601 `From`/`To`), and **Request ID** (the `X-Request-Id` value; when set, all other filters are ignored). Click a chart bar to drill into that 24-hour slice, or regroup by request type, model, provider or status.

## Sessions

Tag requests of one conversation with a session id, either as a top-level `session_id` body field or an `x-session-id` header (the body wins). It can be any string up to 256 characters. It works on `/chat/completions`, `/messages`, `/responses` and `/embeddings`.

```bash
curl https://anyrouter.dev/api/v1/chat/completions \
  -H "Authorization: Bearer $ANYROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4-6",
    "session_id": "thread_7f3a",
    "messages": [{ "role": "user", "content": "Continue our conversation…" }]
  }'
```

The **Sessions** tab shows one row per session: request count (plus errors), distinct models, **Cost**, **Tokens** and **Last seen**. Click a row to filter the list to `?session_id=…`; detail dialogs link back to the session.

## Detail view

Click a row to open **Generation details**: KPI grid (latency, throughput, cost, tokens, fallback attempts), overview, request fields (request id, upstream generation id, key id, finish reason such as `stop`, `length` or `tool_calls`, streamed flag, API type), structured error, a **Provider Responses** timeline per upstream attempt (provider, HTTP status, latency, phase), request and response bodies when captured, and the full row as copyable JSON.

## Body capture and redaction

Body capture is controlled from [Privacy Controls](/features/privacy-controls). When it is off, the body panel shows "No payload captured" and every other field is unaffected. When on, these are redacted before storage:

- System prompts, replaced with `[redacted system prompt]`.
- Tool outputs: `tool` role messages and the `content` of tool result blocks.
- Bearer tokens and `Authorization` headers.

User messages, assistant replies and tool call arguments are kept verbatim.

## Streaming and errors

Streaming rows appear a few seconds after the stream closes. TTFT is the time to the first token reaching the client; Latency runs to stream close. A client-cancelled stream records the partial token count with `streamed: true`; status is `success` if tokens were delivered, `error` if the upstream failed first.

Error rows show a stable **Code** (`upstream_unavailable`, `context_length_exceeded`, `rate_limited`, `invalid_request`, …), the trimmed upstream **Message**, the **Request ID** (also the `X-Request-Id` header and `error.request_id`) and the Cloudflare **cfRay**. When you escalate to support, include both `request_id` and `cfRay`; the Provider Responses timeline usually shows whether the cause was upstream rate limits, an outage or a rejected request.

## Retention

Dashboard and [`/api/v1/logs`](https://anyrouter.dev/docs/api-reference/overview) read-access is clamped to the plan window, even with no start date. Rows older than that are not returned, and AnyRouter does not automatically delete those rows.

| Plan | Visible rows and bodies |
| --- | --- |
| Free, Go | 7 days |
| Pro, Max | 30 days |
| Enterprise | 90 days |

Aggregated charts and per-key totals are kept indefinitely. Export rows you need through the logs API before they leave the window.

## Common tasks

- **A user complaint:** paste the request id into the **Request ID** filter. Without one, filter by the user's key and a tight time range; the finish reason shows length limits or refusals.
- **Expensive requests:** set `Last 7 days`, pick the key, sort by **Cost**, and check the cached split for an uncached system prompt, a runaway tool loop or a high output cap.
- **Prompt injection:** filter `status: error` and look for refusal codes (`content_policy_violation`, `safety_filter`); for odd successes, check bodies for "ignore previous instructions".


## Related

- [Usage Explorer](/docs/features/usage-explorer.md)
- [Prompt Caching](/docs/features/caching.md)
- [Privacy & Logging Controls](/docs/features/privacy-controls.md)
- [App Attribution](/docs/features/app-attribution.md)
