Zai-Kun / reverse-engineered-chatgpt

Unofficial reverse-engineered ChatGPT API in Python
Apache License 2.0
240 stars 31 forks source link

Use Chatgpt without Sign in #43

Closed Barrierml closed 4 months ago

Barrierml commented 4 months ago

Reason

https://github.com/Zai-Kun/reverse-engineered-chatgpt/issues/41 the openai already supported no sign mode to chat

Result

This PR is support regpt can use chatgpt without session id, but be careful, The chatgpt has a creation cap for free accounts

Test Code

from re_gpt import AsyncChatGPT
import asyncio

async def main():
    async with AsyncChatGPT() as chatgpt:
        conversation = chatgpt.create_new_conversation()
        async for message_chunk in conversation.chat("hello"):
            print(message_chunk["content"], flush=True, end="")

if __name__ == "__main__":
    asyncio.run(main())