Technology2 min read

AI Gateway logs now show session affinity

By · Published by Everything Blog

In short

The AI Gateway now features a Sessions view that groups requests into sessions, displaying detailed information such as coding agent, cost, models, providers, and cache usage. This feature allows for easy filtering and management of sessions by turns, client, model, provider, authentication, or cost. Sessions can be hidden until the minimum turns filter is cleared, and session affinity routes each turn to the provider that served the previous one, optimizing for cached input. To group requests yourself, use the provided sessionId in providerOptions.gateway or the same x-session-id header on every request in a conversation. Requests without a sessionId are fingerprinted and appear as fingerp…

Key points

  • The AI Gateway now features a Sessions view that groups requests into sessions.: The AI Gateway now features a Sessions view that groups requests into sessions.
  • This view displays detailed information such as coding agent, cost, models, providers, an…: This view displays detailed information such as coding agent, cost, models, providers, and cache usage.
  • Sessions can be filtered by turns, client, model, provider, authentication, or cost.: Sessions can be filtered by turns, client, model, provider, authentication, or cost.

Sources checked by our analysis pipeline: 1

AI Gateway logs now have a Sessions view that groups requests into sessions and shows how session affinity routed each one. Each row shows the coding agent or app that ran the session, such as Claude Code, Codex, or Cursor, along with its cost, models, providers, and how much of its input was cached across every turn.

Open a session to see 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. 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.

Filter sessions by turns, client, model, provider, authentication, or cost. Single-turn sessions are hidden until you clear the minimum turns filter.

Session affinity 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.

Read the session affinity documentation for more information on how AI Gateway identifies sessions.

Original source: vercel.com

Technology