{"id":18340120,"url":"https://github.com/f33rni/llm-api-open","last_synced_at":"2025-06-26T20:38:26.592Z","repository":{"id":225585117,"uuid":"766276183","full_name":"F33RNI/LlM-Api-Open","owner":"F33RNI","description":"Unofficial open APIs for popular LLMs (currently for ChatGPT and MS Copilot) with self-hosted redirect capability","archived":false,"fork":false,"pushed_at":"2024-05-24T04:03:30.000Z","size":902,"stargazers_count":36,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-21T07:16:23.187Z","etag":null,"topics":["api","bing-ai","browser-automation","chatgpt","chrome","copilot","hacked","microsoft","open-source","proxy","proxy-server","reverse-engineering","selenium","telegram","unofficial"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/F33RNI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-02T20:14:11.000Z","updated_at":"2025-03-13T17:15:49.000Z","dependencies_parsed_at":"2024-04-09T22:49:27.569Z","dependency_job_id":"01e027f0-079b-48a4-a229-004abfd06837","html_url":"https://github.com/F33RNI/LlM-Api-Open","commit_stats":null,"previous_names":["f33rni/llm-api-open"],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/F33RNI/LlM-Api-Open","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F33RNI%2FLlM-Api-Open","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F33RNI%2FLlM-Api-Open/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F33RNI%2FLlM-Api-Open/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F33RNI%2FLlM-Api-Open/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/F33RNI","download_url":"https://codeload.github.com/F33RNI/LlM-Api-Open/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F33RNI%2FLlM-Api-Open/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262142358,"owners_count":23265722,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","bing-ai","browser-automation","chatgpt","chrome","copilot","hacked","microsoft","open-source","proxy","proxy-server","reverse-engineering","selenium","telegram","unofficial"],"created_at":"2024-11-05T20:21:03.373Z","updated_at":"2025-06-26T20:38:26.514Z","avatar_url":"https://github.com/F33RNI.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🕊️ LLM-API-Open (LMAO)\n\n| \u003cimg src=\"https://github.com/F33RNI/LlM-Api-Open/blob/main/brandbook/Logo.png?raw=true\" height=\"auto\" width=\"128\" alt=\"LLM-API-Open logo\"\u003e | \u003ch3\u003eUnofficial open APIs for popular LLMs with self-hosted redirect capability\u003c/h3\u003e |\n| ------------------------------------------------------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------------------: |\n\n----------\n\n## ❓ WAT\n\n\u003e 🕊️ LLM-API-Open (LMAO) allows for the free and universal utilization of popular Large Language Models (LLM).\n\u003e This is achieved using browser automation. LLM-API-Open (LMAO) launches a browser in headless mode and controls a website as if a real user were using it.\n\u003e This enables the use of popular LLMs that usually don't offer easy and free access to their official APIs\n\u003e\n\u003e 🔥 Additionally, LLM-API-Open (LMAO) is capable of creating its **own API server** to which any other apps can send requests.\n\u003e In other words, you can utilize LLM-API-Open (LMAO) both as a **Python package** and as an **API proxy** for any of your apps!\n\n----------\n\n## 🚧 LLM-API-Open is development\n\n\u003e Due to my studies, I don't have much time to work on the project 😔\n\u003e\n\u003e Currently, LLM-API-Open has only **2** modules: **ChatGPT** and **Microsoft Copilot**\n\u003e\n\u003e 📈 But it is possible to add other popular online LLMs *(You can wait, or make a pull-request yourself)*\n\u003e\n\u003e 📄 Documentation is also under development! Consider reading docstring for now\n\n----------\n\n## 😋 Support project\n\n- BTC: `bc1qd2j53p9nplxcx4uyrv322t3mg0t93pz6m5lnft`\n- ETH: `0x284E6121362ea1C69528eDEdc309fC8b90fA5578`\n- ZEC: `t1Jb5tH61zcSTy2QyfsxftUEWHikdSYpPoz`\n\n- Or by my music on [🟦 bandcamp](https://f3rni.bandcamp.com/)\n\n----------\n\n## 🏗️ Getting started\n\n\u003e ⚠️ Will not work with Python **3.13** or later due to `imghdr`\n\n### ⚙️ 1. Download / build / install LLM-API-Open\n\nThere is 4 general ways to get LLM-API-Open\n\n#### ⚙️ Install via `pip`\n\n- Install from PyPi\n\n    ```shell\n    pip install llm-api-open\n    ```\n\n- **Or** install from GitHub directly\n\n    ```shell\n    pip install git+https://github.com/F33RNI/LLM-API-Open.git\n    ```\n\n- **Or** clone repo and install\n\n    ```shell\n    git clone https://github.com/F33RNI/LLM-API-Open.git\n    cd LLM-API-Open\n\n    python -m venv venv\n    source venv/bin/activate\n\n    pip install .\n    ```\n\n#### ⬇️ Download cli version from **releases**\n\n\u003chttps://github.com/F33RNI/LLM-API-Open/releases/latest\u003e\n\n#### 🔨 Build cli version from source using PyInstaller\n\n```shell\ngit clone https://github.com/F33RNI/LLM-API-Open.git\ncd LLM-API-Open\n\npython -m venv venv\nsource venv/bin/activate\npip install -r requirements.txt\n\npyinstaller lmao.spec\n\ndist/lmao --help\n```\n\n#### 💻 Use source as is\n\n```shell\ngit clone https://github.com/F33RNI/LLM-API-Open.git\ncd LLM-API-Open\n\npython -m venv venv\nsource venv/bin/activate\npip install -r requirements.txt\n\nexport PYTHONPATH=./src:$PYTHONPATH\nexport PYTHONPATH=./src/lmao:$PYTHONPATH\npython -m main --help\n```\n\n### 🔧 2. Configure LLM-API-Open\n\n1. Download `configs` directory from this repo\n2. Open `.json` files of modules you need in any editor and change it as you need\n3. Specify path to `configs` directory with `-c path/to/configs` argument\n\n----------\n\n## 📦 Python package example\n\n```python\nimport logging\nimport json\n\nfrom lmao.module_wrapper import ModuleWrapper\n\n# Initialize logging in a simplest way\nlogging.basicConfig(level=logging.INFO)\n\n# Load config\nwith open(\"path/to/configs/chatgpt.json\", \"r\", encoding=\"utf-8\") as file:\n    module_config = json.loads(file.read())\n\n# Initialize module\nmodule = ModuleWrapper(\"chatgpt\", module_config)\nmodule.initialize(blocking=True)\n\n# Ask smth\nconversation_id = None\nfor response in module.ask({\"prompt\": \"Hi! Who are you?\", \"convert_to_markdown\": True}):\n    conversation_id = response.get(\"conversation_id\")\n    response_text = response.get(\"response\")\n    print(response_text, end=\"\\n\\n\")\n\n# Delete conversation\nmodule.delete_conversation({\"conversation_id\": conversation_id})\n\n# Close (unload) module\nmodule.close(blocking=True)\n```\n\n----------\n\n## 💻 CLI example\n\n```text\n$ lmao --help        \nusage: lmao [-h] [-v] [-c CONFIGS] [-t TEST] [-i IP] [-p PORT] [-s SSL [SSL ...]] [--tokens-use TOKENS_USE [TOKENS_USE ...]]\n            [--tokens-manage TOKENS_MANAGE [TOKENS_MANAGE ...]] [--rate-limits-default RATE_LIMITS_DEFAULT [RATE_LIMITS_DEFAULT ...]] [--rate-limit-fast RATE_LIMIT_FAST]\n            [--no-logging-init]\n\nUnofficial open APIs for popular LLMs with self-hosted redirect capability\n\noptions:\n  -h, --help            show this help message and exit\n  -v, --version         show program's version number and exit\n  -c CONFIGS, --configs CONFIGS\n                        path to configs directory with each module config file (Default: configs)\n  -t TEST, --test TEST  module name to test in cli instead of starting API server (eg. --test=chatgpt)\n  -i IP, --ip IP        API server Host (IP) (Default: localhost)\n  -p PORT, --port PORT  API server port (Default: 1312)\n  -s SSL [SSL ...], --ssl SSL [SSL ...]\n                        Paths to SSL certificate and private key (ex. --ssl \"path/to/certificate.crt\" \"path/to/private.key\")\n  --tokens-use TOKENS_USE [TOKENS_USE ...]\n                        API tokens to enable authorization for /status, /ask, /stop and /delete (ex. --tokens-use \"tokenForMyApp\" \"tokenForMyAnotherApp\"\n                        \"ultraPrivateTokeeeeeen\")\n  --tokens-manage TOKENS_MANAGE [TOKENS_MANAGE ...]\n                        API tokens to enable authorization for /init and /close (ex. --tokens-manage \"ultraPrivateTokeeeeeen\")\n  --rate-limits-default RATE_LIMITS_DEFAULT [RATE_LIMITS_DEFAULT ...]\n                        Rate limits for all API requests except /stop (Default: --rate-limits-default \"10/minute\", \"1/second\")\n  --rate-limit-fast RATE_LIMIT_FAST\n                        Rate limit /stop API request (Default: \"1/second\")\n  --no-logging-init     specify to bypass logging initialization (will be set automatically when using --test)\n\nexamples:\n  lmao --test=chatgpt\n  lmao --ip=\"0.0.0.0\" --port=1312\n  lmao --ip=\"0.0.0.0\" --port=1312 --no-logging-init\n  lmao --ip \"0.0.0.0\" --port=1312 --ssl certificate.crt private.key --tokens-use \"tokenForMyApp\" \"tokenForMyAnotherApp\" \"ultraPrivateTokeeeeeen\" --tokens-manage \"ultraPrivateTokeeeeeen\"\n```\n\n```shell\n$ lmao --test=chatgpt\nWARNING:root:Error adding cookie oai-did\nWARNING:root:Error adding cookie ajs_anonymous_id\nWARNING:root:Error adding cookie oai-allow-ne\nUser \u003e Hi!    \nchatgpt \u003e Hello! How can I assist you today?\n```\n\n----------\n\n## 🌐 API example\n\n### Start server\n\n\u003e Please see `🔒 HTTPS server and token-based authorization` section for more info about HTTPS server and tokens\n\n```shell\n$ lmao --configs \"configs\" --ip \"0.0.0.0\" --port \"1312\" \n2024-03-30 23:14:50 INFO     Logging setup is complete\n2024-03-30 23:14:50 INFO     Loading config files from configs directory\n2024-03-30 23:14:50 INFO     Adding config of ms_copilot module\n2024-03-30 23:14:50 INFO     Adding config of chatgpt module\n * Serving Flask app 'lmao.external_api'\n * Debug mode: off\n2024-03-30 23:14:50 INFO     WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.\n * Running on all addresses (0.0.0.0)\n * Running on http://127.0.0.1:1312\n * Running on http://192.168.0.3:1312\n2024-03-30 23:14:50 INFO     Press CTRL+C to quit\n...\n```\n\n#### 🐍 Python (requests)\n\n```python\nimport logging\nimport time\nfrom typing import Dict\n\nimport requests\n\n# API URL\nBASE_URL = \"http://localhost:1312/api\"\n\n# Timeout for each request\nTIMEOUT = 60\n\n# Initialize logging in a simplest way\nlogging.basicConfig(level=logging.INFO)\n\n\ndef post(endpoint: str, data: Dict):\n    \"\"\"POST request wrapper\"\"\"\n    response_ = requests.post(f\"{BASE_URL}/{endpoint}\", json=data, timeout=TIMEOUT, stream=endpoint == \"ask\")\n    if endpoint != \"ask\":\n        try:\n            logging.info(f\"{endpoint.capitalize()} Response: {response_.status_code}. Data: {response_.json()}\")\n        except Exception:\n            logging.info(f\"{endpoint.capitalize()} Response: {response_.status_code}\")\n    else:\n        logging.info(f\"{endpoint.capitalize()} Response: {response_.status_code}\")\n    return response_\n\n\ndef get(endpoint: str):\n    \"\"\"GET request wrapper\"\"\"\n    response_ = requests.get(f\"{BASE_URL}/{endpoint}\", timeout=TIMEOUT)\n    logging.info(f\"{endpoint.capitalize()} Response: {response_.status_code}. Data: {response_.json()}\")\n    return response_\n\n\n# Initialize module\nresponse = post(\"init\", {\"module\": \"chatgpt\"})\n\n# Read module's status and wait until it's initialized (in Idle)\nlogging.info(\"Waiting for module initialization\")\nwhile True:\n    response = get(\"status\")\n    chatgpt_status_code = response.json()[0].get(\"status_code\")\n    if chatgpt_status_code == 2:\n        break\n    time.sleep(1)\n\n# Ask and read stream response\nresponse = post(\"ask\", {\"chatgpt\": {\"prompt\": \"Hi! Please write a long text about AI\", \"convert_to_markdown\": True}})\nlogging.info(\"Stream Response:\")\nfor line in response.iter_lines():\n    if line:\n        logging.info(line.decode(\"utf-8\"))\n\n# Delete last conversation\nresponse = post(\"delete\", {\"chatgpt\": {\"conversation_id\": \"\"}})\n\n# Close module (uninitialize it)\nresponse = post(\"close\", {\"module\": \"chatgpt\"})\n```\n\n#### 🌐 CURL\n\nFor CURL examples please read `📄 API docs` section\n\n----------\n\n## 📄 API docs\n\n\u003e ⚠️ Documentation is still under development!\n\n### 🌐 Module initialization `/api/init`\n\nBegins module initialization (in a separate, non-blocking thread)\n\n\u003e Please call `/api/status` to check if the module is initialized **BEFORE** calling `/api/init`.\n\u003e\n\u003e After calling `/api/init`, please call `/api/status` to **check if the module's initialization finished.**\n\n**Request (POST):**\n\n\u003e Maximum content length: `100 bytes`. Default rate limits: `10/minute`, `1/second`\n\n- Without authorization\n\n    ```json\n    {\n        \"module\": \"name of module from MODULES\"\n    }\n    ```\n\n- With authorization\n\n    \u003e Please see `🔒 HTTPS server and token-based authorization` section for more info\n\n    ```json\n    {\n        \"module\": \"name of module from MODULES\",\n        \"token\": \"YourStrongRandomToken from --tokens-manage argument\"\n    }\n    ```\n\n**Returns:**\n\n- ✔️ If everything is ok: status code `200` and `{}` body\n- ❌ Error codes `429`, `401` or `413` in case of rate limit, wrong token or too large request\n- ❌ In case of other error: status code `400` or `500` and `{\"error\": \"Error message\"}` body\n\n**Example:**\n\n```shell\n$ curl --request POST --header \"Content-Type: application/json\" --data '{\"module\": \"chatgpt\"}' http://localhost:1312/api/init\n{}\n```\n\n----------\n\n### 🌐 Status `/api/status`\n\nRetrieves the current status of all modules\n\n**Request (POST):**\n\n\u003e Maximum content length: `100 bytes`. No rate limit\n\n- Without authorization\n\n    ```json\n    {}\n    ```\n\n- With authorization\n\n    \u003e Please see `🔒 HTTPS server and token-based authorization` section for more info\n\n    ```json\n    {\n        \"token\": \"YourStrongRandomToken from --tokens-use argument\"\n    }\n    ```\n\n**Returns:**\n\n- ✔️ If no errors during modules iteration: status code `200` and\n\n```json\n[\n    {\n        \"module\": \"Name of the module from MODULES\",\n        \"status_code\": \"Module's status code as an integer\",\n        \"status_name\": \"Module's status as a string\",\n        \"error\": \"Empty or module's error message\"\n    },\n]\n```\n\n- ❌ Error codes `429`, `401` or `413` in case of rate limit, wrong token or too large request\n- ❌ In case of an modules iteration error: status code `500` and `{\"error\": \"Error message\"}` body\n\n**Example:**\n\n```shell\n$ curl --request POST --header \"Content-Type: application/json\" --data '{}' http://localhost:1312/api/status\n[{\"error\":\"\",\"module\":\"chatgpt\",\"status_code\":2,\"status_name\":\"Idle\"}]\n```\n\n----------\n\n### 🌐 Send request and get stream response `/api/ask`\n\nInitiates a request to the specified module and streams responses back (if `no_stream` is `false` or not specified)\n\n\u003e Please call `/api/status` to check if the module is initialized and not busy **BEFORE** calling `/api/ask`\n\u003e\n\u003e To stop the stream / response, please call `/api/stop`\n\n**Request (POST):**\n\n\u003e Maximum content length: `100 bytes`. Default rate limits: `10/minute`, `1/second`\n\n- Without authorization\n\n    \u003e For **ChatGPT**:\n\n    ```text\n    {\n        \"chatgpt\": {\n            \"prompt\": \"Text request to send to the module\",\n            \"conversation_id\": \"Optional conversation ID (to continue existing chat) or empty for a new conversation\",\n            \"convert_to_markdown\": true or false //(Optional flag for converting response to Markdown)\n        },\n        \"no_stream\": true if you need to receive only the last response\n    }\n    ```\n\n    \u003e For **Microsoft Copilot**:\n\n    ```text\n    {\n        \"ms_copilot\": {\n            \"prompt\": \"Text request\",\n            \"image\": image as base64 to include into request,\n            \"conversation_id\": \"empty string or existing conversation ID\",\n            \"style\": \"creative\" / \"balanced\" / \"precise\",\n            \"convert_to_markdown\": True or False\n        },\n        \"no_stream\": true if you need to receive only the last response\n    }\n    ```\n\n- With authorization\n\n    \u003e Please see `🔒 HTTPS server and token-based authorization` section for more info\n\n    \u003e For **ChatGPT**:\n\n    ```text\n    {\n        \"chatgpt\": {\n            \"prompt\": \"Text request to send to the module\",\n            \"conversation_id\": \"Optional conversation ID (to continue existing chat) or empty for a new conversation\",\n            \"convert_to_markdown\": true or false //(Optional flag for converting response to Markdown)\n        },\n        \"token\": \"YourStrongRandomToken from --tokens-use argument\",\n        \"no_stream\": true if you need to receive only the last response\n    }\n    ```\n\n    \u003e For **Microsoft Copilot**:\n\n    ```text\n    {\n        \"ms_copilot\": {\n            \"prompt\": \"Text request\",\n            \"image\": image as base64 to include into request,\n            \"conversation_id\": \"empty string or existing conversation ID\",\n            \"style\": \"creative\" / \"balanced\" / \"precise\",\n            \"convert_to_markdown\": True or False\n        },\n        \"token\": \"YourStrongRandomToken from --tokens-use argument\",\n        \"no_stream\": true if you need to receive only the last response\n    }\n    ```\n\n**Yields (or Returns if `\"no_stream\"` is specified):**\n\n- ✔️ A stream of JSON objects containing module responses\n\n\u003e For **ChatGPT**, each JSON object has the following structure:\n\n```text\n{\n    \"finished\": \"True if it's the last response, False if not\",\n    \"message_id\": \"ID of the current message (from assistant)\",\n    \"response\": \"Actual response as text\"\n}\n```\n\n\u003e For **Microsoft Copilot**, each JSON object has the following structure:\n\n```text\n{\n    \"finished\": True if it's the last response, False if not,\n    \"response\": \"response as text (or meta response)\",\n    \"images\": [\"array of image URL's\"],\n    \"caption\": \"images caption\",\n    \"attributions\": [\n        {\n            \"name\": \"name of attribution\",\n            \"url\": \"URL of attribution\"\n        },\n        ...\n    ],\n    \"suggestions\": [\"array of suggestions of the requests\"]\n}\n```\n\n**Returns:**\n\n- ❌ Error codes `429`, `401` or `413` in case of rate limit, wrong token or too large request\n- ❌ In case of error: status code `500` and `{\"error\": \"Error message\"}` body\n\n**Example:**\n\n```shell\n$ curl --request POST --header \"Content-Type: application/json\" --data '{\"chatgpt\": {\"prompt\": \"Hi! Who are you?\", \"convert_to_markdown\": true}}' http://localhost:1312/api/ask\n{\"finished\": false, \"conversation_id\": \"1033be5b-d37d-46b3-b47c-9548da5b192c\", \"message_id\": \"00d9cc0d-c4d9-484d-a8e5-9c78eaf2a0e1\", \"response\": \"Hello! I'm ChatGPT, an AI developed by O\"}\n...\n{\"finished\": true, \"conversation_id\": \"1033be5b-d37d-46b3-b47c-9548da5b192c\", \"message_id\": \"00d9cc0d-c4d9-484d-a8e5-9c78eaf2a0e1\", \"response\": \"Hello! I'm ChatGPT, an AI developed by OpenAI. I'm here to help answer your questions, engage in conversation, provide information, or assist you with anything else you might need. How can I assist you today?\"}\n```\n\n----------\n\n### 🌐 Stop stream response `/api/stop`\n\nStops the specified module's streaming response (stops yielding from `/api/ask`)\n\n**Request (POST):**\n\n\u003e Maximum content length: `100 bytes`. Default rate limits: `1/second`\n\n- Without authorization\n\n    ```json\n    {\n        \"module\": \"Name of the module from MODULES\"\n    }\n    ```\n\n- With authorization\n\n    \u003e Please see `🔒 HTTPS server and token-based authorization` section for more info\n\n    ```json\n    {\n        \"module\": \"Name of the module from MODULES\",\n        \"token\": \"YourStrongRandomToken from --tokens-use argument\"\n    }\n    ```\n\n**Returns:**\n\n- ✔️ If the stream stopped successfully: status code `200` and `{}` body\n- ❌ Error codes `429`, `401` or `413` in case of rate limit, wrong token or too large request\n- ❌ In case of an error: status code `400` or `500` and `{\"error\": \"Error message\"}` body\n\n**Example:**\n\n```shell\n$ curl --request POST --header \"Content-Type: application/json\" --data '{\"module\": \"chatgpt\"}' http://localhost:1312/api/stop\n{}\n```\n\n----------\n\n### 🌐 Delete conversation `/api/delete`\n\nClears the module's conversation history\n\n\u003e Please call `/api/status` to check if the module is initialized and not busy **BEFORE** calling `/api/delete`\n\n**Request (POST):**\n\n\u003e Maximum content length: `500 bytes`. Default rate limits: `10/minute`, `1/second`\n\n- Without authorization\n\n    \u003e For **ChatGPT**:\n\n    ```json\n    {\n        \"chatgpt\": {\n            \"conversation_id\": \"ID of conversation to delete or empty to delete the top one\"\n        }\n    }\n    ```\n\n    \u003e For **Microsoft Copilot**:\n\n    ```json\n    {\n        \"ms_copilot\": {\n            \"conversation_id\": \"ID of conversation to delete or empty to delete the top one\"\n        }\n    }\n    ```\n\n- With authorization\n\n    \u003e Please see `🔒 HTTPS server and token-based authorization` section for more info\n\n    \u003e For **ChatGPT**:\n\n    ```json\n    {\n        \"chatgpt\": {\n            \"conversation_id\": \"ID of conversation to delete or empty to delete the top one\"\n        },\n        \"token\": \"YourStrongRandomToken from --tokens-use argument\"\n    }\n    ```\n\n    \u003e For **Microsoft Copilot**:\n\n    ```json\n    {\n        \"ms_copilot\": {\n            \"conversation_id\": \"ID of conversation to delete or empty to delete the top one\"\n        },\n        \"token\": \"YourStrongRandomToken from --tokens-use argument\"\n    }\n    ```\n\n**Returns:**\n\n- ✔️ If conversation deleted successfully: status code `200` and `{}` body\n- ❌ Error codes `429`, `401` or `413` in case of rate limit, wrong token or too large request\n- ❌ In case of an error: status code `400` or `500` and `{\"error\": \"Error message\"}` body\n\n**Example:**\n\n```shell\n$ curl --request POST --header \"Content-Type: application/json\" --data '{\"chatgpt\": {\"conversation_id\": \"1033be5b-d37d-46b3-b47c-9548da5b192c\"}}' http://localhost:1312/api/delete\n{}\n```\n\n----------\n\n### 🌐 Close module `/api/close`\n\nRequests the module's session to close (in a separate, non-blocking thread)\n\n\u003e Please call `/api/status` to check if the module is initialized and its status is Idle or Failed **BEFORE** calling `/api/close`\n\u003e\n\u003e After calling `/api/close`, please call `/api/status` to **check if the module's closing finished**\n\n**Request (POST):**\n\n\u003e Maximum content length: `500 bytes`. Default rate limits: `10/minute`, `1/second`\n\n- Without authorization\n\n    ```json\n    {\n        \"module\": \"Name of the module from MODULES\"\n    }\n    ```\n\n- With authorization\n\n    \u003e Please see `🔒 HTTPS server and token-based authorization` section for more info\n\n    ```json\n    {\n        \"module\": \"Name of the module from MODULES\",\n        \"token\": \"YourStrongRandomToken from --tokens-manage argument\"\n    }\n    ```\n\n**Returns:**\n\n- ✔️ If requested successfully: status code `200` and `{}` body\n- ❌ Error codes `429`, `401` or `413` in case of rate limit, wrong token or too large request\n- ❌ In case of an error: status code `400` or `500` and `{\"error\": \"Error message\"}` body\n\n----------\n\n## 🔒 HTTPS server and token-based authorization\n\n\u003e ⚠️ Better use proper SSL service and redirect to local port\n\u003e\n\u003e ⚠️ Don't use token-based authorization with bare HTTP (without any SSL). It's not safe!\n\nIt's possible to start SSL (HTTPS) server instead of HTTP. For that, provide `--ssl` argument with path to certificate file and path to private key file.\n\nExample:\n\n```shell\n$ lmao --configs \"configs\" --ip \"0.0.0.0\" --port \"1312\" --ssl certificate.crt private.key\n2024-04-19 02:09:10 INFO     Logging setup is complete\n2024-04-19 02:09:10 INFO     Loading config files from configs directory\n2024-04-19 02:09:10 INFO     Adding config of ms_copilot module\n2024-04-19 02:09:10 INFO     Adding config of chatgpt module\n2024-04-19 02:09:10 WARNING  No tokens provided. Everyone can use API\n2024-04-19 02:09:10 INFO     Rate limits for all API requests except /status and /stop: 10/minute, 1/second\n2024-04-19 02:09:10 INFO     Rate limits /status and /stop API requests: 1/second\n * Serving Flask app 'lmao.external_api'\n * Debug mode: off\n2024-04-19 02:09:10 INFO     WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.\n * Running on all addresses (0.0.0.0)\n * Running on https://127.0.0.1:1312\n * Running on https://192.168.0.3:1312\n2024-04-19 02:09:10 INFO     Press CTRL+C to quit\n...\n```\n\nAlso you can enable token-based authorization. For that, provide `--tokens-use` argument with a list of some strong random tokens. Requests that provided these tokens can access `/status`, `/ask`, `/stop` and `/delete`. For `/init` and `/stop`, provide `--tokens-manage` argument with a list of some REALLY strong random tokens\n\n⚠️ Make sure you provided at least one token to `--tokens-manage` if you're using `--tokens-use`. Otherwise **EVERYONE CAN ACCESS** `/init` and `/stop`\n\nExample (tokens for `/status`, `/ask`, `/stop` and `/delete`: `naixae3eeNao6suu`, `kahMeixoo9un9OhR`. Token for `/init` and `/stop`: `ofi2ohRi8maish4x`):\n\n```shell\n$ lmao --configs \"configs\" --ip \"0.0.0.0\" --port \"1312\" --ssl certificate.crt private.key --tokens-use naixae3eeNao6suu kahMeixoo9un9OhR --tokens-manage ofi2ohRi8maish4x\n2024-04-19 02:07:02 INFO     Logging setup is complete\n2024-04-19 02:07:02 INFO     Loading config files from configs directory\n2024-04-19 02:07:02 INFO     Adding config of ms_copilot module\n2024-04-19 02:07:02 INFO     Adding config of chatgpt module\n2024-04-19 02:07:02 INFO     Token-based authorization enabled. Provided 2 tokens-use\n2024-04-19 02:07:02 INFO     Token-based authorization enabled. Provided 1 tokens-manage\n2024-04-19 02:07:02 INFO     Rate limits for all API requests except /status and /stop: 10/minute, 1/second\n2024-04-19 02:07:02 INFO     Rate limits /status and /stop API requests: 1/second\n * Serving Flask app 'lmao.external_api'\n * Debug mode: off\n2024-04-19 02:07:02 INFO     WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.\n * Running on all addresses (0.0.0.0)\n * Running on http://127.0.0.1:1312\n * Running on http://192.168.0.3:1312\n2024-04-19 02:07:02 INFO     Press CTRL+C to quit\n...\n```\n\n----------\n\n## 🐛 How to fix `Failed to establish a new connection` when using multiple modules\n\n1. Open `venv/lib/python3.XX/site-packages/undetected_chromedriver/patcher.py`\n2. Add `import secrets` to the imports\n3. In `def __init__` change `prefix = \"undetected\"` to `prefix = f\"undetected{secrets.token_hex(4)}\"`\n4. Save file and reload LMAO\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff33rni%2Fllm-api-open","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff33rni%2Fllm-api-open","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff33rni%2Fllm-api-open/lists"}