Skip to main content

Streaming

VecTrade uses Server-Sent Events (SSE) for real-time streaming of AI analysis responses.
SDK AI Streaming is coming soon. Direct client.ai.stream() is not yet available in the public SDK. AI streaming is currently available through the VTrade Copilot web interface for Standard and Professional plan users.

AI Streaming

SSE Event Format

The stream sends events in standard SSE format:

Stream Event Types

Async Streaming (Python)

Edge/Worker Streaming (TypeScript)

For Vercel Edge Functions or Cloudflare Workers, convert to a ReadableStream:

Error Handling in Streams

Errors during streaming are delivered as error events before the connection closes:

Connection Management

  • Streams auto-close when the [DONE] event is received
  • Use context managers for guaranteed cleanup: