Home → Help
invalid_request_error: Could not process imageInvalid base64 image_urlimage exceeds N MB maximumThe same image works in the web UI and fails through the APIA base64 image sent as image_url needs the full data URL, including the media type: data:image/png;base64,
Command-line base64 wraps lines by default on many systems. The embedded newlines make the payload invalid even though it looks right. Use the flag that disables wrapping.
Size limits apply to the encoded payload, which is about a third larger than the file on disk. An image just under the limit locally can be over it on the wire.
Encode without line wrapping and confirm the prefix is present:
b64=$(base64 -w0 image.png) # macOS: base64 -i image.png | tr -d '\n'
echo "payload bytes: ${#b64}"
printf 'data:image/png;base64,%s' "$b64" | head -c 40; echo
The first 40 characters should start with data:image/png;base64,. If your payload bytes are far larger than expected, the file itself is too big.
Last checked 2026-10-01. Written from problems diagnosed on a live OpenAI-compatible gateway, not collected from other sites.