Skip to content

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

@joonk685

Description

@joonk685

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions