base on OpenAI API Free Reverse Proxy # This project is a bit outdated and isn’t working right now. We’ll update it, but we’re tied up with another project at the moment. In the meantime, you’re welcome to use [our hosted models for free](#accessing-our-hosted-api). ## ChatGPT `gpt-3.5-turbo` API for Free (as a Reverse Proxy) Welcome to the ChatGPT API Free Reverse Proxy, offering free self-hosted API access to ChatGPT (`gpt-3.5-turbo`) with OpenAI's familiar structure, so no code changes are needed. ## Quick Links - [Join our Discord Community](https://discord.pawan.krd) for support and questions. - ⚡Note: Your Discord account must be at least 7 days old to be able join our Discord community. ## Table of Contents - [Features](#features) - Option 1: [Installing/Self-Hosting Guide](#installingself-hosting-guide) (Without using any API key) - Method 1: [Using Docker](#using-docker) or [Run it with a Chat Web UI using docker-compose](./docker-compose) - Method 2: [Your PC/Server](#your-pcserver) (manually) - Method 3: [Termux on Android Phones](#termux-on-android-phones) - Option 2: [Accessing Our Hosted API](#accessing-our-hosted-api) (Free) - [Usage Examples](#usage-examples) - [License](#license) ## Features - **Streaming Response**: The API supports streaming response, so you can get the response as soon as it's available. - **API Endpoint Compatibility**: Full alignment with official OpenAI API endpoints, ensuring hassle-free integration with existing OpenAI libraries. - **Complimentary Access**: No charges for API usage, making advanced AI accessible to everyone even **without an API key**. ## Installing/Self-Hosting Guide ### Using Docker 1. Ensure Docker is installed by referring to the [Docker Installation Docs](https://docs.docker.com/engine/install/). 2. Run the following command: ```bash docker run -dp 3040:3040 pawanosman/chatgpt:latest ``` 3. Done! You can now connect to your local server's API at: ``` http://localhost:3040/v1/chat/completions ``` Note that the base URL is `http://localhost:3040/v1`. ### Install with chat web interfaces ✅ You can run third-party chat web interfaces, such as BetterChatGPT and LobeChat, with this API using Docker Compose. [Click here for the installation guide](./docker-compose). ### Your PC/Server To install and run the ChatGPT API Reverse Proxy on your PC/Server by following these steps: Note: This option is not available to all countries yet. if you are from a country that is not supported, you can use a **U.S. VPN** or use **our hosted API**. 1. Ensure NodeJs (v19+) is installed: [Download NodeJs](https://nodejs.org/en/download) 2. Clone this repository: ```bash git clone https://github.com/PawanOsman/ChatGPT.git ``` 3. Open `start.bat` (Windows) or `start.sh` (Linux with `bash start.sh` command) to install dependencies and launch the server. 4. Done, you can connect to your local server's API at: ``` http://localhost:3040/v1/chat/completions ``` Note that the base url will be `http://localhost:3040/v1` To include installation instructions for Termux on Android devices, you can add the following section right after the instructions for Linux in the **Installing/Self-Hosting Guide**: ### Termux on Android Phones To install and run the ChatGPT API Reverse Proxy on Android using Termux, follow these steps: 1. Install [Termux](https://play.google.com/store/apps/details?id=com.termux) from the Play Store. 2. Update Termux packages: ```bash apt update ``` 3. Upgrade Termux packages: ```bash apt upgrade ``` 4. Install git, Node.js, and npm: ```bash apt install -y git nodejs ``` 5. Clone the repository: ```bash git clone https://github.com/PawanOsman/ChatGPT.git ``` 6. Navigate to the cloned directory: ```bash cd ChatGPT ``` 7. Start the server with: ```bash bash start.sh ``` 8. Your local server will now be running and accessible at: ``` http://localhost:3040/v1/chat/completions ``` Note that the base url will be `http://localhost:3040/v1` You can now use this address to connect to your self-hosted ChatGPT API Reverse Proxy from Android applications/websites that support reverse proxy configurations, on the same device. ## Accessing Our Hosted API Utilize our pre-hosted ChatGPT-like API for free by: 1. Joining our [Discord server](https://discord.pawan.krd). 2. Obtaining an API key from the `#Bot` channel with the `/key` command. 3. Incorporating the API key into your requests to: ``` https://api.pawan.krd/v1/chat/completions ``` ## Usage Examples Leverage the same integration code as OpenAI's official libraries by simply adjusting the API key and base URL in your requests. For self-hosted setups, ensure to switch the base URL to your local server's address as mentioned above. ### Example Usage with OpenAI Libraries #### Python Example ```python import openai openai.api_key = 'anything' openai.base_url = "http://localhost:3040/v1/" completion = openai.chat.completions.create( model="gpt-3.5-turbo", messages=[ {"role": "user", "content": "How do I list all files in a directory using Python?"}, ], ) print(completion.choices[0].message.content) ``` #### Node.js Example ```js import OpenAI from 'openai'; const openai = new OpenAI({ apiKey: "anything", baseURL: "http://localhost:3040/v1", }); const chatCompletion = await openai.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-3.5-turbo', }); console.log(chatCompletion.choices[0].message.content); ``` ## License This project is under the AGPL-3.0 License. Refer to the [LICENSE](LICENSE) file for detailed information. ", Assign "at most 3 tags" to the expected json: {"id":"1687","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"