AI Agent News/stories/vercel-ai-gateway-logs-add-a-sessions-view-with-session-affinity-details.md

Infrastructure

Vercel AI Gateway logs add a Sessions view with session affinity details

Vercel's AI Gateway logs now include a Sessions view that groups requests into sessions and shows how session affinity routed each one. Each session row lists the coding agent or app behind it, such as Claude Code, Codex, or Cursor, along with cost, models, providers, and cache usage.

Source: vercel.com/changelog/ai-gateway-logs-now-show-session-affinity

The Sessions view groups logs by session and shows a cache hit rate, session ID, cost and other metrics for each. Opening a session shows its duration and path, which lists each turn with its model and timing and names the provider that served the session and any earlier providers.

Session affinity sends each turn to the provider that handled the previous turn, so that provider already holds most of the prompt in its cache. Vercel says a session that stays on one provider reads more of each prompt from cache. Sessions can be filtered by turns, client, model, provider, authentication, or cost, and single-turn sessions are hidden until the minimum turns filter is cleared.

Session affinity is on by default for text and chat requests. Developers can group requests themselves by sending the same sessionId in providerOptions.gateway or the same x-session-id header on every request in a conversation. Requests without either are grouped by a fingerprint of the conversation's opening and appear as fingerprinted sessions.

Why it matters if you build agents

If you run agents through AI Gateway, you can now see per-session cost and cache hit rate instead of only individual requests.

To get reliable grouping, send the same sessionId or x-session-id on every request in a conversation; otherwise sessions fall back to fingerprints of the opening messages.

Keeping a session on one provider is what lets cached prompt data be reused, so check the path view if cache hit rates drop.

Get stories like this every weekday

One short email with the day's agent tooling news.

Subscribe