DALL-E 3 no longer working via API (RemoteProtocolError)

The same code I’ve been using before to generate images with DALL-E 3 via the API no longer works. I also tried the example code from the documentation, which did not work either.

All systems are operational according to OpenAI’s status page. DALL-E 2 works fine – but not DALL-E 3. GPT-3.5-Turbo also works fine.

Code (from documentation, having only added API key, logging, and print statement):

import os
import logging
logging.basicConfig(level=logging.DEBUG)

from openai import OpenAI
client = OpenAI(api_key=os.environ["OAI_KEY"])

response = client.images.generate(
  model="dall-e-3",
  prompt="a white siamese cat",
  size="1024x1024",
  quality="standard",
  n=1,
)

image_url = response.data[0].url

print(image_url)

Console output:

DEBUG:httpx:load_ssl_context verify=True cert=None trust_env=True http2=False
DEBUG:httpx:load_verify_locations cafile='C:\\Users\\Aimjock\\Desktop\\Aimjock Stuff\\Code test newwww\\.code-testing\\Lib\\site-packages\\certifi\\cacert.pem'
DEBUG:openai._base_client:Request options: {'method': 'post', 'url': '/images/generations', 'files': None, 'json_data': {'prompt': 'a white siamese cat', 'model': 'dall-e-3', 'n': 1, 'quality': 'standard', 'size': '1024x1024'}}
DEBUG:httpcore.connection:connect_tcp.started host='api.openai.com' port=443 local_address=None timeout=5.0 socket_options=None
DEBUG:httpcore.connection:connect_tcp.complete return_value=<httpcore._backends.sync.SyncStream object at 0x000001F735755730>
DEBUG:httpcore.connection:start_tls.started ssl_context=<ssl.SSLContext object at 0x000001F7368E0150> server_hostname='api.openai.com' timeout=5.0
DEBUG:httpcore.connection:start_tls.complete return_value=<httpcore._backends.sync.SyncStream object at 0x000001F736925670>
DEBUG:httpcore.http11:send_request_headers.started request=<Request [b'POST']>
DEBUG:httpcore.http11:send_request_headers.complete
DEBUG:httpcore.http11:send_request_body.started request=<Request [b'POST']>
DEBUG:httpcore.http11:send_request_body.complete
DEBUG:httpcore.http11:receive_response_headers.started request=<Request [b'POST']>
DEBUG:httpcore.http11:receive_response_headers.failed exception=RemoteProtocolError('Server disconnected without sending a response.')
DEBUG:httpcore.http11:response_closed.started
DEBUG:httpcore.http11:response_closed.complete
INFO:openai._base_client:Retrying request to /images/generations in 0.780869 seconds
DEBUG:openai._base_client:Request options: {'method': 'post', 'url': '/images/generations', 'files': None, 'json_data': {'prompt': 'a white siamese cat', 'model': 'dall-e-3', 'n': 1, 'quality': 'standard', 'size': '1024x1024'}}
DEBUG:httpcore.connection:connect_tcp.started host='api.openai.com' port=443 local_address=None timeout=5.0 socket_options=None
DEBUG:httpcore.connection:connect_tcp.complete return_value=<httpcore._backends.sync.SyncStream object at 0x000001F7369270E0>
DEBUG:httpcore.connection:start_tls.started ssl_context=<ssl.SSLContext object at 0x000001F7368E0150> server_hostname='api.openai.com' timeout=5.0
DEBUG:httpcore.connection:start_tls.complete return_value=<httpcore._backends.sync.SyncStream object at 0x000001F736927080>
DEBUG:httpcore.http11:send_request_headers.started request=<Request [b'POST']>
DEBUG:httpcore.http11:send_request_headers.complete
DEBUG:httpcore.http11:send_request_body.started request=<Request [b'POST']>
DEBUG:httpcore.http11:send_request_body.complete
DEBUG:httpcore.http11:receive_response_headers.started request=<Request [b'POST']>
DEBUG:httpcore.http11:receive_response_headers.failed exception=KeyboardInterrupt()
DEBUG:httpcore.http11:response_closed.started
DEBUG:httpcore.http11:response_closed.complete

I decided to be pessimistic and set higher timeouts on the python OpenAI client, since you have timeout=5.0 reported within:

import httpx
client = OpenAI(timeout=httpx.Timeout(60.0, read=10.0, write=20.0, connect=10.0))

(using OPENAI_API_KEY from the environment is already library behavior)

12.6 seconds from call to response.

Thank you.

I’ve had no issues with this in the past despite generations always taking longer than five seconds. This makes me wonder if they changed the default timeout value, or made another change that is causing this issue to happen, in the openai Python library. I’m using the latest version, 1.6.1, but haven’t tried DALL-E 3 image generation since updating the library.

>>> import openai; openai.__version__
'1.5.0'

pip…
Successfully installed openai-1.6.1

Another 8.8 seconds away:

So things seem operational.