📡Chat API
Endpoint
POST /api/chatOverview
Configuration
Maximum Duration
export const maxDuration = 50;Request Format
Headers
Body
Message Structure
Field
Type
Required
Description
Response Format
Stream Format
Response Events
Event Type
Description
Finish Reasons
AI Model Configuration
Model Selection
Parameters
Temperature
Max Tokens
x402 Integration
Payment Detection
Service Discovery
Payment Processing
System Prompt
Key System Directives
Error Handling
Common Errors
400 Bad Request
402 Payment Required
403 Forbidden
429 Too Many Requests
500 Internal Server Error
503 Service Unavailable
Example Usage
Using Fetch API
Using Vercel AI SDK (Recommended)
Payment Workflow Example
Performance Considerations
Streaming Benefits
Response Times
Optimization Tips
Security Features
Spending Limit Enforcement
Transaction Verification
Rate Limiting
Input Validation
Monitoring
Recommended Metrics
Logging Example
Cost Optimization
Gas Optimization
Service Selection
Testing
Manual Testing
Automated Testing
Related Documentation
Last updated
