chat() and chatStream() methods provide text generation with support for multimodal inputs, function calling, and streaming.
Basic Chat
Streaming
Stream responses token by token for better UX:Message Roles
System Messages
Set behavior and context:Conversation History
Include previous messages for context:Vision (Multimodal)
Send images in messages:Image Detail Levels
Multiple Images
Function Calling
Define tools the model can use:Tool Choice Options
Complete Function Calling Example
JSON Mode
Force structured JSON output:Parameters
Request Parameters
Data Parameters
Temperature Guide
Response
Finish Reasons
Advanced
Override Model
Override the gate’s configured model:Custom Metadata
Track requests with metadata:Stop Sequences
Stop generation at specific strings:End-user ID (experiment routing)
PassendUserId when you want a stable end-user to consistently land in the
same experiment variant across every request they make.
endUserId always hash to the same
variant; different values get independent assignments.
If an active experiment on the gate is configured with
randomization_unit = 'user' and endUserId is missing, the request will
bypass the experiment (and will not be counted as either variant). The
experiment’s coverage metric in the dashboard shows how much traffic had the
identifier. We’ll email you if 10 consecutive requests miss it.Best Practices
1. Use Streaming for Long Responses
2. Always Handle Errors
3. Provide System Context
4. Monitor Costs
Examples
Customer Support Bot
Code Explanation
Image Analysis
Next Steps
Images
Generate images from text
Embeddings
Create text embeddings
Gates & Routing
How Verlon routes requests
Cost Tracking
Monitor spending

