Two image sources
- HTTPS image URL: use an image address directly accessible to the gateway or upstream. Browser access does not prove server access; login cookies, temporary authorization, or redirects may cause failures.
- Base64 data URL: read a local image and encode it with its actual MIME type, such as
data:image/png;base64,.... Public image hosting is unnecessary, but the request body grows.
file:// as a remote image URL. Remote access, formats, dimensions, and image counts depend on the deployment and model.
Runnable example: send a local image
Follow the Python SDK guide, then set one additional environment variable:vision.py and run python vision.py. The command sends the image to the configured API service, which may forward it upstream. This example accepts PNG/JPEG up to 5 MiB; that is an example-specific limit, not a gateway or model allowance.
Protocol field differences
Switching to Responses also requires changing the input structure. Optional fields such as
detail require model support; validate a request without extra options first.
Python: vision with Responses
Save asresponses-vision.py, use the Python environment and API_IMAGE_PATH from above, and run python responses-vision.py. This submits the image to your configured service; choose a model and channel supporting Responses image input. The example keeps the same local 5 MiB file limit, uses input_text and input_image, and does not require a separate Files API upload.
Troubleshooting
HTTP integration · Errors and retries
Reference: OpenAI image inputs.
For generating or editing images, see image generation.
简体中文