Skip to main content
A user message can carry images next to its text. The model sees them with the rest of the conversation, so the user can ask about a photo, a screenshot, or a document, by text or by voice. higgs-realtime-1.5 accepts images. higgs-realtime does not: an image sent to it is rejected with an error (code: "image_input_not_supported").

Send an image

Add the image as an input_image part of a user message in conversation.item.create. image_url is the image as a base64 data URL:
Adding an item does not start a response. Either send response.create, or add the image alone and let the user ask about it out loud: with turn detection on, the reply to their next spoken turn sees the image. This script sends an image file with a question and prints the reply. It needs Python 3.10 or later and the websockets package:
The script asks for a text reply to keep it short. Leave output_modalities out and the reply is spoken, as in the quickstart.

Formats and limits

An image over a megapixel adds nothing the model can use. Downscale camera photos and screenshots on the client before you send them: the upload is faster, and on a phone connection the difference is seconds.

Stream video frames

To let the model watch a camera or a screen, send its frames as images and set image.input.mode to "video" in session.update:
Then send each frame as its own conversation.item.create, with one input_image part and no text, in the order the frames were captured. The events are the ones you use for a single picture: the mode changes how the server hands the images to the model, not what you send.
  • Turn it on to stream video. Without it every frame is taken as a full picture. That fills the conversation’s context quickly, and a response sees only the 8 most recent frames.
  • A frame takes much less context than a picture. That is why a response can see four times as many. In return the model gets less detail from each frame, so small text may be lost: keep "image" when one picture has to be read closely.
  • Send at most one frame per second. A response sees the 32 most recent frames, so at one frame per second that is about the last half minute. Sending faster shortens what the model can look back on.
  • Send frames at one size. The model takes consecutive frames of the same size together. Frames of different sizes are still accepted.
  • The mode covers the whole session. It applies to every image in the conversation, the ones sent before you set it included. You can change it in any session.update, and the change applies from the next response. "image": null restores the default.
  • The ack reports it. session.created and session.updated carry the mode in force as session.image.input.mode, the default included.
  • higgs-realtime takes no images. Its session.created carries no image, and setting a mode on it, "image" included, fails the session.update. Any value other than "image" or "video" fails it too.

Events and errors

conversation.item.added and conversation.item.done carry the image part without its data ("image_url": null), so the image is not sent back to you. conversation.item.retrieve returns it as the server holds it, which for a resized image is the resized JPEG. An image that cannot be used is not added to the conversation. The server answers with an error of type: "invalid_request_error" and the session stays open: See conversation.item.create in the API reference for the field list.