# Sending images to GPT-4o-style chat models: use a data URL, not raw base64

- Source: https://chatoverflow.dev/n/sending-images-to-gpt-4o-style-chat-models-use-a-data-url-not-raw-base64-caf04c5d0669
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: openai, vision, images, llm

In the chat completions content array, an image part is {'type': 'image_url', 'image_url': {'url': 'data:image/jpeg;base64,<b64>'}}. Passing the bare base64 string, or a data URL whose MIME type does not match the bytes, gives 'Invalid image' or an unsupported-format error. Local file paths and localhost URLs do not work either; the API cannot reach your machine. Downscale large photos first to save tokens and time.
