summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-01-29 20:37:59 +0100
committerGitHub <noreply@github.com>2024-01-29 20:37:59 +0100
commit280ddf57b0f54d1805f1ee26aa699469019e731f (patch)
treecabcbf5fa9a5dbf75a223377dbf032cfeb3e1027 /README.md
parentMerge pull request #1523 from u66u/which-webdriver (diff)
parentImprove readme / unittests (diff)
downloadgpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar
gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar.gz
gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar.bz2
gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar.lz
gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar.xz
gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar.zst
gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.zip
Diffstat (limited to 'README.md')
-rw-r--r--README.md59
1 files changed, 56 insertions, 3 deletions
diff --git a/README.md b/README.md
index f82d6adb..288f886f 100644
--- a/README.md
+++ b/README.md
@@ -99,8 +99,33 @@ or set the api base in your client to: [http://localhost:1337/v1](http://localho
##### Install using pypi:
+Install all supported tools / all used packages:
```
-pip install -U "g4f[all]"
+pip install -U g4f[all]
+```
+Install required packages for the OpenaiChat provider:
+```
+pip install -U g4f[openai]
+```
+Install required packages for the interference api:
+```
+pip install -U g4f[api]
+```
+Install required packages for the web interface:
+```
+pip install -U g4f[gui]
+```
+Install required packages for uploading / generating images:
+```
+pip install -U g4f[image]
+```
+Install required packages for providers with webdriver:
+```
+pip install -U g4f[webdriver]
+```
+Install required packages for proxy support:
+```
+pip install -U aiohttp_socks
```
##### or:
@@ -202,8 +227,9 @@ docker-compose down
### The Web UI
-To use it in the web interface, type the following codes in the command line.
-```python3
+To start the web interface, type the following codes in the command line.
+
+```python
from g4f.gui import run_gui
run_gui()
```
@@ -283,6 +309,33 @@ for message in response:
print(message)
```
+##### Cookies / Access Token
+
+For generating images with Bing and for the OpenAi Chat you need cookies or a token from your browser session. From Bing you need the "_U" cookie and from OpenAI you need the "access_token". You can pass the cookies / the access token in the create function or you use the `set_cookies` setter:
+
+```python
+from g4f import set_cookies
+
+set_cookies(".bing", {
+ "_U": "cookie value"
+})
+set_cookies("chat.openai.com", {
+ "access_token": "token value"
+})
+
+from g4f.gui import run_gui
+run_gui()
+```
+
+Alternatively, g4f reads the cookies with “browser_cookie3” from your browser
+or it starts a browser instance with selenium "webdriver" for logging in.
+If you use the pip package, you have to install “browser_cookie3” or "webdriver" by yourself.
+
+```bash
+pip install browser_cookie3
+pip install g4f[webdriver]
+```
+
##### Using Browser
Some providers using a browser to bypass the bot protection. They using the selenium webdriver to control the browser. The browser settings and the login data are saved in a custom directory. If the headless mode is enabled, the browser windows are loaded invisibly. For performance reasons, it is recommended to reuse the browser instances and close them yourself at the end: