Skip to main content

Unlimited ChatGPT WebAPI

Project description

UnlimitedChatGPTWebAPI

Resolve Cloudflare Challenge To use ChatGPT Web API

Installation

pip3 install UnlimitedChatGPTWebAPI

then you should run playwright install chromium

For windows, maybe you should use it -> playwright install-deps chromium

Configuration

  1. Make sure your network or agent can access https://chat.openai.com
  2. Please make sure that the VPS RAM is not too small.

Usage

Basic example

import asyncio

from UnlimitedChatGPTWebAPI import ChatSession


async def main():
    async with ChatSession(proxies="socks5://localhost:7890") as session:
        # or use this if you want to use the same session for multiple requests
        # example:
        # session = ChatSession(proxies="socks5://localhost:7890")
        # await session.init_page()
        async with session.fetch(
            method="GET",
            url="/backend-api/models",
            headers={"Authorization": "Bearer xxx"}
        ) as resp:
            print(await resp.json())

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

Streaming example

import asyncio

from UnlimitedChatGPTWebAPI import ChatSession


async def main():
    async with ChatSession(proxies="socks5://localhost:7890") as session:
        # or use this if you want to use the same session for multiple requests
        # example:
        # session = ChatSession(proxies="socks5://localhost:7890")
        # await session.init_page()
        async with session.fetch(
            method="GET",
            url="/backend-api/models",
            headers={"Authorization": "Bearer xxx"}
        ) as resp:
            data = b""
            async for chunk in resp.iter_chunked():
                data += chunk
            print(data.decode())

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

UnlimitedChatGPTWebAPI-0.1.2.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

UnlimitedChatGPTWebAPI-0.1.2-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file UnlimitedChatGPTWebAPI-0.1.2.tar.gz.

File metadata

  • Download URL: UnlimitedChatGPTWebAPI-0.1.2.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for UnlimitedChatGPTWebAPI-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d0b54f7790d84cb09b1afdae8e9b4008549fd47f7ffb33ce1fc806867a4aee88
MD5 3edfde5e49363fb20f3175db6ed0b9b6
BLAKE2b-256 ab42540e171fc5360828a3d20d641cd12d9f2e5ba356bdef34ba7c95abf6a755

See more details on using hashes here.

File details

Details for the file UnlimitedChatGPTWebAPI-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for UnlimitedChatGPTWebAPI-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 69ba74830e17d95086c87e179ac30f5022af1feada5d2389c2b3d05ee525b1e6
MD5 e11d252556a38e3fc9c832f75f3d3e9b
BLAKE2b-256 043337459433878b6c96b6ec24eed77bc2f0ae9d99ebcbf8e658b5328d2d4af7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page