diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-03-26 21:50:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-26 21:50:35 +0100 |
commit | dd08125bb4740ab5dc1116868ff237ce51ae3d5e (patch) | |
tree | ed6339c66505409e7dced6d3499814b00446ff12 /README.md | |
parent | Merge pull request #1754 from hlohaus/goo (diff) | |
parent | Fix load .har files, add hardir to docker, add docs (diff) | |
download | gpt4free-0.2.7.1.tar gpt4free-0.2.7.1.tar.gz gpt4free-0.2.7.1.tar.bz2 gpt4free-0.2.7.1.tar.lz gpt4free-0.2.7.1.tar.xz gpt4free-0.2.7.1.tar.zst gpt4free-0.2.7.1.zip |
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 35 |
1 files changed, 25 insertions, 10 deletions
@@ -89,7 +89,7 @@ As per the survey, here is a list of improvements to come ```sh docker pull hlohaus789/g4f -docker run -p 8080:8080 -p 1337:1337 -p 7900:7900 --shm-size="2g" hlohaus789/g4f:latest +docker run -p 8080:8080 -p 1337:1337 -p 7900:7900 --shm-size="2g" -v ${PWD}/hardir:/app/hardir hlohaus789/g4f:latest ``` 3. Open the included client on: [http://localhost:8080/chat/](http://localhost:8080/chat/) or set the API base in your client to: [http://localhost:1337/v1](http://localhost:1337/v1) @@ -218,9 +218,12 @@ See: [/docs/interference](/docs/interference.md) ### Configuration -##### Cookies / Access Token +#### Cookies -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 before you run G4F: +You need cookies for BingCreateImages and the Gemini Provider. +From Bing you need the "_U" cookie and from Gemini you need the "__Secure-1PSID" cookie. +Sometimes you doesn't need the "__Secure-1PSID" cookie, but some other auth cookies. +You can pass the cookies in the create function or you use the `set_cookies` setter before you run G4F: ```python from g4f.cookies import set_cookies @@ -228,20 +231,32 @@ from g4f.cookies import set_cookies set_cookies(".bing.com", { "_U": "cookie value" }) -set_cookies("chat.openai.com", { - "access_token": "token value" -}) set_cookies(".google.com", { "__Secure-1PSID": "cookie value" }) - ... ``` -Alternatively, G4F reads the cookies with `browser_cookie3` from your browser -or it starts a browser instance with selenium `webdriver` for logging in. +#### .HAR File for OpenaiChat Provider + +##### Generating a .HAR File + +To utilize the OpenaiChat provider, a .har file is required from https://chat.openai.com/. Follow the steps below to create a valid .har file: + +1. Navigate to https://chat.openai.com/ using your preferred web browser and log in with your credentials. +2. Access the Developer Tools in your browser. This can typically be done by right-clicking the page and selecting "Inspect," or by pressing F12 or Ctrl+Shift+I (Cmd+Option+I on a Mac). +3. With the Developer Tools open, switch to the "Network" tab. +4. Reload the website to capture the loading process within the Network tab. +5. Initiate an action in the chat which can be capture in the .har file. +6. Right-click any of the network activities listed and select "Save all as HAR with content" to export the .har file. + +##### Storing the .HAR File + +- Place the exported .har file in the `./hardir` directory if you are using Docker. Alternatively, you can store it in any preferred location within your current working directory. + +Note: Ensure that your .har file is stored securely, as it may contain sensitive information. -##### Using Proxy +#### Using Proxy If you want to hide or change your IP address for the providers, you can set a proxy globally via an environment variable: |