Skip to content

I encountered an error: openai. error. AuthenticationError Invalid token (request id: 20240204142954xxxxxxxxxxxxxxxxxxx) #1119

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
1 task done
joonk685 opened this issue Feb 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@joonk685
Copy link

joonk685 commented Feb 4, 2024

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

When I call the openai API, it may be normal for the first 1-6 hours, but then as long as I send a request to gpt-3.5 turbo, an AuthenticationError Invalid token (request id: 20240204142954xxxxxxxxxxxxxxxxxxx) will occur. When I restart my django service, it returns to a normal state, which I am very puzzled about

To Reproduce

  1. Call the openai interface
  2. Maintain call frequency and wait for a few hours
  3. An invalid token with an error occurred
  4. When restarting django, everything becomes normal again

Code snippets

response = openai.ChatCompletion.create(
                    model="gpt-3.5-turbo-1106",
                    stream=True,
                    messages=conversation_list,
                    timeout=120
                )
                for data in response:
                    if "content" in data["choices"][0]["delta"]:
                        content = data["choices"][0]["delta"]["content"]
                        print(content, end='')

OS

linux

Python version

Python v3.9.2

Library version

openai v0.28

@joonk685 joonk685 added the bug Something isn't working label Feb 4, 2024
@joonk685
Copy link
Author

joonk685 commented Feb 4, 2024

I have resolved this issue. My problem lies in using an old version of the OpenAI library to call dell-e-3
Once called in this way, all subsequent calls to the GPT interface will encounter errors. Therefore, execute pip install -- upgrade openai to upgrade openai and migrate the code to the latest writing method to complete the upgrade

stainless-app bot pushed a commit that referenced this issue Apr 21, 2025
…ompletions

chore: update completion.parse signature to be in sync
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants