Skip to main content
Send a camera snapshot or image to the AI for visual recognition and analysis. This event is used to transmit base64-encoded images captured from the user’s camera for scene analysis, object recognition, or visual Q&A.
Provider Compatibility: Image input is only supported with the OpenAIRealtime provider. This feature is not available when using other AI providers (e.g., ElevenLabs).

Message Format

This is a client-to-server event that you send to transmit image data.
string
required
Event type. Must be "realtime.input_image".
object
required
Event data object containing the image content and reply flag.

Request Example

Message Structure

Usage Scenarios

Scenario 1: Periodic Scene Recognition

Send camera frames periodically (e.g., every 2 seconds) without requesting replies:
The AI builds visual context over time and can reference what it “sees” when responding to user questions.

Scenario 2: On-demand Visual Q&A

User asks “What do you see?” - capture and send with reply: 1:
Combine periodic background capture (reply: 0) with on-demand analysis (reply: 1):

Best Practices

  • Format: Use JPEG for optimal compression and compatibility
  • Quality: Set to 0.7 (70%) to balance quality and payload size
  • Resolution: 640x360 is sufficient for most recognition tasks
  • File Size: Target 20-50KB per frame after compression
  • Periodic capture: 2-3 seconds interval for most use cases
  • Adjust based on use case:
    • Fast-moving scenes: 1 second
    • Static scenes: 3-5 seconds
  • Don’t exceed 1 frame per second to avoid overwhelming the AI and consuming excessive bandwidth
  • Use reply: 0 (default) for:
    • Background periodic capture
    • Building visual context
    • Continuous monitoring without responses
  • Use reply: 1 when:
    • User explicitly asks about the camera view
    • You need immediate AI analysis
    • Triggering specific visual recognition tasks

Camera Recognition Guide

Complete guide for implementing camera recognition with both WebRTC and snapshot methods

WebRTC Connection

Learn how to set up WebRTC connections for video transmission
For more details on camera recognition implementation, including WebRTC video stream transmission, see the Camera Recognition guide.