{"id":14039871,"url":"https://github.com/Amm1rr/WebAI-to-API","last_synced_at":"2025-07-27T09:31:42.748Z","repository":{"id":183117809,"uuid":"669611694","full_name":"Amm1rr/WebAI-to-API","owner":"Amm1rr","description":"Claude, Gemini to API : )  (Don't need API KEY)","archived":false,"fork":false,"pushed_at":"2024-06-02T13:03:40.000Z","size":2570,"stargazers_count":242,"open_issues_count":3,"forks_count":43,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-09T13:39:01.374Z","etag":null,"topics":["ai","api","bard","chatbot","chatgpt","chatgpt-api","claude","claude-3","claude-ai","claude-api","development","fastapi","free","gemini","gemini-api","google-bard-api","python","webserver","webservice"],"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/Amm1rr.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":"2023-07-22T21:06:30.000Z","updated_at":"2024-11-06T09:54:39.000Z","dependencies_parsed_at":"2023-12-09T02:30:23.119Z","dependency_job_id":"f53c2f84-f633-46ee-b0c7-ca68d1e374d3","html_url":"https://github.com/Amm1rr/WebAI-to-API","commit_stats":{"total_commits":116,"total_committers":5,"mean_commits":23.2,"dds":0.06034482758620685,"last_synced_commit":"0fbb47a534681aee86b93a2373e05f5aac8d3209"},"previous_names":["amm1rr/ai-assistant-api","amm1rr/free-chatbot-api","amm1rr/webai-to-api"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amm1rr%2FWebAI-to-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amm1rr%2FWebAI-to-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amm1rr%2FWebAI-to-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amm1rr%2FWebAI-to-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Amm1rr","download_url":"https://codeload.github.com/Amm1rr/WebAI-to-API/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227789440,"owners_count":17820204,"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":["ai","api","bard","chatbot","chatgpt","chatgpt-api","claude","claude-3","claude-ai","claude-api","development","fastapi","free","gemini","gemini-api","google-bard-api","python","webserver","webservice"],"created_at":"2024-08-12T05:02:02.864Z","updated_at":"2024-12-02T19:30:41.439Z","avatar_url":"https://github.com/Amm1rr.png","language":"Python","funding_links":[],"categories":["Python","ai"],"sub_categories":[],"readme":"**NOTE:** This is a research project. Please do not use it commercially and use it responsibly.\n\n\u003chr\u003e\n\n# WebAI to API\n\nThis project implements a web API that offers a unified interface to Google Gemini, and Claude 3.\n\n[![Image](assets/WebAI-Configuration-Thumb.jpg)](assets/WebAI-Configuration.jpg)\n\n### Key Features\n\n- **Self-hosted:** Python/FastAPI enables flexibility to run anywhere. Not locked into proprietary platforms.\n\n- **Streaming support:** Real-time responses from Claude streaming.\n\n- **Lightweight and scalable:** Built with FastAPI for high performance.\n\n- **API Key:** No API Key required.\n\n### Status\n\n✅ **_Claude-3_** API integration is also fully implemented and available\n\n✅ **_Google Gemini_** API integration available now\n\n✅ **_UI Configuration_**: Implement routing for [localhost:8000/WebAI](http://localhost:8000/WebAI) path\n\n⚙️ **_PIP_**: In progress\n\n\u003cbr\u003e\n\n[![Image](assets/Endpoints-Docs-Thumb.png)](assets/Endpoints-Docs.png)\n\n\u003cbr\u003e\n\nThis repository is up-to-date.\u003cbr\u003e\nPlease don't forget to give a Star ⭐\n\n\u003cbr\u003e\u003cbr\u003e\n\n\u003chr\u003e\n\n### Prerequisites\n\nPython version \u003e= 3.10\nAccounts on the following (all offer free signups):\n\n- Google Gemini: https://gemini.google.com/\n- Claude: https://claude.ai/\n\nThen, add your token(s) to the [**`Config.conf`**](#configuration) file. (see [**Configuration**](#configuration) section).\n\n\u003cbr\u003e\n\n\u003e [!NOTE]\n\u003e\n\u003e **Note**: [**Claude**](https://claude.ai/) and [**Gemini**](https://gemini.google.com/) offer Auto Login options - you can either log in through your browser and skip this step.\n\n\u003cbr\u003e\n\n## Installation\n\n\u003cbr\u003e\n\n### Step 1. Clone Repository\n\n```bash\ngit clone https://github.com/Amm1rr/WebAI-to-API.git \u0026\u0026 cd WebAI-to-API\n\npython -m venv .venv\n\nsource .venv/bin/activate  # Linux/macOS\n.venv\\Scripts\\activate     # Windows\n\n\npip install -r requirements.txt\n```\n\n\u003cbr\u003e\n\n### Step 2. Start Web Server\n\nNavigate into the **`webai2api`** directory, and run the web server:\n\n```bash\ncd WebAI-to-API/webai2api/\n\npython run.py\n\n```\n\n\u003cbr\u003e\n\nNow the _API documentation_ and _Configuration Web UI_ should be available at the following addresses:\n\n\u003e [!TIP]\n\u003e\n\u003e **Open Web UI Configuration: [http://localhost:8000/WebAI](http://localhost:8000/WebAI)**\n\u003e\n\u003e **Open API documentation: [http://localhost:8000/docs](http://localhost:8000/docs)**\n\n\u003cbr\u003e\n\n### Available **Endpoints:**\n\n\u003e [!NOTE]\n\u003e\n\u003e **Gemini**\n\u003e\n\u003e **http://localhost:8000/gemini**\n\u003e\n\u003e ---\n\u003e\n\u003e **Claude**\n\u003e\n\u003e **http://localhost:8000/claude**\n\u003e\n\u003e ---\n\u003e\n\u003e **Claude/Gemini**\n\u003e\n\u003e **http://localhost:8000/v1/chat/completions**\n\n\u003cbr\u003e\u003cbr\u003e\n\n**Input / Output**\n\n```bash\n# Input:\n_____\n\n    {\n      \"message\": \"Hi, Who are you?\",\n      \"stream\": true\n    }\n\n\n--------------------\n\n\n# Output:\n_____\n\n    {\n      I am a Chatbot assistant :)\n    }\n\n\n--------------------\n\n\n# Response Output:\n_____\n\n# Streaming\n  \"String\"\n\n\n# Not Streaming\n  \"String\"\n\n\n\n```\n\n\u003cbr\u003e\n\u003chr\u003e\n\n## Web UI Development Environment Setup (Optional)\n\n#### Prerequisites:\n\n- [Node.js](http://nodejs.org): Download and install from the official website (https://nodejs.org)\n\nFirst , **Navigate to the UI directory:**\n\n```bash\ncd WebAI-to-API/webai2api/UI\n```\n\n1. **Install dependencies:**\n\n```bash\nnpm install\n```\n\n2. **Build the project:**\n\n```bash\nnpm run build\n```\n\n\u003cbr\u003e\n\n## Example\n\nOnce you have launched the web server using [`python webai2api\\run.py`](#step-2-start-web-server):\n\n\u003e [!NOTE]\n\u003e\n\u003e Note: The first argument to run the example determines whether to return streaming or not.\n\n```bash\ncd examples/\n\n\npython WebAPI-to-API/webai2api/test.py\n\nOR\n\npython example_claude.py false\npython example_claude.py true\n\npython example_gemini.py\n\n\n```\n\nor try **Claude** with **cURL**\n\nrun this cURL command in a terminal window:\n\n```bash\ncurl -X 'POST' \\\n  'http://localhost:8000/claude' \\\n  -H 'accept: application/json' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n  \"message\": \"who are you?\",\n  \"stream\": false\n}'\n\n```\n\n\u003cbr\u003e\n\n\u003e [!NOTE]\n\u003e\n\u003e **Note**: The **`session_id`** is configured in the [**Config.conf**](#configuration) file. If you send this variable empty, it will use the [**Config.conf**](#configuration)\n\n\u003cbr\u003e\n\n## Usage\n\n#### How to find tokens\n\n\u003e [!NOTE]\n\u003e\n\u003e **Note**: [**Claude**](https://claude.ai/) and [**Gemini**](https://gemini.google.com/) offer two authentication options - you can either log in through your browser and skip this step, or you can follow the instructions below to configure the authentication.\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e \"The auto login by browser issue is caused by using multiple accounts or browser profiles. It will take some time to fully resolve. A future update will address it. For now, if you have problems logging in with your browsers, try logging in with just one browser or manually copy sessions and cookies as a workaround, as described in the instructions below.\"\n\n\u003cbr\u003e\n\nThe easiest way is to just log in to the chatbot websites. ([Claude](https://claude.ai/) | [Gemini](https://gemini.google.com/))\n\u003cbr\u003e\n    OR\n\u003cbr\u003e\nFirst you need to add your tokens to the [**`Config.conf`**](#configuration) file (see [**Configuration**](#configuration) section).\n\n\u003cbr\u003e\n\n\u003cdetails\u003e\n\n  \u003csummary\u003e\n\n#### Gemini\n\n  \u003c/summary\u003e\n\n[![Image](assets/Bard-Thumb.jpg)](assets/Bard.jpg)\n\n**Method 1:** \u003cbr\u003e\nFor Gemini, all you need to do is [login](https://gemini.google.com/) to your account using your web browser. (Firefox, Chrome, Safari, Edge...)\n\n**Method 2:** \u003cbr\u003e\n_`Google Gemini:`_ Please obtain the cookies mentioned here from an authorized session on gemini.google.com. The cookies can be used to send POST requests to the /gemini endpoint along with a message in a JSON payload. It is important that the **session_id**, which is your **\\_\\_Secure-1PSID** cookie, and the **session_idts** and **session_idcc**, which is your **Secure-1PSIDTS** and **Secure-1PSIDCC** cookie, are included in the request. ([Screenshot](assets/Bard.jpg))\n\u003cbr\u003e\n\n| Name           | Session Name       |\n|----------------|--------------------|\n| `session_id`   | `__Secure-1PSID`   |\n| `session_idts` | `__Secure-1PSIDTS` |\n| `session_idcc` | `__Secure-1PSIDCC` |\n\n1. Login to [gemini.google.com](https://gemini.google.com)\n2. Open `Developer Tools` (Press **F12**)\n3. Go to `Application Tab`\n4. Go to `Cookies Tab`\n5. Copy the content of `__Secure-1PSID` and `__Secure-1PSIDTS` and `__Secure-1PSIDCC`. Copy the value of those cookie.\n6. Set in **[Config.conf](#configuration)** file.\n\u003c/details\u003e\n\u003cbr\u003e\u003chr\u003e\u003cbr\u003e\n\n\u003cdetails\u003e\n\n  \u003csummary\u003e\n\n#### Claude\n\n  \u003c/summary\u003e\n\n[![Image](assets/Claude-Thumb.jpg)](assets/Claude.jpg)\n\n**Method 1:** \u003cbr\u003e\nFor Claude, all you need to do is [login](https://claude.ai/) to your account using your web browser. (Firefox, Chrome, Safari, Edge...)\n\n**Method 2:** \u003cbr\u003e\n_`Claude:`_ You can get cookie from the browser's developer tools network tab ( see for any [claude.ai](https://claude.ai/) requests check out cookie ,copy whole value ) or storage tab ( You can find cookie of claude.ai ,there will be four values ) ([Screenshot](assets/Claude.jpg))\n\n1. Login to [claude.ai](https://claude.ai/)\n2. Open `Developer Tools` (Press **F12**)\n3. Go to `Network Tab`\n4. Select an ajax request (like step 3 in [picture](assets/Claude.jpg))\n5. Copy the content of `Cookie`\n6. Set in **[Config.conf](#configuration)** file.\n\n\u003c/details\u003e\n\n\u003cbr\u003e\n\n## Configuration\n\n- Open Web UI Panel: **[http://localhost:8000/WebAI](http://localhost:8000/WebAI)**\n\n\u003cbr\u003e\n\nHow to [find tokens](#usage)\n\n- [Google Gemini](#gemini)\n- [Claude](#claude)\n\n\u003e [!NOTE]\n\u003e\n\u003e **Note**: Claude and Gemini present Auto Login options - logging in through your browser or configuring Claude and Gemini using the provided config file.\n\n\u003cbr\u003e\n\n### Configuring the Model Type for `/v1/chat/completions`\n\nYou can specify the model type in the settings for the `/v1/chat/completions` endpoint. The available options are \"Claude\" and \"Gemini\".\nBy default, the system uses the \"Claude\" model.\n\n```bash\n# Case-Sensitive\n\n[Main]\nModel=Claude\n# or\nModel=Gemini\n```\n\n\u003cbr\u003e\n\n#### Config File Path:\n\n- WebAI-to-API\\webai2api\\Config.conf\n\n```bash\n# Case-Sensitive\n\n[Main]\nModel = [Claude] or [Gemini]\n\n[Claude]\nCOOKIE=[YOURS]\n\n[Gemini]\nSESSION_ID=[YOURS]\nSESSION_IDTS=[YOURS]\nSESSION_IDCC=[YOURS]\n\n```\n\n\u003cbr\u003e\n\n## Licensing\n\nThis project is licensed under the MIT License. Feel free to use it however you like.\n\n\u003cbr\u003e\n\n[![](https://visitcount.itsvg.in/api?id=amm1rr\u0026label=V\u0026color=0\u0026icon=2\u0026pretty=true)](https://github.com/Amm1rr/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAmm1rr%2FWebAI-to-API","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAmm1rr%2FWebAI-to-API","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAmm1rr%2FWebAI-to-API/lists"}