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
- Make sure your network or agent can access
https://chat.openai.com
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for UnlimitedChatGPTWebAPI-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | aed4fbbddc9604efa40e0a31119b0ef71ed010daef891b979dd5662843f458d1 |
|
MD5 | 1d85eabf1f1fb9a458adf3fc5b30bfd6 |
|
BLAKE2b-256 | 4eecaff3af2846c5a2a580d6bd2e9af76b86e4a9ab2e7f46a21f5edad7a1acc0 |
Close
Hashes for UnlimitedChatGPTWebAPI-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8130c5912bca8a1898e3cd27b1e88168a9abe5317035cfd0c41391a9687b7adf |
|
MD5 | bfd6b14eea7dce48adba6e7109c64dba |
|
BLAKE2b-256 | a155f1d2e19f61e37884da1493b7ec51382bfa1bd5f67a8c2c5dc93b1ecffb66 |