Intermittent 'Invalid Image' Error When Using Chat Completion API with Image URLs

Since yesterday, I have started experiencing issues with an API that I have been using.

I use both the Assistant API and the Chat Completion API in different screens of my app depending on the purpose.

1. Situation from yesterday until now

Most of the APIs used for text input/output are still working properly. However, when using the Chat Completion API to send an image via URL, I receive the following error message:

error type: invalid_request_error,
error message: Invalid image.

ScreenShot_04

2. My Situation

The current issue is specifically with the use of the “Chat Completion API to send an image via URL.”
I use the API in the following three stages:

  • Stage 1 API: Evaluate an image based on a specified criterion.
  • Stage 2 API: Compare the image processed in Stage 1 with an image input in Stage 2 based on defined criteria.
  • Stage 3 API: Evaluate the images from Stage 2 and Stage 3 according to specific criteria.

The initial error occurred during the process of modifying code while using the Stage 3 API.
Initially, I thought I might have made a mistake in my code, but after debugging each stage, I found that the version of the code released last week, which worked properly then, now also has issues.
Thus, I confirmed that the same issue occurs in the Stage 1 and Stage 2 APIs, even without making any new changes.

3. Testing on Playground

When testing the current problematic API’s instructions on the Playground, it works properly.
Thus, it is not an issue with the AI model itself.

4. API Transmission Error

I also checked if there was an issue with the format of the data I was sending, but the data seems correct.
ScreenShot_01



ScreenShot_04

5.My Assumption About the Cause

  • It is a very peculiar phenomenon: When I first tested the Stage 3 API after adding 4 additional parameters to the output JSON, it worked correctly. However, from the second test onward, I started getting an “invalid image” error, even though I made no changes to the code.
  • Similarly, when testing the Stage 1 API with the code released last week, it worked properly on the first test, but the second test image resulted in an error.

6.Summary

  • When sending an image via URL using the Chat Completion API, an “Invalid image.” error occurs.
  • The error does not occur when sending text input.
  • These APIs were working properly, but since a certain point, they successfully process the first attempt, but consistently fail afterward.

7. Personal Opinion

  • Given these characteristics, I suspect that the issue might be caused by caching.
  • I am not sure when prompt caching support started, but I would like to request a confirmation on this matter.
1 Like