Setup
Streaming text
X-Xenovia-Session-Id and X-Xenovia-Trace-Id into the response headers before the first token, so streaming traces are always correlated correctly.
Next.js App Router route handler
Tool calling
Tool schemas are forwarded to the upstream LLM. The Xenovia request-stage policy evaluatesinput.tool_names before the call reaches the model.
Session tracking
Pass a stable session ID to group all turns of a chat conversation. The Vercel AI SDK does not add session IDs automatically — provide one per conversation from your application layer.Handling policy blocks
When a request is blocked, the runtime returns403. Handle it at the route level before returning the stream response.
The Vercel AI SDK uses persistent connections by default. Subsequent requests within the same server instance have lower latency because the TCP connection to Xenovia is reused.