Send Custom Body
Custom Data Personalization API
Send additional data with every chat request. Perfect for user preferences, session info, or any custom parameters your API needs.
Use Cases
Common scenarios include sending user IDs for personalization, API keys for different providers, theme preferences, or any application state that should influence the AI response.
Demo
Change the name and age, then send a message!
Custom body:
{ name: "Alice", age: 25 }Client Component
The body option accepts any object. The loading state
shows a personalized message with the user's name and age while the AI curates a response.
+page.svelte
Copy
Server Endpoint
Destructure your custom fields from the request body. Use them to personalize the system prompt or for any server-side logic.
+server.ts
Copy