Skip to main content

AI Gateway logs now show session affinity

By Steven Van ·

Sessions group requests by coding agent or app, showing cost, cache hit rate and the provider path, with filters for turns, client, model and cost.

AI Gateway logs on Vercel have a new Sessions view that groups requests into sessions and shows how session affinity routed each one.

What the Sessions view shows

Each row shows the coding agent or app that ran the session, such as Claude Code, Codex, or Cursor. It also lists the session's cost, models, providers, and how much of its input was cached across every turn.

Opening a session shows its cache hit rate, duration, and path. The path lists each turn with its model and timing, and names the provider serving the session along with any earlier ones.

How session affinity works

Session affinity sends each turn to the provider that served the one before it, so the provider already has most of the prompt in cache. A session that stays on one provider reads more of each prompt from cache.

It runs by default on text and chat requests. To group requests yourself, send the same sessionId in providerOptions.gateway, or the same x-session-id header, on every request in a conversation. Requests without one are grouped by a fingerprint of the conversation's opening and appear as fingerprinted sessions.

Filtering

Sessions can be filtered by turns, client, model, provider, authentication, or cost. Single-turn sessions are hidden until the minimum turns filter is cleared.

Vercel
Vercel
The platform for frontend developers — deploy, preview, and scale web apps and AI agents with zero config.
View Vercel →

Original source

Read AI Gateway logs now show session affinity on Creators Toolbox