yanuuii commited on
Commit
b860e0c
1 Parent(s): 6975f95

Upload 292 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
.gitattributes CHANGED
@@ -1,35 +1,2 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/FUNDING.yml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ ko_fi: xtekky
2
+ github: [xtekky, hlohaus]
3
+ patreon: xtekky
.github/ISSUE_TEMPLATE/default_issue.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: New Issue
3
+ about: 'Please use this template !!'
4
+ title: ''
5
+ labels: bug
6
+ assignees: xtekky
7
+
8
+ ---
9
+
10
+ **Known Issues** // delete this
11
+ - you.com issue / fix: use proxy, or vpn, your country is probably flagged
12
+ - forefront account creation error / use your own session or wait for fix
13
+
14
+
15
+ **Bug description**
16
+ What did you do, what happened, which file did you try to run, in which directory
17
+ Describe what you did after downloading repo, such as moving to this repo, running this file.
18
+
19
+ ex.
20
+ 1. Go to '...'
21
+ 2. Click on '....'
22
+ 3. Scroll down to '....'
23
+ 4. See error
24
+
25
+ **Screenshots**
26
+ If applicable, add screenshots to help explain your problem.
27
+
28
+ **Environment**
29
+ - python version
30
+ - location ( are you in a cloudfare flagged country ) ?
31
+
32
+ **Additional context**
33
+ Add any other context about the problem here.
.github/ISSUE_TEMPLATE/feature_request.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
.github/workflows/close-inactive-issues.yml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Close inactive issues
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "5 0 * * *"
6
+
7
+ jobs:
8
+ close-issues:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ issues: write
12
+ pull-requests: write
13
+ steps:
14
+ - uses: actions/stale@v5
15
+ with:
16
+ days-before-issue-stale: 7
17
+ days-before-issue-close: 7
18
+
19
+ days-before-pr-stale: 7
20
+ days-before-pr-close: 7
21
+
22
+ stale-issue-label: "stale"
23
+ stale-pr-label: "stale"
24
+
25
+ stale-issue-message: "Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again."
26
+ close-issue-message: "Closing due to inactivity."
27
+
28
+ stale-pr-message: "Bumping this pull request because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again."
29
+ close-pr-message: "Closing due to inactivity."
30
+
31
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
.github/workflows/copilot.yml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: AI Code Reviewer
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: ["Unittest"]
6
+ types:
7
+ - completed
8
+
9
+ jobs:
10
+ review:
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: read
14
+ pull-requests: write
15
+ steps:
16
+ - name: Checkout Repo
17
+ uses: actions/checkout@v3
18
+ - name: 'Download artifact'
19
+ uses: actions/github-script@v6
20
+ with:
21
+ script: |
22
+ let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
23
+ owner: context.repo.owner,
24
+ repo: context.repo.repo,
25
+ run_id: context.payload.workflow_run.id,
26
+ });
27
+ let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
28
+ return artifact.name == "pr_number"
29
+ })[0];
30
+ let download = await github.rest.actions.downloadArtifact({
31
+ owner: context.repo.owner,
32
+ repo: context.repo.repo,
33
+ artifact_id: matchArtifact.id,
34
+ archive_format: 'zip',
35
+ });
36
+ let fs = require('fs');
37
+ fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_number.zip`, Buffer.from(download.data));
38
+ - name: 'Unzip artifact'
39
+ run: unzip pr_number.zip
40
+ - name: Setup Python
41
+ uses: actions/setup-python@v4
42
+ with:
43
+ python-version: "3.x"
44
+ cache: 'pip'
45
+ - name: Install Requirements
46
+ run: |
47
+ pip install -r requirements.txt
48
+ pip install PyGithub
49
+ - name: AI Code Review
50
+ env:
51
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52
+ GITHUB_REPOSITORY: ${{ github.repository }}
53
+ run: python -m etc.tool.copilot
.github/workflows/publish-to-pypi.yml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Publish Python 🐍 distribution 📦 to PyPI
2
+
3
+ on: push
4
+
5
+ env:
6
+ G4F_VERSION: ${{ github.ref_name }}
7
+
8
+ jobs:
9
+ build:
10
+ name: Build distribution 📦
11
+ if: startsWith(github.ref, 'refs/tags/')
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - name: Set up Python
16
+ uses: actions/setup-python@v4
17
+ with:
18
+ python-version: "3.x"
19
+ - name: Install pypa/build
20
+ run: >-
21
+ python3 -m
22
+ pip install
23
+ build
24
+ --user
25
+ - name: Build a binary wheel and a source tarball
26
+ run: python3 -m build
27
+ - name: Store the distribution packages
28
+ uses: actions/upload-artifact@v3
29
+ with:
30
+ name: python-package-distributions
31
+ path: dist/
32
+
33
+ publish-to-pypi:
34
+ name: >-
35
+ Publish distribution on PyPI 🐍
36
+ if: startsWith(github.ref, 'refs/tags/')
37
+ needs:
38
+ - build
39
+ runs-on: ubuntu-latest
40
+ environment:
41
+ name: pypi
42
+ url: https://pypi.org/p/g4f
43
+ permissions:
44
+ id-token: write
45
+ steps:
46
+ - name: Download all the dists
47
+ uses: actions/download-artifact@v3
48
+ with:
49
+ name: python-package-distributions
50
+ path: dist/
51
+ - name: Publish distribution 📦 to PyPI
52
+ uses: pypa/gh-action-pypi-publish@release/v1
.github/workflows/publish-workflow.yaml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Publish Docker image
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '**'
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout repository
13
+ uses: actions/checkout@v4
14
+ - name: Set up QEMU
15
+ uses: docker/setup-qemu-action@v3
16
+ - name: Set up Docker Buildx
17
+ uses: docker/setup-buildx-action@v3
18
+
19
+ - name: Get metadata for Docker
20
+ id: metadata
21
+ uses: docker/metadata-action@v5
22
+ with:
23
+ images: |
24
+ hlohaus789/g4f
25
+ ghcr.io/${{ github.repository }}
26
+
27
+ - name: Log in to Docker Hub
28
+ uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
29
+ with:
30
+ username: ${{ secrets.DOCKER_USERNAME }}
31
+ password: ${{ secrets.DOCKER_PASSWORD }}
32
+
33
+ - name: Login to GitHub Container Registry
34
+ uses: docker/login-action@v3
35
+ with:
36
+ registry: ghcr.io
37
+ username: ${{ github.repository_owner }}
38
+ password: ${{ secrets.GHCR_PAT }}
39
+
40
+ - name: Build and push image
41
+ uses: docker/build-push-action@v5
42
+ with:
43
+ context: .
44
+ file: docker/Dockerfile
45
+ platforms: linux/amd64,linux/arm64
46
+ push: true
47
+ tags: ${{ steps.metadata.outputs.tags }}
48
+ labels: ${{ steps.metadata.outputs.labels }}
49
+ build-args: |
50
+ G4F_VERSION=${{ github.ref_name }}
.github/workflows/unittest.yml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Unittest
2
+
3
+ on:
4
+ pull_request:
5
+ types:
6
+ - opened
7
+ - synchronize
8
+ push:
9
+ branches:
10
+ - 'main'
11
+
12
+ jobs:
13
+ build:
14
+ name: Build unittest
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - name: Set up Python 3.8
19
+ uses: actions/setup-python@v4
20
+ with:
21
+ python-version: "3.8"
22
+ cache: 'pip'
23
+ - name: Install min requirements
24
+ run: pip install -r requirements-min.txt
25
+ - name: Run tests
26
+ run: python -m etc.unittest
27
+ - name: Set up Python 3.12
28
+ uses: actions/setup-python@v4
29
+ with:
30
+ python-version: "3.12"
31
+ cache: 'pip'
32
+ - name: Install requirements
33
+ run: |
34
+ pip install -r requirements.txt
35
+ pip uninstall -y nodriver
36
+ - name: Run tests
37
+ run: python -m etc.unittest
38
+ - name: Save PR number
39
+ env:
40
+ PR_NUMBER: ${{ github.event.number }}
41
+ run: |
42
+ mkdir -p ./pr
43
+ echo $PR_NUMBER > ./pr/pr_number
44
+ - uses: actions/upload-artifact@v4
45
+ with:
46
+ name: pr_number
47
+ path: pr/
.gitignore ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
9
+
10
+ # Ignore local python virtual environment
11
+ venv/
12
+
13
+ # Ignore streamlit_chat_app.py conversations pickle
14
+ conversations.pkl
15
+ *.pkl
16
+
17
+ # Ignore accounts created by api's
18
+ accounts.txt
19
+
20
+ .idea/
21
+ **/__pycache__/
22
+ __pycache__/
23
+
24
+ dist/
25
+ *.log
26
+ *.pyc
27
+ *.egg-info/
28
+ *.egg
29
+ *.egg-info
30
+ build
31
+
32
+ test.py
33
+ update.py
34
+ cookie.json
35
+ notes.txt
36
+ close_issues.py
37
+ xxx.py
38
+ lab.py
39
+ lab.js
40
+ bing.py
41
+ bing2.py
42
+ .DS_Store
43
+ lab/*
44
+ lab
45
+ tstt.py
46
+ providerstest.py
47
+ prv.py
48
+ # Emacs crap
49
+ *~
50
+ x.js
51
+ x.py
52
+ info.txt
53
+ local.py
54
+ *.gguf
55
+ image.py
56
+ .buildozer
57
+ hardir
58
+ har_and_cookies
59
+ node_modules
60
+ models
61
+ projects/windows/g4f
62
+ doc.txt
63
+ dist.py
64
+ x.txt
65
+ bench.py
66
+ to-reverse.txt
67
+ g4f/Provider/OpenaiChat2.py
.gitpod.yml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
2
+ # and commit this file to your remote git repository to share the goodness with others.
3
+
4
+ # Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
5
+
6
+ tasks:
7
+ - init: pip install -r requirements.txt
CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ https://t.me/xtekky.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
CONTRIBUTING.md ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <img alt="gpt4free logo" src="https://user-images.githubusercontent.com/98614666/233799515-1a7cb6a3-b17f-42c4-956d-8d2a0664466f.png">
2
+
3
+ ### Please, follow these steps to contribute:
4
+ 1. Reverse a website from this list: [sites-to-reverse](https://github.com/xtekky/gpt4free/issues/40)
5
+ 2. Add it to [./testing](https://github.com/xtekky/gpt4free/tree/main/testing)
6
+ 3. Refractor it and add it to [./g4f](https://github.com/xtekky/gpt4free/tree/main/g4f)
7
+
8
+ ### We will be grateful to see you as a contributor!
LEGAL_NOTICE.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Legal Notice
2
+
3
+ This repository is _not_ associated with or endorsed by providers of the APIs contained in this GitHub repository. This project is intended **for educational purposes only**. This is just a little personal project. Sites may contact me to improve their security or request the removal of their site from this repository.
4
+
5
+ Please note the following:
6
+
7
+ ## Legal Notice
8
+
9
+ ### **Affiliation Disclaimer**
10
+ This repository is not associated with or endorsed by the providers of the APIs contained in this repository. The project is intended for educational purposes only. The APIs, services, trademarks, and other intellectual property mentioned in this repository are the property of their respective owners, with no claim of ownership or affiliation by this project.
11
+
12
+ ### **Liability Limitation**
13
+ Under no circumstances shall the author of this repository be liable for any direct, indirect, incidental, special, consequential, or punitive damages, including but not limited to, loss of profits, data, or use, arising out of or in connection with the repository, regardless of whether such damages were foreseeable and whether the author was advised of the possibility of such damages.
14
+
15
+ ### **No Warranties**
16
+ The repository is provided on an "as is" and "as available" basis without any warranties of any kind, either express or implied, including but not limited to, implied warranties of merchantability, fitness for a particular purpose, or non-infringement.
17
+
18
+ ### **User Responsibility**
19
+ Users assume all risk for their use of this repository and are solely responsible for any damage or loss, including but not limited to financial loss, of any kind, to any party, that results from the use or misuse of the repository and its contents.
20
+
21
+ ### **Legal Compliance**
22
+ Users are responsible for ensuring their use of the repository and its contents complies with all local, state, national, and international laws and regulations.
23
+
24
+ ### **Indemnification**
25
+ Users agree to indemnify, defend, and hold harmless the author from any claims, liabilities, damages, losses, or expenses, including legal fees, arising out of or in any way connected with their use of this repository, violation of these terms, or infringement of any intellectual property or other rights of any person or entity.
26
+
27
+ ### **No Endorsement**
28
+ The inclusion of third-party content does not imply endorsement or recommendation of such content by the author.
29
+
30
+ ### **Governing Law and Jurisdiction**
31
+ Any disputes arising out of or related to the use of this repository shall be governed by the laws of the author's jurisdiction, without regard to its conflict of law principles.
32
+
33
+ ### **Severability**
34
+ If any provision of this notice is found to be unlawful, void, or unenforceable, then that provision shall be deemed severable from this notice and shall not affect the validity and enforceability of any remaining provisions.
35
+
36
+ ### **Acknowledgment of Understanding**
37
+ By using this repository, users acknowledge that they have read, understood, and agree to be bound by these terms.
38
+
39
+ ### **Updates and Changes**
40
+ The author reserves the right to modify, update, or remove any content, information, or features in this repository at any time without prior notice. Users are responsible for regularly reviewing the content and any changes made to this repository.
41
+
42
+ ### **Unforeseen Consequences**
43
+ The author of this repository is not responsible for any consequences, damages, or losses arising from the use or misuse of this repository or the content provided by the third-party APIs. Users are solely responsible for their actions and any repercussions that may follow.
44
+
45
+ ### **Educational Purpose**
46
+ Please note that this project and its content are provided strictly for educational purposes. Users acknowledge that they are using the APIs and models at their own risk and agree to comply with any applicable laws and regulations.
LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <https://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <https://www.gnu.org/licenses/why-not-lgpl.html>.
MANIFEST.in ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ recursive-include g4f/gui/server *
2
+ recursive-include g4f/gui/client *
3
+ recursive-include g4f/Provider/npm *
4
+ recursive-include g4f/Provider/gigachat_crt *
5
+ recursive-include g4f/Provider/you *
README.md CHANGED
@@ -1,11 +1,922 @@
1
- ---
2
- title: Aptrt
3
- emoji: 🦀
4
- colorFrom: green
5
- colorTo: yellow
6
- sdk: docker
7
- pinned: false
8
- license: apache-2.0
9
- ---
10
-
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ![248433934-7886223b-c1d1-4260-82aa-da5741f303bb](https://github.com/xtekky/gpt4free/assets/98614666/ea012c87-76e0-496a-8ac4-e2de090cc6c9)
2
+
3
+ <a href="https://trendshift.io/repositories/1692" target="_blank"><img src="https://trendshift.io/api/badge/repositories/1692" alt="xtekky%2Fgpt4free | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
4
+
5
+ Written by [@xtekky](https://github.com/hlohaus) & maintained by [@hlohaus](https://github.com/hlohaus)
6
+
7
+ <div id="top"></div>
8
+
9
+ > By using this repository or any code related to it, you agree to the [legal notice](LEGAL_NOTICE.md). The author is **not responsible for the usage of this repository nor endorses it**, nor is the author responsible for any copies, forks, re-uploads made by other users, or anything else related to GPT4Free. This is the author's only account and repository. To prevent impersonation or irresponsible actions, please comply with the GNU GPL license this Repository uses.
10
+
11
+ > [!Warning]
12
+ *"gpt4free"* serves as a **PoC** (proof of concept), demonstrating the development of an API package with multi-provider requests, with features like timeouts, load balance and flow control.
13
+
14
+ > [!Note]
15
+ <sup><strong>Lastet version:</strong></sup> [![PyPI version](https://img.shields.io/pypi/v/g4f?color=blue)](https://pypi.org/project/g4f) [![Docker version](https://img.shields.io/docker/v/hlohaus789/g4f?label=docker&color=blue)](https://hub.docker.com/r/hlohaus789/g4f)
16
+ > <sup><strong>Stats:</strong></sup> [![Downloads](https://static.pepy.tech/badge/g4f)](https://pepy.tech/project/g4f) [![Downloads](https://static.pepy.tech/badge/g4f/month)](https://pepy.tech/project/g4f)
17
+
18
+ ```sh
19
+ pip install -U g4f
20
+ ```
21
+ ```sh
22
+ docker pull hlohaus789/g4f
23
+ ```
24
+
25
+ ## 🆕 What's New
26
+
27
+ - Installation Guide for Windows (.exe): 💻 [#installation-guide-for-windows](#installation-guide-for-windows-exe)
28
+ - Join our Telegram Channel: 📨 [telegram.me/g4f_channel](https://telegram.me/g4f_channel)
29
+ - Join our Discord Group: 💬 [discord.gg/XfybzPXPH5](https://discord.gg/XfybzPXPH5)
30
+ - `g4f` now supports 100% local inference: 🧠 [local-docs](https://g4f.mintlify.app/docs/core/usage/local)
31
+
32
+ ## 🔻 Site Takedown
33
+ Is your site on this repository and you want to take it down? Send an email to takedown@g4f.ai with proof it is yours and it will be removed as fast as possible. To prevent reproduction please secure your API. 😉
34
+
35
+ ## 🚀 Feedback and Todo
36
+ You can always leave some feedback here: https://forms.gle/FeWV9RLEedfdkmFN6
37
+
38
+ As per the survey, here is a list of improvements to come
39
+ - [x] Update the repository to include the new openai library syntax (ex: `Openai()` class) | completed, use `g4f.client.Client`
40
+ - [ ] Golang implementation
41
+ - [ ] 🚧 Improve Documentation (in /docs & Guides, Howtos, & Do video tutorials)
42
+ - [x] Improve the provider status list & updates
43
+ - [ ] Tutorials on how to reverse sites to write your own wrapper (PoC only ofc)
44
+ - [x] Improve the Bing wrapper. (Wait and Retry or reuse conversation)
45
+ - [ ] 🚧 Write a standard provider performance test to improve the stability
46
+ - [ ] Potential support and development of local models
47
+ - [ ] 🚧 Improve compatibility and error handling
48
+
49
+ ## 📚 Table of Contents
50
+
51
+ - [🆕 What's New](#-whats-new)
52
+ - [📚 Table of Contents](#-table-of-contents)
53
+ - [🛠️ Getting Started](#-getting-started)
54
+ + [Docker Container Guide](#docker-container-guide)
55
+ + [Installation Guide for Windows (.exe)](#installation-guide-for-windows-exe)
56
+ + [Use python](#use-python)
57
+ - [Prerequisites](#prerequisites)
58
+ - [Install using PyPI package:](#install-using-pypi-package)
59
+ - [Install from source:](#install-from-source)
60
+ - [Install using Docker:](#install-using-docker)
61
+ - [💡 Usage](#-usage)
62
+ * [Text Generation](#text-generation)
63
+ * [Image Generation](#image-generation)
64
+ * [Web UI](#web-ui)
65
+ * [Interference API](#interference-api)
66
+ * [Configuration](#configuration)
67
+ - [🚀 Providers and Models](#-providers-and-models)
68
+ * [GPT-4](#gpt-4)
69
+ * [GPT-3.5](#gpt-35)
70
+ * [Other](#other)
71
+ * [Models](#models)
72
+ - [🔗 Powered by gpt4free](#-powered-by-gpt4free)
73
+ - [🤝 Contribute](#-contribute)
74
+ + [How do i create a new Provider?](#guide-how-do-i-create-a-new-provider)
75
+ + [How can AI help me with writing code?](#guide-how-can-ai-help-me-with-writing-code)
76
+ - [🙌 Contributors](#-contributors)
77
+ - [©️ Copyright](#-copyright)
78
+ - [⭐ Star History](#-star-history)
79
+ - [📄 License](#-license)
80
+
81
+ ## 🛠️ Getting Started
82
+
83
+ #### Docker Container Guide
84
+
85
+ ##### Getting Started Quickly:
86
+
87
+ 1. **Install Docker:** Begin by [downloading and installing Docker](https://docs.docker.com/get-docker/).
88
+
89
+ 2. **Set Up the Container:**
90
+ Use the following commands to pull the latest image and start the container:
91
+
92
+ ```sh
93
+ docker pull hlohaus789/g4f
94
+ docker run -p 8080:8080 -p 1337:1337 -p 7900:7900 --shm-size="2g" -v ${PWD}/har_and_cookies:/app/har_and_cookies hlohaus789/g4f:latest
95
+ ```
96
+
97
+ 3. **Access the Client:**
98
+ - To use the included client, navigate to: [http://localhost:8080/chat/](http://localhost:8080/chat/)
99
+ - Or set the API base for your client to: [http://localhost:1337/v1](http://localhost:1337/v1)
100
+
101
+ 4. **(Optional) Provider Login:**
102
+ If required, you can access the container's desktop here: http://localhost:7900/?autoconnect=1&resize=scale&password=secret for provider login purposes.
103
+
104
+ #### Installation Guide for Windows (.exe)
105
+ To ensure the seamless operation of our application, please follow the instructions below. These steps are designed to guide you through the installation process on Windows operating systems.
106
+ ##### Prerequisites
107
+ 1. **WebView2 Runtime**: Our application requires the *WebView2 Runtime* to be installed on your system. If you do not have it installed, please download and install it from the [Microsoft Developer Website](https://developer.microsoft.com/en-us/microsoft-edge/webview2/). If you already have *WebView2 Runtime* installed but are encountering issues, navigate to *Installed Windows Apps*, select *WebView2*, and opt for the repair option.
108
+ ##### Installation Steps
109
+ 2. **Download the Application**: Visit our [latest releases page](https://github.com/xtekky/gpt4free/releases/latest) and download the most recent version of the application, named `g4f.webview.*.exe`.
110
+ 3. **File Placement**: Once downloaded, transfer the `.exe` file from your downloads folder to a directory of your choice on your system, and then execute it to run the app.
111
+ ##### Post-Installation Adjustment
112
+ 4. **Firewall Configuration (Hotfix)**: Upon installation, it may be necessary to adjust your Windows Firewall settings to allow the application to operate correctly. To do this, access your Windows Firewall settings and allow the application.
113
+
114
+ By following these steps, you should be able to successfully install and run the application on your Windows system. If you encounter any issues during the installation process, please refer to our Issue Tracker or try to get contact over Discord for assistance.
115
+
116
+ Run the **Webview UI** on other Platfroms:
117
+ - [/docs/guides/webview](/docs/webview.md)
118
+
119
+ ##### Use your smartphone:
120
+
121
+ Run the Web UI on Your Smartphone:
122
+ - [/docs/guides/phone](/docs/guides/phone.md)
123
+
124
+ #### Use python
125
+
126
+ ##### Prerequisites:
127
+
128
+ 1. [Download and install Python](https://www.python.org/downloads/) (Version 3.10+ is recommended).
129
+ 2. [Install Google Chrome](https://www.google.com/chrome/) for providers with webdriver
130
+
131
+ ##### Install using PyPI package:
132
+
133
+ ```
134
+ pip install -U g4f[all]
135
+ ```
136
+
137
+ How do I install only parts or do disable parts?
138
+ Use partial requirements: [/docs/requirements](/docs/requirements.md)
139
+
140
+ ##### Install from source:
141
+
142
+ How do I load the project using git and installing the project requirements?
143
+ Read this tutorial and follow it step by step: [/docs/git](/docs/git.md)
144
+
145
+
146
+ ##### Install using Docker:
147
+
148
+ How do I build and run composer image from source?
149
+ Use docker-compose: [/docs/docker](/docs/docker.md)
150
+
151
+
152
+ ## 💡 Usage
153
+
154
+ #### Text Generation
155
+
156
+ ```python
157
+ from g4f.client import Client
158
+
159
+ client = Client()
160
+ response = client.chat.completions.create(
161
+ model="gpt-3.5-turbo",
162
+ messages=[{"role": "user", "content": "Hello"}],
163
+ ...
164
+ )
165
+ print(response.choices[0].message.content)
166
+ ```
167
+
168
+ ```
169
+ Hello! How can I assist you today?
170
+ ```
171
+
172
+ #### Image Generation
173
+
174
+ ```python
175
+ from g4f.client import Client
176
+
177
+ client = Client()
178
+ response = client.images.generate(
179
+ model="gemini",
180
+ prompt="a white siamese cat",
181
+ ...
182
+ )
183
+ image_url = response.data[0].url
184
+ ```
185
+
186
+
187
+ [![Image with cat](/docs/cat.jpeg)](/docs/client.md)
188
+
189
+ **Full Documentation for Python API**
190
+
191
+ - New AsyncClient API from G4F: [/docs/async_client](/docs/async_client.md)
192
+ - Client API like the OpenAI Python library: [/docs/client](/docs/client.md)
193
+ - Legacy API with python modules: [/docs/legacy](/docs/legacy.md)
194
+
195
+ #### Web UI
196
+
197
+ To start the web interface, type the following codes in python:
198
+
199
+ ```python
200
+ from g4f.gui import run_gui
201
+ run_gui()
202
+ ```
203
+ or execute the following command:
204
+ ```bash
205
+ python -m g4f.cli gui -port 8080 -debug
206
+ ```
207
+
208
+ #### Interference API
209
+
210
+ You can use the Interference API to serve other OpenAI integrations with G4F.
211
+
212
+ See docs: [/docs/interference](/docs/interference.md)
213
+
214
+ Access with: http://localhost:1337/v1
215
+
216
+ ### Configuration
217
+
218
+ #### Cookies
219
+
220
+ Cookies are essential for using Meta AI and Microsoft Designer to create images.
221
+ Additionally, cookies are required for the Google Gemini and WhiteRabbitNeo Provider.
222
+ From Bing, ensure you have the "_U" cookie, and from Google, all cookies starting with "__Secure-1PSID" are needed.
223
+
224
+ You can pass these cookies directly to the create function or set them using the `set_cookies` method before running G4F:
225
+
226
+ ```python
227
+ from g4f.cookies import set_cookies
228
+
229
+ set_cookies(".bing.com", {
230
+ "_U": "cookie value"
231
+ })
232
+
233
+ set_cookies(".google.com", {
234
+ "__Secure-1PSID": "cookie value"
235
+ })
236
+ ```
237
+
238
+ Alternatively, you can place your .har and cookie files in the `/har_and_cookies` directory. To export a cookie file, use the EditThisCookie extension available on the Chrome Web Store: [EditThisCookie Extension](https://chromewebstore.google.com/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg).
239
+
240
+ You can also create .har files to capture cookies. If you need further assistance, refer to the next section.
241
+
242
+ ```bash
243
+ python -m g4f.cli api --debug
244
+ ```
245
+ ```
246
+ Read .har file: ./har_and_cookies/you.com.har
247
+ Cookies added: 10 from .you.com
248
+ Read cookie file: ./har_and_cookies/google.json
249
+ Cookies added: 16 from .google.com
250
+ Starting server... [g4f v-0.0.0] (debug)
251
+ ```
252
+
253
+ #### .HAR File for OpenaiChat Provider
254
+
255
+ ##### Generating a .HAR File
256
+
257
+ 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:
258
+
259
+ 1. Navigate to https://chat.openai.com/ using your preferred web browser and log in with your credentials.
260
+ 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).
261
+ 3. With the Developer Tools open, switch to the "Network" tab.
262
+ 4. Reload the website to capture the loading process within the Network tab.
263
+ 5. Initiate an action in the chat which can be captured in the .har file.
264
+ 6. Right-click any of the network activities listed and select "Save all as HAR with content" to export the .har file.
265
+
266
+ ##### Storing the .HAR File
267
+
268
+ - Place the exported .har file in the `./har_and_cookies` directory if you are using Docker. Alternatively, you can store it in any preferred location within your current working directory.
269
+
270
+ Note: Ensure that your .har file is stored securely, as it may contain sensitive information.
271
+
272
+ #### Using Proxy
273
+
274
+ If you want to hide or change your IP address for the providers, you can set a proxy globally via an environment variable:
275
+
276
+ - On macOS and Linux:
277
+ ```bash
278
+ export G4F_PROXY="http://host:port"
279
+ ```
280
+
281
+ - On Windows:
282
+ ```bash
283
+ set G4F_PROXY=http://host:port
284
+ ```
285
+
286
+ ## 🚀 Providers and Models
287
+
288
+ ### GPT-4
289
+
290
+ | Website | Provider | GPT-3.5 | GPT-4 | Stream | Status | Auth |
291
+ | ------ | ------- | ------- | ----- | ------ | ------ | ---- |
292
+ | [bing.com](https://bing.com/chat) | `g4f.Provider.Bing` | ❌ | ✔️ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
293
+ | [chatgpt.ai](https://chatgpt.ai) | `g4f.Provider.ChatgptAi` | ❌ | ✔️ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
294
+ | [liaobots.site](https://liaobots.site) | `g4f.Provider.Liaobots` | ✔️ | ✔️ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
295
+ | [chat.openai.com](https://chat.openai.com) | `g4f.Provider.OpenaiChat` | ✔️ | ✔️ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌+✔️ |
296
+ | [raycast.com](https://raycast.com) | `g4f.Provider.Raycast` | ✔️ | ✔️ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ✔️ |
297
+ | [beta.theb.ai](https://beta.theb.ai) | `g4f.Provider.Theb` | ✔️ | ✔️ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
298
+ | [you.com](https://you.com) | `g4f.Provider.You` | ✔️ | ✔️ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
299
+
300
+ ## Best OpenSource Models
301
+ While we wait for gpt-5, here is a list of new models that are at least better than gpt-3.5-turbo. **Some are better than gpt-4**. Expect this list to grow.
302
+
303
+ | Website | Provider | parameters | better than |
304
+ | ------ | ------- | ------ | ------ |
305
+ | [mixtral-8x22b](https://huggingface.co/mistral-community/Mixtral-8x22B-v0.1) | `g4f.Provider.DeepInfra` | 176B / 44b active | gpt-3.5-turbo |
306
+ | [dbrx-instruct](https://www.databricks.com/blog/introducing-dbrx-new-state-art-open-llm) | `g4f.Provider.DeepInfra` | 132B / 36B active| gpt-3.5-turbo |
307
+ | [command-r+](https://txt.cohere.com/command-r-plus-microsoft-azure/) | `g4f.Provider.HuggingChat` | 104B | gpt-4-0613 |
308
+
309
+
310
+ ### GPT-3.5
311
+
312
+ | Website | Provider | GPT-3.5 | GPT-4 | Stream | Status | Auth |
313
+ | ------ | ------- | ------- | ----- | ------ | ------ | ---- |
314
+ | [chat3.aiyunos.top](https://chat3.aiyunos.top/) | `g4f.Provider.AItianhuSpace` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
315
+ | [chat10.aichatos.xyz](https://chat10.aichatos.xyz) | `g4f.Provider.Aichatos` | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
316
+ | [chatforai.store](https://chatforai.store) | `g4f.Provider.ChatForAi` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
317
+ | [chatgpt4online.org](https://chatgpt4online.org) | `g4f.Provider.Chatgpt4Online` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
318
+ | [chatgpt-free.cc](https://www.chatgpt-free.cc) | `g4f.Provider.ChatgptNext` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
319
+ | [chatgptx.de](https://chatgptx.de) | `g4f.Provider.ChatgptX` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
320
+ | [f1.cnote.top](https://f1.cnote.top) | `g4f.Provider.Cnote` | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
321
+ | [duckduckgo.com](https://duckduckgo.com/duckchat) | `g4f.Provider.DuckDuckGo` | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
322
+ | [ecosia.org](https://www.ecosia.org) | `g4f.Provider.Ecosia` | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
323
+ | [feedough.com](https://www.feedough.com) | `g4f.Provider.Feedough` | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
324
+ | [flowgpt.com](https://flowgpt.com/chat) | `g4f.Provider.FlowGpt` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
325
+ | [freegptsnav.aifree.site](https://freegptsnav.aifree.site) | `g4f.Provider.FreeGpt` | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
326
+ | [gpttalk.ru](https://gpttalk.ru) | `g4f.Provider.GptTalkRu` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
327
+ | [koala.sh](https://koala.sh) | `g4f.Provider.Koala` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
328
+ | [app.myshell.ai](https://app.myshell.ai/chat) | `g4f.Provider.MyShell` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
329
+ | [perplexity.ai](https://www.perplexity.ai) | `g4f.Provider.PerplexityAi` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
330
+ | [poe.com](https://poe.com) | `g4f.Provider.Poe` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ✔️ |
331
+ | [talkai.info](https://talkai.info) | `g4f.Provider.TalkAi` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
332
+ | [chat.vercel.ai](https://chat.vercel.ai) | `g4f.Provider.Vercel` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
333
+ | [aitianhu.com](https://www.aitianhu.com) | `g4f.Provider.AItianhu` | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
334
+ | [chatgpt.bestim.org](https://chatgpt.bestim.org) | `g4f.Provider.Bestim` | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
335
+ | [chatbase.co](https://www.chatbase.co) | `g4f.Provider.ChatBase` | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
336
+ | [chatgptdemo.info](https://chatgptdemo.info/chat) | `g4f.Provider.ChatgptDemo` | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
337
+ | [chat.chatgptdemo.ai](https://chat.chatgptdemo.ai) | `g4f.Provider.ChatgptDemoAi` | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
338
+ | [chatgptfree.ai](https://chatgptfree.ai) | `g4f.Provider.ChatgptFree` | ✔️ | ❌ | ❌ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
339
+ | [chatgptlogin.ai](https://chatgptlogin.ai) | `g4f.Provider.ChatgptLogin` | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
340
+ | [chat.3211000.xyz](https://chat.3211000.xyz) | `g4f.Provider.Chatxyz` | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
341
+ | [gpt6.ai](https://gpt6.ai) | `g4f.Provider.Gpt6` | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
342
+ | [gptchatly.com](https://gptchatly.com) | `g4f.Provider.GptChatly` | ✔️ | ❌ | ❌ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
343
+ | [ai18.gptforlove.com](https://ai18.gptforlove.com) | `g4f.Provider.GptForLove` | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
344
+ | [gptgo.ai](https://gptgo.ai) | `g4f.Provider.GptGo` | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
345
+ | [gptgod.site](https://gptgod.site) | `g4f.Provider.GptGod` | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
346
+ | [onlinegpt.org](https://onlinegpt.org) | `g4f.Provider.OnlineGpt` | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
347
+
348
+ ### Other
349
+
350
+ | Website | Provider | GPT-3.5 | GPT-4 | Stream | Status | Auth |
351
+ | ------ | ------- | ------- | ----- | ------ | ------ | ---- |
352
+ | [openchat.team](https://openchat.team) | `g4f.Provider.Aura` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
353
+ | [blackbox.ai](https://www.blackbox.ai) | `g4f.Provider.Blackbox` | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
354
+ | [cohereforai-c4ai-command-r-plus.hf.space](https://cohereforai-c4ai-command-r-plus.hf.space) | `g4f.Provider.Cohere` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
355
+ | [deepinfra.com](https://deepinfra.com) | `g4f.Provider.DeepInfra` | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
356
+ | [free.chatgpt.org.uk](https://free.chatgpt.org.uk) | `g4f.Provider.FreeChatgpt` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
357
+ | [gemini.google.com](https://gemini.google.com) | `g4f.Provider.Gemini` | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ✔️ |
358
+ | [ai.google.dev](https://ai.google.dev) | `g4f.Provider.GeminiPro` | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ✔️ |
359
+ | [gemini-chatbot-sigma.vercel.app](https://gemini-chatbot-sigma.vercel.app) | `g4f.Provider.GeminiProChat` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
360
+ | [developers.sber.ru](https://developers.sber.ru/gigachat) | `g4f.Provider.GigaChat` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ✔️ |
361
+ | [console.groq.com](https://console.groq.com/playground) | `g4f.Provider.Groq` | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ✔️ |
362
+ | [huggingface.co](https://huggingface.co/chat) | `g4f.Provider.HuggingChat` | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
363
+ | [huggingface.co](https://huggingface.co/chat) | `g4f.Provider.HuggingFace` | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
364
+ | [llama2.ai](https://www.llama2.ai) | `g4f.Provider.Llama` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
365
+ | [meta.ai](https://www.meta.ai) | `g4f.Provider.MetaAI` | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌+✔️ |
366
+ | [openrouter.ai](https://openrouter.ai) | `g4f.Provider.OpenRouter` | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ✔️ |
367
+ | [labs.perplexity.ai](https://labs.perplexity.ai) | `g4f.Provider.PerplexityLabs` | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
368
+ | [pi.ai](https://pi.ai/talk) | `g4f.Provider.Pi` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
369
+ | [replicate.com](https://replicate.com) | `g4f.Provider.ReplicateImage` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
370
+ | [theb.ai](https://theb.ai) | `g4f.Provider.ThebApi` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ✔️ |
371
+ | [whiterabbitneo.com](https://www.whiterabbitneo.com) | `g4f.Provider.WhiteRabbitNeo` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ✔️ |
372
+ | [bard.google.com](https://bard.google.com) | `g4f.Provider.Bard` | ❌ | ❌ | ❌ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ✔️ |
373
+
374
+ ### Models
375
+
376
+ | Model | Base Provider | Provider | Website |
377
+ | ----- | ------------- | -------- | ------- |
378
+ | gpt-3.5-turbo | OpenAI | 8+ Providers | [openai.com](https://openai.com/) |
379
+ | gpt-4 | OpenAI | 2+ Providers | [openai.com](https://openai.com/) |
380
+ | gpt-4-turbo | OpenAI | g4f.Provider.Bing | [openai.com](https://openai.com/) |
381
+ | Llama-2-7b-chat-hf | Meta | 2+ Providers | [llama.meta.com](https://llama.meta.com/) |
382
+ | Llama-2-13b-chat-hf | Meta | 2+ Providers | [llama.meta.com](https://llama.meta.com/) |
383
+ | Llama-2-70b-chat-hf | Meta | 3+ Providers | [llama.meta.com](https://llama.meta.com/) |
384
+ | Meta-Llama-3-8b-instruct | Meta | 1+ Providers | [llama.meta.com](https://llama.meta.com/) |
385
+ | Meta-Llama-3-70b-instruct | Meta | 2+ Providers | [llama.meta.com](https://llama.meta.com/) |
386
+ | CodeLlama-34b-Instruct-hf | Meta | g4f.Provider.HuggingChat | [llama.meta.com](https://llama.meta.com/) |
387
+ | CodeLlama-70b-Instruct-hf | Meta | 2+ Providers | [llama.meta.com](https://llama.meta.com/) |
388
+ | Mixtral-8x7B-Instruct-v0.1 | Huggingface | 4+ Providers | [huggingface.co](https://huggingface.co/) |
389
+ | Mistral-7B-Instruct-v0.1 | Huggingface | 3+ Providers | [huggingface.co](https://huggingface.co/) |
390
+ | Mistral-7B-Instruct-v0.2 | Huggingface | g4f.Provider.DeepInfra | [huggingface.co](https://huggingface.co/) |
391
+ | zephyr-orpo-141b-A35b-v0.1 | Huggingface | 2+ Providers | [huggingface.co](https://huggingface.co/) |
392
+ | dolphin-2.6-mixtral-8x7b | Huggingface | g4f.Provider.DeepInfra | [huggingface.co](https://huggingface.co/) |
393
+ | gemini | Google | g4f.Provider.Gemini | [gemini.google.com](https://gemini.google.com/) |
394
+ | gemini-pro | Google | 2+ Providers | [gemini.google.com](https://gemini.google.com/) |
395
+ | claude-v2 | Anthropic | 1+ Providers | [anthropic.com](https://www.anthropic.com/) |
396
+ | claude-3-opus | Anthropic | g4f.Provider.You | [anthropic.com](https://www.anthropic.com/) |
397
+ | claude-3-sonnet | Anthropic | g4f.Provider.You | [anthropic.com](https://www.anthropic.com/) |
398
+ | lzlv_70b_fp16_hf | Huggingface | g4f.Provider.DeepInfra | [huggingface.co](https://huggingface.co/) |
399
+ | airoboros-70b | Huggingface | g4f.Provider.DeepInfra | [huggingface.co](https://huggingface.co/) |
400
+ | openchat_3.5 | Huggingface | 2+ Providers | [huggingface.co](https://huggingface.co/) |
401
+ | pi | Inflection | g4f.Provider.Pi | [inflection.ai](https://inflection.ai/) |
402
+
403
+ ### Image and Vision Models
404
+
405
+ | Label | Provider | Image Model | Vision Model | Website |
406
+ | ----- | -------- | ----------- | ------------ | ------- |
407
+ | Microsoft Copilot in Bing | `g4f.Provider.Bing` | dall-e-3 | gpt-4-vision | [bing.com](https://bing.com/chat) |
408
+ | DeepInfra | `g4f.Provider.DeepInfra` | stability-ai/sdxl| llava-1.5-7b-hf | [deepinfra.com](https://deepinfra.com) |
409
+ | Gemini | `g4f.Provider.Gemini` | gemini| gemini | [gemini.google.com](https://gemini.google.com) |
410
+ | Gemini API | `g4f.Provider.GeminiPro` | ❌| gemini-1.5-pro-latest | [ai.google.dev](https://ai.google.dev) |
411
+ | Meta AI | `g4f.Provider.MetaAI` | meta| ❌ | [meta.ai](https://www.meta.ai) |
412
+ | OpenAI ChatGPT | `g4f.Provider.OpenaiChat` | dall-e-3 | gpt-4-vision | [chat.openai.com](https://chat.openai.com) |
413
+ | Replicate | `g4f.Provider.Replicate` | stability-ai/sdxl| ❌ | [replicate.com](https://replicate.com) |
414
+ | You.com | `g4f.Provider.You` | dall-e| agent | [you.com](https://you.com) |
415
+
416
+ ## 🔗 Powered by gpt4free
417
+
418
+ <table>
419
+ <thead align="center">
420
+ <tr border: none;>
421
+ <td>
422
+ <b>🎁 Projects</b>
423
+ </td>
424
+ <td>
425
+ <b>⭐ Stars</b>
426
+ </td>
427
+ <td>
428
+ <b>📚 Forks</b>
429
+ </td>
430
+ <td>
431
+ <b>🛎 Issues</b>
432
+ </td>
433
+ <td>
434
+ <b>📬 Pull requests</b>
435
+ </td>
436
+ </tr>
437
+ </thead>
438
+ <tbody>
439
+ <tr>
440
+ <td>
441
+ <a href="https://github.com/xtekky/gpt4free">
442
+ <b>gpt4free</b>
443
+ </a>
444
+ </td>
445
+ <td>
446
+ <a href="https://github.com/xtekky/gpt4free/stargazers">
447
+ <img alt="Stars" src="https://img.shields.io/github/stars/xtekky/gpt4free?style=flat-square&labelColor=343b41" />
448
+ </a>
449
+ </td>
450
+ <td>
451
+ <a href="https://github.com/xtekky/gpt4free/network/members">
452
+ <img alt="Forks" src="https://img.shields.io/github/forks/xtekky/gpt4free?style=flat-square&labelColor=343b41" />
453
+ </a>
454
+ </td>
455
+ <td>
456
+ <a href="https://github.com/xtekky/gpt4free/issues">
457
+ <img alt="Issues" src="https://img.shields.io/github/issues/xtekky/gpt4free?style=flat-square&labelColor=343b41" />
458
+ </a>
459
+ </td>
460
+ <td>
461
+ <a href="https://github.com/xtekky/gpt4free/pulls">
462
+ <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/xtekky/gpt4free?style=flat-square&labelColor=343b41" />
463
+ </a>
464
+ </td>
465
+ </tr>
466
+ <td>
467
+ <a href="https://github.com/xiangsx/gpt4free-ts">
468
+ <b>gpt4free-ts</b>
469
+ </a>
470
+ </td>
471
+ <td>
472
+ <a href="https://github.com/xiangsx/gpt4free-ts/stargazers">
473
+ <img alt="Stars" src="https://img.shields.io/github/stars/xiangsx/gpt4free-ts?style=flat-square&labelColor=343b41" />
474
+ </a>
475
+ </td>
476
+ <td>
477
+ <a href="https://github.com/xiangsx/gpt4free-ts/network/members">
478
+ <img alt="Forks" src="https://img.shields.io/github/forks/xiangsx/gpt4free-ts?style=flat-square&labelColor=343b41" />
479
+ </a>
480
+ </td>
481
+ <td>
482
+ <a href="https://github.com/xiangsx/gpt4free-ts/issues">
483
+ <img alt="Issues" src="https://img.shields.io/github/issues/xiangsx/gpt4free-ts?style=flat-square&labelColor=343b41" />
484
+ </a>
485
+ </td>
486
+ <td>
487
+ <a href="https://github.com/xiangsx/gpt4free-ts/pulls">
488
+ <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/xiangsx/gpt4free-ts?style=flat-square&labelColor=343b41" />
489
+ </a>
490
+ </td>
491
+ </tr>
492
+ <tr>
493
+ <td>
494
+ <a href="https://github.com/zukixa/cool-ai-stuff/">
495
+ <b>Free AI API's & Potential Providers List</b>
496
+ </a>
497
+ </td>
498
+ <td>
499
+ <a href="https://github.com/zukixa/cool-ai-stuff/stargazers">
500
+ <img alt="Stars" src="https://img.shields.io/github/stars/zukixa/cool-ai-stuff?style=flat-square&labelColor=343b41" />
501
+ </a>
502
+ </td>
503
+ <td>
504
+ <a href="https://github.com/zukixa/cool-ai-stuff/network/members">
505
+ <img alt="Forks" src="https://img.shields.io/github/forks/zukixa/cool-ai-stuff?style=flat-square&labelColor=343b41" />
506
+ </a>
507
+ </td>
508
+ <td>
509
+ <a href="https://github.com/zukixa/cool-ai-stuff/issues">
510
+ <img alt="Issues" src="https://img.shields.io/github/issues/zukixa/cool-ai-stuff?style=flat-square&labelColor=343b41" />
511
+ </a>
512
+ </td>
513
+ <td>
514
+ <a href="https://github.com/zukixa/cool-ai-stuff/pulls">
515
+ <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/zukixa/cool-ai-stuff?style=flat-square&labelColor=343b41" />
516
+ </a>
517
+ </td>
518
+ </tr>
519
+ <tr>
520
+ <tr>
521
+ <td>
522
+ <a href="https://github.com/xtekky/chatgpt-clone">
523
+ <b>ChatGPT-Clone</b>
524
+ </a>
525
+ </td>
526
+ <td>
527
+ <a href="https://github.com/xtekky/chatgpt-clone/stargazers">
528
+ <img alt="Stars" src="https://img.shields.io/github/stars/xtekky/chatgpt-clone?style=flat-square&labelColor=343b41" />
529
+ </a>
530
+ </td>
531
+ <td>
532
+ <a href="https://github.com/xtekky/chatgpt-clone/network/members">
533
+ <img alt="Forks" src="https://img.shields.io/github/forks/xtekky/chatgpt-clone?style=flat-square&labelColor=343b41" />
534
+ </a>
535
+ </td>
536
+ <td>
537
+ <a href="https://github.com/xtekky/chatgpt-clone/issues">
538
+ <img alt="Issues" src="https://img.shields.io/github/issues/xtekky/chatgpt-clone?style=flat-square&labelColor=343b41" />
539
+ </a>
540
+ </td>
541
+ <td>
542
+ <a href="https://github.com/xtekky/chatgpt-clone/pulls">
543
+ <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/xtekky/chatgpt-clone?style=flat-square&labelColor=343b41" />
544
+ </a>
545
+ </td>
546
+ </tr>
547
+ <tr>
548
+ <td>
549
+ <a href="https://github.com/mishalhossin/Discord-Chatbot-Gpt4Free">
550
+ <b>Ai agent</b>
551
+ </a>
552
+ </td>
553
+ <td>
554
+ <a href="https://github.com/Josh-XT/AGiXT/stargazers">
555
+ <img alt="Stars" src="https://img.shields.io/github/stars/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
556
+ </a>
557
+ </td>
558
+ <td>
559
+ <a href="https://github.com/Josh-XT/AGiXT/network/members">
560
+ <img alt="Forks" src="https://img.shields.io/github/forks/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
561
+ </a>
562
+ </td>
563
+ <td>
564
+ <a href="https://github.com/Josh-XT/AGiXT/issues">
565
+ <img alt="Issues" src="https://img.shields.io/github/issues/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
566
+ </a>
567
+ </td>
568
+ <td>
569
+ <a href="https://github.com/Josh-XT/AGiXT/pulls">
570
+ <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
571
+ </a>
572
+ </td>
573
+ </tr>
574
+ <tr>
575
+ <td>
576
+ <a href="https://github.com/mishalhossin/Discord-Chatbot-Gpt4Free">
577
+ <b>ChatGpt Discord Bot</b>
578
+ </a>
579
+ </td>
580
+ <td>
581
+ <a href="https://github.com/mishalhossin/Discord-Chatbot-Gpt4Free/stargazers">
582
+ <img alt="Stars" src="https://img.shields.io/github/stars/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
583
+ </a>
584
+ </td>
585
+ <td>
586
+ <a href="https://github.com/mishalhossin/Discord-Chatbot-Gpt4Free/network/members">
587
+ <img alt="Forks" src="https://img.shields.io/github/forks/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
588
+ </a>
589
+ </td>
590
+ <td>
591
+ <a href="https://github.com/mishalhossin/Discord-Chatbot-Gpt4Free/issues">
592
+ <img alt="Issues" src="https://img.shields.io/github/issues/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
593
+ </a>
594
+ </td>
595
+ <td>
596
+ <a href="https://github.com/mishalhossin/Coding-Chatbot-Gpt4Free/pulls">
597
+ <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
598
+ </a>
599
+ </td>
600
+ <tr>
601
+ <tr>
602
+ <td>
603
+ <a href="https://github.com/Zero6992/chatGPT-discord-bot">
604
+ <b>chatGPT-discord-bot</b>
605
+ </a>
606
+ </td>
607
+ <td>
608
+ <a href="https://github.com/Zero6992/chatGPT-discord-bot/stargazers">
609
+ <img alt="Stars" src="https://img.shields.io/github/stars/Zero6992/chatGPT-discord-bot?style=flat-square&labelColor=343b41" />
610
+ </a>
611
+ </td>
612
+ <td>
613
+ <a href="https://github.com/Zero6992/chatGPT-discord-bot/network/members">
614
+ <img alt="Forks" src="https://img.shields.io/github/forks/Zero6992/chatGPT-discord-bot?style=flat-square&labelColor=343b41" />
615
+ </a>
616
+ </td>
617
+ <td>
618
+ <a href="https://github.com/Zero6992/chatGPT-discord-bot/issues">
619
+ <img alt="Issues" src="https://img.shields.io/github/issues/Zero6992/chatGPT-discord-bot?style=flat-square&labelColor=343b41" />
620
+ </a>
621
+ </td>
622
+ <td>
623
+ <a href="https://github.com/Zero6992/chatGPT-discord-bot/pulls">
624
+ <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/Zero6992/chatGPT-discord-bot?style=flat-square&labelColor=343b41" />
625
+ </a>
626
+ </td>
627
+ <tr>
628
+ <td>
629
+ <a href="https://github.com/SamirXR/Nyx-Bot">
630
+ <b>Nyx-Bot (Discord)</b>
631
+ </a>
632
+ </td>
633
+ <td>
634
+ <a href="https://github.com/SamirXR/Nyx-Bot/stargazers">
635
+ <img alt="Stars" src="https://img.shields.io/github/stars/SamirXR/Nyx-Bot?style=flat-square&labelColor=343b41" />
636
+ </a>
637
+ </td>
638
+ <td>
639
+ <a href="https://github.com/SamirXR/Nyx-Bot/network/members">
640
+ <img alt="Forks" src="https://img.shields.io/github/forks/SamirXR/Nyx-Bot?style=flat-square&labelColor=343b41" />
641
+ </a>
642
+ </td>
643
+ <td>
644
+ <a href="https://github.com/SamirXR/Nyx-Bot/issues">
645
+ <img alt="Issues" src="https://img.shields.io/github/issues/SamirXR/Nyx-Bot?style=flat-square&labelColor=343b41" />
646
+ </a>
647
+ </td>
648
+ <td>
649
+ <a href="https://github.com/SamirXR/Nyx-Bot/pulls">
650
+ <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/SamirXR/Nyx-Bot?style=flat-square&labelColor=343b41" />
651
+ </a>
652
+ </td>
653
+ </tr>
654
+ </tr>
655
+ <tr>
656
+ <td>
657
+ <a href="https://github.com/MIDORIBIN/langchain-gpt4free">
658
+ <b>LangChain gpt4free</b>
659
+ </a>
660
+ </td>
661
+ <td>
662
+ <a href="https://github.com/MIDORIBIN/langchain-gpt4free/stargazers">
663
+ <img alt="Stars" src="https://img.shields.io/github/stars/MIDORIBIN/langchain-gpt4free?style=flat-square&labelColor=343b41" />
664
+ </a>
665
+ </td>
666
+ <td>
667
+ <a href="https://github.com/MIDORIBIN/langchain-gpt4free/network/members">
668
+ <img alt="Forks" src="https://img.shields.io/github/forks/MIDORIBIN/langchain-gpt4free?style=flat-square&labelColor=343b41" />
669
+ </a>
670
+ </td>
671
+ <td>
672
+ <a href="https://github.com/MIDORIBIN/langchain-gpt4free/issues">
673
+ <img alt="Issues" src="https://img.shields.io/github/issues/MIDORIBIN/langchain-gpt4free?style=flat-square&labelColor=343b41" />
674
+ </a>
675
+ </td>
676
+ <td>
677
+ <a href="https://github.com/MIDORIBIN/langchain-gpt4free/pulls">
678
+ <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/MIDORIBIN/langchain-gpt4free?style=flat-square&labelColor=343b41" />
679
+ </a>
680
+ </td>
681
+ </tr>
682
+ <tr>
683
+ <td>
684
+ <a href="https://github.com/HexyeDEV/Telegram-Chatbot-Gpt4Free">
685
+ <b>ChatGpt Telegram Bot</b>
686
+ </a>
687
+ </td>
688
+ <td>
689
+ <a href="https://github.com/HexyeDEV/Telegram-Chatbot-Gpt4Free/stargazers">
690
+ <img alt="Stars" src="https://img.shields.io/github/stars/HexyeDEV/Telegram-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
691
+ </a>
692
+ </td>
693
+ <td>
694
+ <a href="https://github.com/HexyeDEV/Telegram-Chatbot-Gpt4Free/network/members">
695
+ <img alt="Forks" src="https://img.shields.io/github/forks/HexyeDEV/Telegram-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
696
+ </a>
697
+ </td>
698
+ <td>
699
+ <a href="https://github.com/HexyeDEV/Telegram-Chatbot-Gpt4Free/issues">
700
+ <img alt="Issues" src="https://img.shields.io/github/issues/HexyeDEV/Telegram-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
701
+ </a>
702
+ </td>
703
+ <td>
704
+ <a href="https://github.com/HexyeDEV/Telegram-Chatbot-Gpt4Free/pulls">
705
+ <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/HexyeDEV/Telegram-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
706
+ </a>
707
+ </td>
708
+ </tr>
709
+ <tr>
710
+ <td>
711
+ <a href="https://github.com/Lin-jun-xiang/chatgpt-line-bot">
712
+ <b>ChatGpt Line Bot</b>
713
+ </a>
714
+ </td>
715
+ <td>
716
+ <a href="https://github.com/Lin-jun-xiang/chatgpt-line-bot/stargazers">
717
+ <img alt="Stars" src="https://img.shields.io/github/stars/Lin-jun-xiang/chatgpt-line-bot?style=flat-square&labelColor=343b41" />
718
+ </a>
719
+ </td>
720
+ <td>
721
+ <a href="https://github.com/Lin-jun-xiang/chatgpt-line-bot/network/members">
722
+ <img alt="Forks" src="https://img.shields.io/github/forks/Lin-jun-xiang/chatgpt-line-bot?style=flat-square&labelColor=343b41" />
723
+ </a>
724
+ </td>
725
+ <td>
726
+ <a href="https://github.com/Lin-jun-xiang/chatgpt-line-bot/issues">
727
+ <img alt="Issues" src="https://img.shields.io/github/issues/Lin-jun-xiang/chatgpt-line-bot?style=flat-square&labelColor=343b41" />
728
+ </a>
729
+ </td>
730
+ <td>
731
+ <a href="https://github.com/Lin-jun-xiang/chatgpt-line-bot/pulls">
732
+ <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/Lin-jun-xiang/chatgpt-line-bot?style=flat-square&labelColor=343b41" />
733
+ </a>
734
+ </td>
735
+ </tr>
736
+ <tr>
737
+ <td>
738
+ <a href="https://github.com/Lin-jun-xiang/action-translate-readme">
739
+ <b>Action Translate Readme</b>
740
+ </a>
741
+ </td>
742
+ <td>
743
+ <a href="https://github.com/Lin-jun-xiang/action-translate-readme/stargazers">
744
+ <img alt="Stars" src="https://img.shields.io/github/stars/Lin-jun-xiang/action-translate-readme?style=flat-square&labelColor=343b41" />
745
+ </a>
746
+ </td>
747
+ <td>
748
+ <a href="https://github.com/Lin-jun-xiang/action-translate-readme/network/members">
749
+ <img alt="Forks" src="https://img.shields.io/github/forks/Lin-jun-xiang/action-translate-readme?style=flat-square&labelColor=343b41" />
750
+ </a>
751
+ </td>
752
+ <td>
753
+ <a href="https://github.com/Lin-jun-xiang/action-translate-readme/issues">
754
+ <img alt="Issues" src="https://img.shields.io/github/issues/Lin-jun-xiang/action-translate-readme?style=flat-square&labelColor=343b41" />
755
+ </a>
756
+ </td>
757
+ <td>
758
+ <a href="https://github.com/Lin-jun-xiang/action-translate-readme/pulls">
759
+ <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/Lin-jun-xiang/action-translate-readme?style=flat-square&labelColor=343b41" />
760
+ </a>
761
+ </td>
762
+ </tr>
763
+ <tr>
764
+ <td>
765
+ <a href="https://github.com/Lin-jun-xiang/docGPT-streamlit">
766
+ <b>Langchain Document GPT</b>
767
+ </a>
768
+ </td>
769
+ <td>
770
+ <a href="https://github.com/Lin-jun-xiang/docGPT-streamlit/stargazers">
771
+ <img alt="Stars" src="https://img.shields.io/github/stars/Lin-jun-xiang/docGPT-streamlit?style=flat-square&labelColor=343b41" />
772
+ </a>
773
+ </td>
774
+ <td>
775
+ <a href="https://github.com/Lin-jun-xiang/docGPT-streamlit/network/members">
776
+ <img alt="Forks" src="https://img.shields.io/github/forks/Lin-jun-xiang/docGPT-streamlit?style=flat-square&labelColor=343b41" />
777
+ </a>
778
+ </td>
779
+ <td>
780
+ <a href="https://github.com/Lin-jun-xiang/docGPT-streamlit/issues">
781
+ <img alt="Issues" src="https://img.shields.io/github/issues/Lin-jun-xiang/docGPT-streamlit?style=flat-square&labelColor=343b41" />
782
+ </a>
783
+ </td>
784
+ <td>
785
+ <a href="https://github.com/Lin-jun-xiang/docGPT-streamlit/pulls">
786
+ <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/Lin-jun-xiang/docGPT-streamlit?style=flat-square&labelColor=343b41" />
787
+ </a>
788
+ </td>
789
+ </tr>
790
+ <tr>
791
+ <td>
792
+ <a href="https://github.com/Simatwa/python-tgpt">
793
+ <b>python-tgpt</b>
794
+ </a>
795
+ </td>
796
+ <td>
797
+ <a href="https://github.com/Simatwa/python-tgpt/stargazers">
798
+ <img alt="Stars" src="https://img.shields.io/github/stars/Simatwa/python-tgpt?style=flat-square&labelColor=343b41" />
799
+ </a>
800
+ </td>
801
+ <td>
802
+ <a href="https://github.com/Simatwa/python-tgpt/network/members">
803
+ <img alt="Forks" src="https://img.shields.io/github/forks/Simatwa/python-tgpt?style=flat-square&labelColor=343b41" />
804
+ </a>
805
+ </td>
806
+ <td>
807
+ <a href="https://github.com/Simatwa/python-tgpt/issues">
808
+ <img alt="Issues" src="https://img.shields.io/github/issues/Simatwa/python-tgpt?style=flat-square&labelColor=343b41" />
809
+ </a>
810
+ </td>
811
+ <td>
812
+ <a href="https://github.com/Simatwa/python-tgpt/pulls">
813
+ <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/Simatwa/python-tgpt?style=flat-square&labelColor=343b41" />
814
+ </a>
815
+ </td>
816
+ </tr>
817
+ </tbody>
818
+ </table>
819
+
820
+ ## 🤝 Contribute
821
+
822
+ We welcome contributions from the community. Whether you're adding new providers or features, or simply fixing typos and making small improvements, your input is valued. Creating a pull request is all it takes – our co-pilot will handle the code review process. Once all changes have been addressed, we'll merge the pull request into the main branch and release the updates at a later time.
823
+
824
+ ###### Guide: How do i create a new Provider?
825
+
826
+ - Read: [/docs/guides/create_provider](/docs/guides/create_provider.md)
827
+
828
+ ###### Guide: How can AI help me with writing code?
829
+
830
+ - Read: [/docs/guides/help_me](/docs/guides/help_me.md)
831
+
832
+ ## 🙌 Contributors
833
+
834
+ A list of all contributors is available [here](https://github.com/xtekky/gpt4free/graphs/contributors)
835
+
836
+ <a href="https://github.com/xtekky" target="_blank"><img src="https://avatars.githubusercontent.com/u/98614666?v=4&s=45" width="45" title="xtekky"></a>
837
+ <a href="https://github.com/hlohaus" target="_blank"><img src="https://avatars.githubusercontent.com/u/983577?v=4&s=45" width="45" title="hlohaus"></a>
838
+ <a href="https://github.com/bagusindrayana" target="_blank"><img src="https://avatars.githubusercontent.com/u/36830534?v=4&s=45" width="45" title="bagusindrayana"></a>
839
+ <a href="https://github.com/sudouser777" target="_blank"><img src="https://avatars.githubusercontent.com/u/22415463?v=4&s=45" width="45" title="sudouser777"></a>
840
+ <a href="https://github.com/thatlukinhasguy1" target="_blank"><img src="https://avatars.githubusercontent.com/u/139662282?v=4&s=45" width="45" title="thatlukinhasguy1"></a>
841
+ <a href="https://github.com/Commenter123321" target="_blank"><img src="https://avatars.githubusercontent.com/u/36051603?v=4&s=45" width="45" title="Commenter123321"></a>
842
+ <a href="https://github.com/DanielShemesh" target="_blank"><img src="https://avatars.githubusercontent.com/u/20585236?v=4&s=45" width="45" title="DanielShemesh"></a>
843
+ <a href="https://github.com/Luneye" target="_blank"><img src="https://avatars.githubusercontent.com/u/73485421?v=4&s=45" width="45" title="Luneye"></a>
844
+ <a href="https://github.com/enganese" target="_blank"><img src="https://avatars.githubusercontent.com/u/69082498?v=4&s=45" width="45" title="enganese"></a>
845
+ <a href="https://github.com/ezerinz" target="_blank"><img src="https://avatars.githubusercontent.com/u/100193740?v=4&s=45" width="45" title="ezerinz"></a>
846
+ <a href="https://github.com/Lin-jun-xiang" target="_blank"><img src="https://avatars.githubusercontent.com/u/63782903?v=4&s=45" width="45" title="Lin-jun-xiang"></a>
847
+ <a href="https://github.com/nullstreak" target="_blank"><img src="https://avatars.githubusercontent.com/u/139914347?v=4&s=45" width="45" title="nullstreak"></a>
848
+ <a href="https://github.com/valerii-chirkov" target="_blank"><img src="https://avatars.githubusercontent.com/u/81074936?v=4&s=45" width="45" title="valerii-chirkov"></a>
849
+ <a href="https://github.com/MIDORIBIN" target="_blank"><img src="https://avatars.githubusercontent.com/u/25425217?v=4&s=45" width="45" title="MIDORIBIN"></a>
850
+ <a href="https://github.com/repollo" target="_blank"><img src="https://avatars.githubusercontent.com/u/2671466?v=4&s=45" width="45" title="repollo"></a>
851
+ <a href="https://github.com/hpsj" target="_blank"><img src="https://avatars.githubusercontent.com/u/54535414?v=4&s=45" width="45" title="hpsj"></a>
852
+ <a href="https://github.com/taiyi747" target="_blank"><img src="https://avatars.githubusercontent.com/u/63543716?v=4&s=45" width="45" title="taiyi747"></a>
853
+ <a href="https://github.com/ostix360" target="_blank"><img src="https://avatars.githubusercontent.com/u/55257054?v=4&s=45" width="45" title="ostix360"></a>
854
+ <a href="https://github.com/WdR-Tech" target="_blank"><img src="https://avatars.githubusercontent.com/u/143020293?v=4&s=45" width="45" title="WdR-Tech"></a>
855
+ <a href="https://github.com/HexyeDEV" target="_blank"><img src="https://avatars.githubusercontent.com/u/65314629?v=4&s=45" width="45" title="HexyeDEV"></a>
856
+ <a href="https://github.com/9fo" target="_blank"><img src="https://avatars.githubusercontent.com/u/71867245?v=4&s=45" width="45" title="9fo"></a>
857
+ <a href="https://github.com/eltociear" target="_blank"><img src="https://avatars.githubusercontent.com/u/22633385?v=4&s=45" width="45" title="eltociear"></a>
858
+ <a href="https://github.com/ramonvc" target="_blank"><img src="https://avatars.githubusercontent.com/u/13617054?v=4&s=45" width="45" title="ramonvc"></a>
859
+ <a href="https://github.com/naa7" target="_blank"><img src="https://avatars.githubusercontent.com/u/44613678?v=4&s=45" width="45" title="naa7"></a>
860
+ <a href="https://github.com/zeng-rr" target="_blank"><img src="https://avatars.githubusercontent.com/u/47846202?v=4&s=45" width="45" title="zeng-rr"></a>
861
+ <a href="https://github.com/editor-syntax" target="_blank"><img src="https://avatars.githubusercontent.com/u/109844019?v=4&s=45" width="45" title="editor-syntax"></a>
862
+ <a href="https://github.com/devAdityaa" target="_blank"><img src="https://avatars.githubusercontent.com/u/77636021?v=4&s=45" width="45" title="devAdityaa"></a>
863
+ <a href="https://github.com/kggn" target="_blank"><img src="https://avatars.githubusercontent.com/u/95663228?v=4&s=45" width="45" title="kggn"></a>
864
+ <a href="https://github.com/xiangsx" target="_blank"><img src="https://avatars.githubusercontent.com/u/29322721?v=4&s=45" width="45" title="xiangsx"></a>
865
+ <a href="https://github.com/ggindinson" target="_blank"><img src="https://avatars.githubusercontent.com/u/97807772?v=4&s=45" width="45" title="ggindinson"></a>
866
+ <span></span>
867
+ <img src="https://avatars.githubusercontent.com/u/71154407?s=45&v=4" width="45" title="ading2210">
868
+ <img src="https://avatars.githubusercontent.com/u/12299238?s=45&v=4" width="45" title="xqdoo00o">
869
+ <img src="https://avatars.githubusercontent.com/u/97126670?s=45&v=4" width="45" title="nathanrchn">
870
+ <img src="https://avatars.githubusercontent.com/u/81407603?v=4&s=45" width="45" title="dsdanielpark">
871
+
872
+ - The [`Vercel.py`](g4f/Provider/Vercel.py) file contains code from [vercel-llm-api](https://github.com/ading2210/vercel-llm-api) by [@ading2210](https://github.com/ading2210)
873
+ - The [`har_file.py`](g4f/Provider/openai/har_file.py) has input from [xqdoo00o/ChatGPT-to-API](https://github.com/xqdoo00o/ChatGPT-to-API)
874
+ - The [`PerplexityLabs.py`](g4f/Provider/openai/har_file.py) has input from [nathanrchn/perplexityai](https://github.com/nathanrchn/perplexityai)
875
+ - The [`Gemini.py`](g4f/Provider/needs_auth/Gemini.py) has input from [dsdanielpark/Gemini-API](https://github.com/dsdanielpark/Gemini-API)
876
+ - The [`MetaAI.py`](g4f/Provider/MetaAI.py) file contains code from [meta-ai-api](https://github.com/Strvm/meta-ai-api) by [@Strvm](https://github.com/Strvm)
877
+
878
+
879
+ *Having input implies that the AI's code generation utilized it as one of many sources.*
880
+
881
+ ## ©️ Copyright
882
+
883
+ This program is licensed under the [GNU GPL v3](https://www.gnu.org/licenses/gpl-3.0.txt)
884
+
885
+ ```
886
+ xtekky/gpt4free: Copyright (C) 2023 xtekky
887
+
888
+ This program is free software: you can redistribute it and/or modify
889
+ it under the terms of the GNU General Public License as published by
890
+ the Free Software Foundation, either version 3 of the License, or
891
+ (at your option) any later version.
892
+
893
+ This program is distributed in the hope that it will be useful,
894
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
895
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
896
+ GNU General Public License for more details.
897
+
898
+ You should have received a copy of the GNU General Public License
899
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
900
+ ```
901
+
902
+ ## ⭐ Star History
903
+
904
+ <a href="https://github.com/xtekky/gpt4free/stargazers">
905
+ <img width="500" alt="Star History Chart" src="https://api.star-history.com/svg?repos=xtekky/gpt4free&type=Date">
906
+ </a>
907
+
908
+ ## 📄 License
909
+
910
+ <table>
911
+ <tr>
912
+ <td>
913
+ <p align="center"> <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/93/GPLv3_Logo.svg/1200px-GPLv3_Logo.svg.png" width="80%"></img>
914
+ </td>
915
+ <td>
916
+ <img src="https://img.shields.io/badge/License-GNU_GPL_v3.0-red.svg"/> <br>
917
+ This project is licensed under <a href="./LICENSE">GNU_GPL_v3.0</a>.
918
+ </td>
919
+ </tr>
920
+ </table>
921
+
922
+ <p align="right">(<a href="#top">🔼 Back to top</a>)</p>
SECURITY.md ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ## Reporting a Vulnerability
2
+
3
+ Reporting a Vulnerability
4
+ Please report (suspected) security vulnerabilities to https://t.me/xtekky. You will receive a response within 48 hours. If the issue is confirmed, we will release a patch as soon as possible depending on complexity but historically within a few days.
docker-compose.yml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3'
2
+
3
+ services:
4
+ gpt4free:
5
+ image: hlohaus789/g4f:latest
6
+ shm_size: 2gb
7
+ build:
8
+ context: .
9
+ dockerfile: docker/Dockerfile
10
+ volumes:
11
+ - .:/app
12
+ ports:
13
+ - '8080:8080'
14
+ - '1337:1337'
15
+ - '7900:7900'
docker/Dockerfile ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM seleniarm/node-chromium
2
+
3
+ ARG G4F_VERSION
4
+ ARG G4F_USER=g4f
5
+ ARG G4F_USER_ID=1000
6
+ ARG G4F_NO_GUI
7
+ ARG G4F_PASS=secret
8
+
9
+ ENV G4F_VERSION $G4F_VERSION
10
+ ENV G4F_USER $G4F_USER
11
+ ENV G4F_USER_ID $G4F_USER_ID
12
+ ENV G4F_NO_GUI $G4F_NO_GUI
13
+
14
+ ENV SE_SCREEN_WIDTH 1850
15
+ ENV PYTHONUNBUFFERED 1
16
+ ENV G4F_DIR /app
17
+ ENV G4F_LOGIN_URL http://localhost:7900/?autoconnect=1&resize=scale&password=$G4F_PASS
18
+ ENV HOME /home/$G4F_USER
19
+ ENV PATH $PATH:$HOME/.local/bin
20
+ ENV SE_DOWNLOAD_DIR $HOME/Downloads
21
+ ENV SEL_USER $G4F_USER
22
+ ENV SEL_UID $G4F_USER_ID
23
+ ENV SEL_GID $G4F_USER_ID
24
+
25
+ USER root
26
+
27
+ # If docker compose, install git
28
+ RUN if [ "$G4F_VERSION" = "" ] ; then \
29
+ apt-get -qqy update && \
30
+ apt-get -qqy install git \
31
+ ; fi
32
+
33
+ # Install Python3, pip, remove OpenJDK 11, clean up
34
+ RUN apt-get -qqy update \
35
+ && apt-get -qqy install python3 python-is-python3 pip \
36
+ && apt-get -qyy remove openjdk-11-jre-headless \
37
+ && apt-get -qyy autoremove \
38
+ && apt-get -qyy clean \
39
+ && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
40
+
41
+ # Update entrypoint
42
+ COPY docker/supervisor.conf /etc/supervisor/conf.d/selenium.conf
43
+ COPY docker/supervisor-gui.conf /etc/supervisor/conf.d/gui.conf
44
+
45
+ # If no gui
46
+ RUN if [ "$G4F_NO_GUI" ] ; then \
47
+ rm /etc/supervisor/conf.d/gui.conf \
48
+ ; fi
49
+
50
+ # Change background image
51
+ COPY docker/background.png /usr/share/images/fluxbox/ubuntu-light.png
52
+
53
+ # Add user, fix permissions
54
+ RUN groupadd -g $G4F_USER_ID $G4F_USER \
55
+ && useradd -rm -G sudo -u $G4F_USER_ID -g $G4F_USER_ID $G4F_USER \
56
+ && echo "${G4F_USER}:${G4F_PASS}" | chpasswd \
57
+ && mkdir "${SE_DOWNLOAD_DIR}" \
58
+ && chown "${G4F_USER_ID}:${G4F_USER_ID}" $SE_DOWNLOAD_DIR /var/run/supervisor /var/log/supervisor \
59
+ && chown "${G4F_USER_ID}:${G4F_USER_ID}" -R /opt/bin/ /usr/bin/chromedriver /opt/selenium/
60
+
61
+ # Switch user
62
+ USER $G4F_USER_ID
63
+
64
+ # Set VNC password
65
+ RUN mkdir -p ${HOME}/.vnc \
66
+ && x11vnc -storepasswd ${G4F_PASS} ${HOME}/.vnc/passwd
67
+
68
+ # Set the working directory in the container.
69
+ WORKDIR $G4F_DIR
70
+
71
+ # Copy the project's requirements file into the container.
72
+ COPY requirements.txt $G4F_DIR
73
+
74
+ # Upgrade pip for the latest features and install the project's Python dependencies.
75
+ RUN pip install --break-system-packages --upgrade pip \
76
+ && pip install --break-system-packages -r requirements.txt
77
+
78
+ # Install selenium driver and uninstall webdriver
79
+ RUN pip install --break-system-packages \
80
+ undetected-chromedriver selenium-wire \
81
+ && pip uninstall -y --break-system-packages \
82
+ webdriver plyer nodriver
83
+
84
+ # Copy the entire package into the container.
85
+ ADD --chown=$G4F_USER:$G4F_USER g4f $G4F_DIR/g4f
86
+
87
+ # Expose ports
88
+ EXPOSE 8080 1337
docker/background.png ADDED
docker/supervisor-gui.conf ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [program:g4f-gui]
2
+ priority=15
3
+ command=python -m g4f.cli gui
4
+ directory=/app
5
+ stopasgroup=true
6
+ autostart=true
7
+ autorestart=true
8
+
9
+ ;Logs (all Hub activity redirected to stdout so it can be seen through "docker logs"
10
+ redirect_stderr=true
11
+ stdout_logfile=/dev/stdout
12
+ stdout_logfile_maxbytes=0
docker/supervisor.conf ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [program:xvfb]
2
+ priority=0
3
+ command=/opt/bin/start-xvfb.sh
4
+ autostart=true
5
+ autorestart=true
6
+
7
+ ;Logs
8
+ redirect_stderr=false
9
+ stdout_logfile=/var/log/supervisor/xvfb-stdout.log
10
+ stderr_logfile=/var/log/supervisor/xvfb-stderr.log
11
+ stdout_logfile_maxbytes=50MB
12
+ stderr_logfile_maxbytes=50MB
13
+ stdout_logfile_backups=5
14
+ stderr_logfile_backups=5
15
+ stdout_capture_maxbytes=50MB
16
+ stderr_capture_maxbytes=50MB
17
+
18
+ [program:vnc]
19
+ priority=5
20
+ command=/opt/bin/start-vnc.sh
21
+ autostart=true
22
+ autorestart=true
23
+
24
+ ;Logs
25
+ redirect_stderr=false
26
+ stdout_logfile=/var/log/supervisor/vnc-stdout.log
27
+ stderr_logfile=/var/log/supervisor/vnc-stderr.log
28
+ stdout_logfile_maxbytes=50MB
29
+ stderr_logfile_maxbytes=50MB
30
+ stdout_logfile_backups=5
31
+ stderr_logfile_backups=5
32
+ stdout_capture_maxbytes=50MB
33
+ stderr_capture_maxbytes=50MB
34
+
35
+ [program:novnc]
36
+ priority=10
37
+ command=/opt/bin/start-novnc.sh
38
+ autostart=true
39
+ autorestart=true
40
+
41
+ ;Logs
42
+ redirect_stderr=false
43
+ stdout_logfile=/var/log/supervisor/novnc-stdout.log
44
+ stderr_logfile=/var/log/supervisor/novnc-stderr.log
45
+ stdout_logfile_maxbytes=50MB
46
+ stderr_logfile_maxbytes=50MB
47
+ stdout_logfile_backups=5
48
+ stderr_logfile_backups=5
49
+ stdout_capture_maxbytes=50MB
50
+ stderr_capture_maxbytes=50MB
51
+
52
+ [program:g4f-api]
53
+ priority=15
54
+ command=python -m g4f.cli api
55
+ directory=/app
56
+ stopasgroup=true
57
+ autostart=true
58
+ autorestart=true
59
+
60
+ ;Logs (all Hub activity redirected to stdout so it can be seen through "docker logs"
61
+ redirect_stderr=true
62
+ stdout_logfile=/dev/stdout
63
+ stdout_logfile_maxbytes=0
docs/async_client.md ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # How to Use the G4F AsyncClient API
2
+
3
+ The AsyncClient API is the asynchronous counterpart to the standard G4F Client API. It offers the same functionality as the synchronous API, but with the added benefit of improved performance due to its asynchronous nature.
4
+
5
+ Designed to maintain compatibility with the existing OpenAI API, the G4F AsyncClient API ensures a seamless transition for users already familiar with the OpenAI client.
6
+
7
+ ## Key Features
8
+
9
+ The G4F AsyncClient API offers several key features:
10
+
11
+ - **Custom Providers:** The G4F Client API allows you to use custom providers. This feature enhances the flexibility of the API, enabling it to cater to a wide range of use cases.
12
+
13
+ - **ChatCompletion Interface:** The G4F package provides an interface for interacting with chat models through the ChatCompletion class. This class provides methods for creating both streaming and non-streaming responses.
14
+
15
+ - **Streaming Responses:** The ChatCompletion.create method can return a response iteratively as and when they are received if the stream parameter is set to True.
16
+
17
+ - **Non-Streaming Responses:** The ChatCompletion.create method can also generate non-streaming responses.
18
+
19
+ - **Image Generation and Vision Models:** The G4F Client API also supports image generation and vision models, expanding its utility beyond text-based interactions.
20
+
21
+
22
+ ## Using AsyncClient
23
+
24
+ ### Text Completions:
25
+
26
+ You can use the ChatCompletions endpoint to generate text completions as follows:
27
+
28
+ ```python
29
+ response = await client.chat.completions.create(
30
+ model="gpt-3.5-turbo",
31
+ messages=[{"role": "user", "content": "Say this is a test"}],
32
+ ...
33
+ )
34
+ print(response.choices[0].message.content)
35
+ ```
36
+
37
+ Streaming completions are also supported:
38
+
39
+ ```python
40
+ stream = client.chat.completions.create(
41
+ model="gpt-4",
42
+ messages=[{"role": "user", "content": "Say this is a test"}],
43
+ stream=True,
44
+ ...
45
+ )
46
+ async for chunk in stream:
47
+ if chunk.choices[0].delta.content:
48
+ print(chunk.choices[0].delta.content or "", end="")
49
+ ```
50
+
51
+ ### Image Generation:
52
+
53
+ You can generate images using a specified prompt:
54
+
55
+ ```python
56
+ response = await client.images.generate(
57
+ model="dall-e-3",
58
+ prompt="a white siamese cat",
59
+ ...
60
+ )
61
+
62
+ image_url = response.data[0].url
63
+ ```
64
+
65
+ ### Example usage with asyncio.gather
66
+
67
+ Start two tasks at the same time:
68
+
69
+ ```python
70
+ import asyncio
71
+
72
+ from g4f.client import AsyncClient
73
+ from g4f.Provider import BingCreateImages, OpenaiChat, Gemini
74
+
75
+ async def main():
76
+ client = AsyncClient(
77
+ provider=OpenaiChat,
78
+ image_provider=Gemini,
79
+ # other parameters...
80
+ )
81
+
82
+ task1 = client.chat.completions.create(
83
+ model="gpt-3.5-turbo",
84
+ messages=[{"role": "user", "content": "Say this is a test"}],
85
+ )
86
+ task2 = client.images.generate(
87
+ model="dall-e-3",
88
+ prompt="a white siamese cat",
89
+ )
90
+ responses = await asyncio.gather(task1, task2)
91
+
92
+ print(responses)
93
+
94
+ asyncio.run(main())
95
+ ```
docs/cat.jpeg ADDED
docs/cat.webp ADDED
docs/client.md ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### G4F - Client API
2
+
3
+ #### Introduction
4
+
5
+ Welcome to the G4F Client API, a cutting-edge tool for seamlessly integrating advanced AI capabilities into your Python applications. This guide is designed to facilitate your transition from using the OpenAI client to the G4F Client, offering enhanced features while maintaining compatibility with the existing OpenAI API.
6
+
7
+ #### Getting Started
8
+
9
+ **Switching to G4F Client:**
10
+
11
+ To begin using the G4F Client, simply update your import statement in your Python code:
12
+
13
+ Old Import:
14
+ ```python
15
+ from openai import OpenAI
16
+ ```
17
+
18
+ New Import:
19
+ ```python
20
+ from g4f.client import Client as OpenAI
21
+ ```
22
+
23
+ The G4F Client preserves the same familiar API interface as OpenAI, ensuring a smooth transition process.
24
+
25
+ ### Initializing the Client
26
+
27
+ To utilize the G4F Client, create an new instance. Below is an example showcasing custom providers:
28
+
29
+ ```python
30
+ from g4f.client import Client
31
+ from g4f.Provider import BingCreateImages, OpenaiChat, Gemini
32
+
33
+ client = Client(
34
+ provider=OpenaiChat,
35
+ image_provider=Gemini,
36
+ ...
37
+ )
38
+ ```
39
+
40
+ ## Configuration
41
+
42
+ You can set an "api_key" for your provider in the client.
43
+ And you also have the option to define a proxy for all outgoing requests:
44
+
45
+ ```python
46
+ from g4f.client import Client
47
+
48
+ client = Client(
49
+ api_key="...",
50
+ proxies="http://user:pass@host",
51
+ ...
52
+ )
53
+ ```
54
+
55
+ #### Usage Examples
56
+
57
+ **Text Completions:**
58
+
59
+ You can use the `ChatCompletions` endpoint to generate text completions as follows:
60
+
61
+ ```python
62
+ response = client.chat.completions.create(
63
+ model="gpt-3.5-turbo",
64
+ messages=[{"role": "user", "content": "Say this is a test"}],
65
+ ...
66
+ )
67
+ print(response.choices[0].message.content)
68
+ ```
69
+
70
+ Also streaming are supported:
71
+
72
+ ```python
73
+ stream = client.chat.completions.create(
74
+ model="gpt-4",
75
+ messages=[{"role": "user", "content": "Say this is a test"}],
76
+ stream=True,
77
+ ...
78
+ )
79
+ for chunk in stream:
80
+ if chunk.choices[0].delta.content:
81
+ print(chunk.choices[0].delta.content or "", end="")
82
+ ```
83
+
84
+ **Image Generation:**
85
+
86
+ Generate images using a specified prompt:
87
+
88
+ ```python
89
+ response = client.images.generate(
90
+ model="dall-e-3",
91
+ prompt="a white siamese cat",
92
+ ...
93
+ )
94
+
95
+ image_url = response.data[0].url
96
+ ```
97
+
98
+ **Creating Image Variations:**
99
+
100
+ Create variations of an existing image:
101
+
102
+ ```python
103
+ response = client.images.create_variation(
104
+ image=open("cat.jpg", "rb"),
105
+ model="bing",
106
+ ...
107
+ )
108
+
109
+ image_url = response.data[0].url
110
+ ```
111
+ Original / Variant:
112
+
113
+ [![Original Image](/docs/cat.jpeg)](/docs/client.md) [![Variant Image](/docs/cat.webp)](/docs/client.md)
114
+
115
+ #### Use a list of providers with RetryProvider
116
+
117
+ ```python
118
+ from g4f.client import Client
119
+ from g4f.Provider import RetryProvider, Phind, FreeChatgpt, Liaobots
120
+
121
+ import g4f.debug
122
+ g4f.debug.logging = True
123
+
124
+ client = Client(
125
+ provider=RetryProvider([Phind, FreeChatgpt, Liaobots], shuffle=False)
126
+ )
127
+ response = client.chat.completions.create(
128
+ model="",
129
+ messages=[{"role": "user", "content": "Hello"}],
130
+ )
131
+ print(response.choices[0].message.content)
132
+ ```
133
+
134
+ ```
135
+ Using RetryProvider provider
136
+ Using Phind provider
137
+ How can I assist you today?
138
+ ```
139
+
140
+ #### Advanced example using GeminiProVision
141
+
142
+ ```python
143
+ from g4f.client import Client
144
+ from g4f.Provider.GeminiPro import GeminiPro
145
+
146
+ client = Client(
147
+ api_key="...",
148
+ provider=GeminiPro
149
+ )
150
+ response = client.chat.completions.create(
151
+ model="gemini-pro-vision",
152
+ messages=[{"role": "user", "content": "What are on this image?"}],
153
+ image=open("docs/waterfall.jpeg", "rb")
154
+ )
155
+ print(response.choices[0].message.content)
156
+ ```
157
+ ```
158
+ User: What are on this image?
159
+ ```
160
+ ![Waterfall](/docs/waterfall.jpeg)
161
+
162
+ ```
163
+ Bot: There is a waterfall in the middle of a jungle. There is a rainbow over...
164
+ ```
165
+
166
+ #### Advanced example: A command-line program
167
+ ```python
168
+ import g4f
169
+ from g4f.client import Client
170
+
171
+ # Initialize the GPT client with the desired provider
172
+ client = Client(provider=g4f.Provider.Bing)
173
+
174
+ # Initialize an empty conversation history
175
+ messages = []
176
+
177
+ while True:
178
+ # Get user input
179
+ user_input = input("You: ")
180
+
181
+ # Check if the user wants to exit the chat
182
+ if user_input.lower() == "exit":
183
+ print("Exiting chat...")
184
+ break # Exit the loop to end the conversation
185
+
186
+ # Update the conversation history with the user's message
187
+ messages.append({"role": "user", "content": user_input})
188
+
189
+ try:
190
+ # Get GPT's response
191
+ response = client.chat.completions.create(
192
+ messages=messages,
193
+ model=g4f.models.default,
194
+ )
195
+
196
+ # Extract the GPT response and print it
197
+ gpt_response = response.choices[0].message.content
198
+ print(f"Bot: {gpt_response}")
199
+
200
+ # Update the conversation history with GPT's response
201
+ messages.append({"role": "assistant", "content": gpt_response})
202
+ except Exception as e:
203
+ print(f"An error occurred: {e}")
204
+ ```
205
+
206
+ [Return to Home](/)
docs/docker.md ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### G4F - Docker Setup
2
+
3
+ Easily set up and run the G4F project using Docker without the hassle of manual dependency installation.
4
+
5
+ 1. **Prerequisites:**
6
+ - [Install Docker](https://docs.docker.com/get-docker/)
7
+ - [Install Docker Compose](https://docs.docker.com/compose/install/)
8
+
9
+ 2. **Clone the Repository:**
10
+
11
+ ```bash
12
+ git clone https://github.com/xtekky/gpt4free.git
13
+ ```
14
+
15
+ 3. **Navigate to the Project Directory:**
16
+
17
+ ```bash
18
+ cd gpt4free
19
+ ```
20
+
21
+ 4. **Build the Docker Image:**
22
+
23
+ ```bash
24
+ docker pull selenium/node-chrome
25
+ docker-compose build
26
+ ```
27
+
28
+ 5. **Start the Service:**
29
+
30
+ ```bash
31
+ docker-compose up
32
+ ```
33
+
34
+ Your server will now be accessible at `http://localhost:1337`. Interact with the API or run tests as usual.
35
+
36
+ To stop the Docker containers, simply run:
37
+
38
+ ```bash
39
+ docker-compose down
40
+ ```
41
+
42
+ > [!Note]
43
+ > Changes made to local files reflect in the Docker container due to volume mapping in `docker-compose.yml`. However, if you add or remove dependencies, rebuild the Docker image using `docker-compose build`.
44
+
45
+ [Return to Home](/)
docs/git.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### G4F - Installation Guide
2
+
3
+ Follow these steps to install G4F from the source code:
4
+
5
+ 1. **Clone the Repository:**
6
+
7
+ ```bash
8
+ git clone https://github.com/xtekky/gpt4free.git
9
+ ```
10
+
11
+ 2. **Navigate to the Project Directory:**
12
+
13
+ ```bash
14
+ cd gpt4free
15
+ ```
16
+
17
+ 3. **(Optional) Create a Python Virtual Environment:**
18
+
19
+ It's recommended to isolate your project dependencies. You can follow the [Python official documentation](https://docs.python.org/3/tutorial/venv.html) for virtual environments.
20
+
21
+ ```bash
22
+ python3 -m venv venv
23
+ ```
24
+
25
+ 4. **Activate the Virtual Environment:**
26
+
27
+ - On Windows:
28
+
29
+ ```bash
30
+ .\venv\Scripts\activate
31
+ ```
32
+
33
+ - On macOS and Linux:
34
+
35
+ ```bash
36
+ source venv/bin/activate
37
+ ```
38
+
39
+ 5. **Install Minimum Requirements:**
40
+
41
+ Install the minimum required packages:
42
+
43
+ ```bash
44
+ pip install -r requirements-min.txt
45
+ ```
46
+
47
+ 6. **Or Install All Packages from `requirements.txt`:**
48
+
49
+ If you prefer, you can install all packages listed in `requirements.txt`:
50
+
51
+ ```bash
52
+ pip install -r requirements.txt
53
+ ```
54
+
55
+ 7. **Start Using the Repository:**
56
+
57
+ You can now create Python scripts and utilize the G4F functionalities. Here's a basic example:
58
+
59
+ Create a `test.py` file in the root folder and start using the repository:
60
+
61
+ ```python
62
+ import g4f
63
+ # Your code here
64
+ ```
65
+
66
+ [Return to Home](/)
docs/guides/create_provider.md ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Create Provider with AI Tool
2
+
3
+ Call in your terminal the `create_provider` script:
4
+ ```bash
5
+ python -m etc.tool.create_provider
6
+ ```
7
+ 1. Enter your name for the new provider.
8
+ 2. Copy and paste the `cURL` command from your browser developer tools.
9
+ 3. Let the AI ​​create the provider for you.
10
+ 4. Customize the provider according to your needs.
11
+
12
+ #### Create Provider
13
+
14
+ 1. Check out the current [list of potential providers](https://github.com/zukixa/cool-ai-stuff#ai-chat-websites), or find your own provider source!
15
+ 2. Create a new file in [g4f/Provider](/g4f/Provider) with the name of the Provider
16
+ 3. Implement a class that extends [BaseProvider](/g4f/providers/base_provider.py).
17
+
18
+ ```py
19
+ from __future__ import annotations
20
+
21
+ from ..typing import AsyncResult, Messages
22
+ from .base_provider import AsyncGeneratorProvider
23
+
24
+ class HogeService(AsyncGeneratorProvider):
25
+ url = "https://chat-gpt.com"
26
+ working = True
27
+ supports_gpt_35_turbo = True
28
+
29
+ @classmethod
30
+ async def create_async_generator(
31
+ cls,
32
+ model: str,
33
+ messages: Messages,
34
+ proxy: str = None,
35
+ **kwargs
36
+ ) -> AsyncResult:
37
+ yield ""
38
+ ```
39
+
40
+ 4. Here, you can adjust the settings, for example, if the website does support streaming, set `supports_stream` to `True`...
41
+ 5. Write code to request the provider in `create_async_generator` and `yield` the response, _even if_ it's a one-time response, do not hesitate to look at other providers for inspiration
42
+ 6. Add the Provider Import in [`g4f/Provider/__init__.py`](./g4f/Provider/__init__.py)
43
+
44
+ ```py
45
+ from .HogeService import HogeService
46
+
47
+ __all__ = [
48
+ HogeService,
49
+ ]
50
+ ```
51
+
52
+ 7. You are done !, test the provider by calling it:
53
+
54
+ ```py
55
+ import g4f
56
+
57
+ response = g4f.ChatCompletion.create(model='gpt-3.5-turbo', provider=g4f.Provider.PROVIDERNAME,
58
+ messages=[{"role": "user", "content": "test"}], stream=g4f.Provider.PROVIDERNAME.supports_stream)
59
+
60
+ for message in response:
61
+ print(message, flush=True, end='')
62
+ ```
docs/guides/help_me.md ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Guide: How can AI help me with writing code?
2
+
3
+ 🤖 Ever dreamt of writing code at lightning speed, effortlessly crafting clean, bug-free functionalities? Welcome to the age of AI-powered coding, where your imagination merges seamlessly with the machine's precision. This guide unveils 4 powerful ways AI can become your secret weapon in the coding world, saving you time, resources, and frustration. 😎
4
+
5
+ - Language Agnostic? No Problem! Rewrite Code with Ease
6
+ - Improving Written Code: Polish Your Code Like a Pro
7
+ - Demystifying the Unreadable: Deobfuscating Unreadable Code
8
+ - Custom Functions: Your AI-Powered Genie in a Bottle
9
+
10
+ So you can streamline your coding process, improve code quality, and enhance productivity.
11
+
12
+ #### 1. Rewriting Code from One Language to Another
13
+ You can leverage AI to translate code from one programming language to another. For instance, you can easily convert JavaScript code to Python using the following approach:
14
+
15
+ **Prompt:**
16
+ ```
17
+ Rewrite this JavaScript code to Python code. Use the aiohttp package:
18
+ ```
19
+ ```javascript
20
+ async function fetch_data(url) {
21
+ const response = await fetch(url);
22
+ const data = await response.json();
23
+ return data;
24
+ }
25
+ ```
26
+
27
+ **AI Response:**
28
+ ```python
29
+ import aiohttp
30
+
31
+ async def fetch_data(url):
32
+ async with aiohttp.ClientSession() as session:
33
+ async with session.get(url) as response:
34
+ data = await response.json()
35
+ return data
36
+ ```
37
+
38
+ #### 2. Improving Written Code
39
+ You can ask the AI to enhance your code by adding comments, docstrings, and type hints for better readability and maintainability.
40
+
41
+ **Example Usage:**
42
+ ```
43
+ Improve this Python code, add Google docstrings and type hints.
44
+ Responses with the complete code and don't use placeholders.
45
+ Keep the comments:
46
+ ```
47
+ ```python
48
+ def calculate_area(radius):
49
+ # Calculate the area of a circle
50
+ return 3.14 * radius ** 2
51
+ ```
52
+
53
+ **AI Response:**
54
+ ```python
55
+ def calculate_area(radius: float) -> float:
56
+ """Calculate the area of a circle.
57
+
58
+ Args:
59
+ radius (float): The radius of the circle.
60
+
61
+ Returns:
62
+ float: The area of the circle.
63
+ """
64
+ return 3.14 * radius ** 2
65
+ ```
66
+
67
+ #### 3. Deobfuscating Unreadable Code
68
+ AI can help in making obfuscated or unreadable code more understandable and maintainable.
69
+
70
+ **Example Usage:**
71
+ ```
72
+ Deobfuscate this JavaScript code. Improve the readability:
73
+ ```
74
+
75
+ ```javascript
76
+ (function() {
77
+ var a = 'Hello', b = 'World';
78
+ console.log(a + ' ' + b);
79
+ })();
80
+ ```
81
+
82
+ **AI Response:**
83
+ ```javascript
84
+ (function() {
85
+ var greeting = 'Hello';
86
+ var subject = 'World';
87
+ console.log(greeting + ' ' + subject);
88
+ })();
89
+ ```
90
+
91
+ #### 4. Writing Custom Functions
92
+ You can also ask the AI to generate custom functions or help you with specific coding issues.
93
+
94
+ **Example Usage:**
95
+ ```
96
+ Write a function that returns the sum of two numbers.
97
+ ```
98
+
99
+ **AI Response:**
100
+ ```python
101
+ def add_numbers(a, b):
102
+ """Add two numbers together."""
103
+ return a + b
104
+ ```
105
+
106
+ These are just a few ways AI can revolutionize your coding experience. As AI technology continues to evolve, the possibilities are endless. So, embrace the future, unlock the power of AI, and watch your coding potential soar! 👷‍♂️
docs/guides/phone.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Guide: Running the G4F GUI on Your Smartphone
2
+
3
+ Running Python applications on your smartphone is possible with specialized apps like Pydroid. This tutorial will walk you through the process using an Android smartphone with Pydroid. Note that the steps may vary slightly for iPhone users due to differences in app names and ownership.
4
+
5
+ <p align="center">
6
+ On the first screenshot is <strong>Pydroid</strong> and on the second is the <strong>Web UI</strong> in a browser
7
+ </p>
8
+
9
+ <p align="center">
10
+ <img src="/docs/guides/phone.png" />
11
+ <img src="/docs/guides/phone2.jpeg" />
12
+ </p>
13
+
14
+ 1. **Install Pydroid from the Google Play Store:**
15
+ - Navigate to the Google Play Store and search for "Pydroid 3 - IDE for Python 3" or use the following link: [Pydroid 3 - IDE for Python 3](https://play.google.com/store/apps/details/Pydroid_3_IDE_for_Python_3).
16
+
17
+ 2. **Install the Pydroid Repository Plugin:**
18
+ - To enhance functionality, install the Pydroid repository plugin. Find it on the Google Play Store or use this link: [Pydroid Repository Plugin](https://play.google.com/store/apps/details?id=ru.iiec.pydroid3.quickinstallrepo).
19
+
20
+ 3. **Adjust App Settings:**
21
+ - In the app settings for Pydroid, disable power-saving mode and ensure that the option to pause when not in use is also disabled. This ensures uninterrupted operation of your Python scripts.
22
+
23
+ 4. **Install Required Packages:**
24
+ - Open Pip within the Pydroid app and install these necessary packages:
25
+ ```
26
+ g4f flask pillow beautifulsoup4
27
+ ```
28
+
29
+ 5. **Create a New Python Script:**
30
+ - Within Pydroid, create a new Python script and input the following content:
31
+ ```python
32
+ from g4f import set_cookies
33
+
34
+ set_cookies(".bing.com", {
35
+ "_U": "cookie value"
36
+ })
37
+
38
+ from g4f.gui import run_gui
39
+
40
+ run_gui("0.0.0.0", 8080, debug=True)
41
+ ```
42
+ Replace `"cookie value"` with your actual cookie value from Bing if you intend to create images using Bing.
43
+
44
+ 6. **Execute the Script:**
45
+ - Run the script by clicking on the play button or selecting the option to execute it.
46
+
47
+ 7. **Access the GUI:**
48
+ - Wait for the server to start, and once it's running, open the GUI using the URL provided in the output. [http://localhost:8080/chat/](http://localhost:8080/chat/)
49
+
50
+ By following these steps, you can successfully run the G4F GUI on your smartphone using Pydroid, allowing you to create and interact with graphical interfaces directly from your device.
docs/guides/phone.png ADDED
docs/guides/phone2.jpeg ADDED
docs/interference.md ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Interference openai-proxy API
2
+
3
+ #### Run interference API from PyPi package
4
+
5
+ ```python
6
+ from g4f.api import run_api
7
+
8
+ run_api()
9
+ ```
10
+
11
+ #### Run interference API from repo
12
+
13
+ Run server:
14
+
15
+ ```sh
16
+ g4f api
17
+ ```
18
+
19
+ or
20
+
21
+ ```sh
22
+ python -m g4f.api.run
23
+ ```
24
+
25
+ ```python
26
+ from openai import OpenAI
27
+
28
+ client = OpenAI(
29
+ api_key="",
30
+ # Change the API base URL to the local interference API
31
+ base_url="http://localhost:1337/v1"
32
+ )
33
+
34
+ response = client.chat.completions.create(
35
+ model="gpt-3.5-turbo",
36
+ messages=[{"role": "user", "content": "write a poem about a tree"}],
37
+ stream=True,
38
+ )
39
+
40
+ if isinstance(response, dict):
41
+ # Not streaming
42
+ print(response.choices[0].message.content)
43
+ else:
44
+ # Streaming
45
+ for token in response:
46
+ content = token.choices[0].delta.content
47
+ if content is not None:
48
+ print(content, end="", flush=True)
49
+ ```
50
+
51
+ #### API usage (POST)
52
+ Send the POST request to /v1/chat/completions with body containing the `model` method. This example uses python with requests library:
53
+ ```python
54
+ import requests
55
+ url = "http://localhost:1337/v1/chat/completions"
56
+ body = {
57
+ "model": "gpt-3.5-turbo-16k",
58
+ "stream": False,
59
+ "messages": [
60
+ {"role": "assistant", "content": "What can you do?"}
61
+ ]
62
+ }
63
+ json_response = requests.post(url, json=body).json().get('choices', [])
64
+
65
+ for choice in json_response:
66
+ print(choice.get('message', {}).get('content', ''))
67
+ ```
68
+
69
+ [Return to Home](/)
docs/legacy.md ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### G4F - Legacy API
2
+
3
+ #### ChatCompletion
4
+
5
+ ```python
6
+ import g4f
7
+
8
+ g4f.debug.logging = True # Enable debug logging
9
+ g4f.debug.version_check = False # Disable automatic version checking
10
+ print(g4f.Provider.Bing.params) # Print supported args for Bing
11
+
12
+ # Using automatic a provider for the given model
13
+ ## Streamed completion
14
+ response = g4f.ChatCompletion.create(
15
+ model="gpt-3.5-turbo",
16
+ messages=[{"role": "user", "content": "Hello"}],
17
+ stream=True,
18
+ )
19
+ for message in response:
20
+ print(message, flush=True, end='')
21
+
22
+ ## Normal response
23
+ response = g4f.ChatCompletion.create(
24
+ model=g4f.models.gpt_4,
25
+ messages=[{"role": "user", "content": "Hello"}],
26
+ ) # Alternative model setting
27
+
28
+ print(response)
29
+ ```
30
+
31
+ ##### Completion
32
+
33
+ ```python
34
+ import g4f
35
+
36
+ allowed_models = [
37
+ 'code-davinci-002',
38
+ 'text-ada-001',
39
+ 'text-babbage-001',
40
+ 'text-curie-001',
41
+ 'text-davinci-002',
42
+ 'text-davinci-003'
43
+ ]
44
+
45
+ response = g4f.Completion.create(
46
+ model='text-davinci-003',
47
+ prompt='say this is a test'
48
+ )
49
+
50
+ print(response)
51
+ ```
52
+
53
+ ##### Providers
54
+
55
+ ```python
56
+ import g4f
57
+
58
+ # Print all available providers
59
+ print([
60
+ provider.__name__
61
+ for provider in g4f.Provider.__providers__
62
+ if provider.working
63
+ ])
64
+
65
+ # Execute with a specific provider
66
+ response = g4f.ChatCompletion.create(
67
+ model="gpt-3.5-turbo",
68
+ provider=g4f.Provider.Aichat,
69
+ messages=[{"role": "user", "content": "Hello"}],
70
+ stream=True,
71
+ )
72
+ for message in response:
73
+ print(message)
74
+ ```
75
+
76
+
77
+ ##### Image Upload & Generation
78
+
79
+ Image upload and generation are supported by three main providers:
80
+
81
+ - **Bing & Other GPT-4 Providers:** Utilizes Microsoft's Image Creator.
82
+ - **Google Gemini:** Available for free accounts with IP addresses outside Europe.
83
+ - **OpenaiChat with GPT-4:** Accessible for users with a Plus subscription.
84
+
85
+ ```python
86
+ import g4f
87
+
88
+ # Setting up the request for image creation
89
+ response = g4f.ChatCompletion.create(
90
+ model=g4f.models.default, # Using the default model
91
+ provider=g4f.Provider.Gemini, # Specifying the provider as Gemini
92
+ messages=[{"role": "user", "content": "Create an image like this"}],
93
+ image=open("images/g4f.png", "rb"), # Image input can be a data URI, bytes, PIL Image, or IO object
94
+ image_name="g4f.png" # Optional: specifying the filename
95
+ )
96
+
97
+ # Displaying the response
98
+ print(response)
99
+
100
+ from g4f.image import ImageResponse
101
+
102
+ # Get image links from response
103
+ for chunk in g4f.ChatCompletion.create(
104
+ model=g4f.models.default, # Using the default model
105
+ provider=g4f.Provider.OpenaiChat, # Specifying the provider as OpenaiChat
106
+ messages=[{"role": "user", "content": "Create images with dogs"}],
107
+ access_token="...", # Need a access token from a plus user
108
+ stream=True,
109
+ ignore_stream=True
110
+ ):
111
+ if isinstance(chunk, ImageResponse):
112
+ print(chunk.images) # Print generated image links
113
+ print(chunk.alt) # Print used prompt for image generation
114
+ ```
115
+
116
+ ##### Using Browser
117
+
118
+ 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:
119
+
120
+ ```python
121
+ import g4f
122
+ from undetected_chromedriver import Chrome, ChromeOptions
123
+ from g4f.Provider import (
124
+ Bard,
125
+ Poe,
126
+ AItianhuSpace,
127
+ MyShell,
128
+ PerplexityAi,
129
+ )
130
+
131
+ options = ChromeOptions()
132
+ options.add_argument("--incognito");
133
+ webdriver = Chrome(options=options, headless=True)
134
+ for idx in range(10):
135
+ response = g4f.ChatCompletion.create(
136
+ model=g4f.models.default,
137
+ provider=g4f.Provider.MyShell,
138
+ messages=[{"role": "user", "content": "Suggest me a name."}],
139
+ webdriver=webdriver
140
+ )
141
+ print(f"{idx}:", response)
142
+ webdriver.quit()
143
+ ```
144
+
145
+ ##### Async Support
146
+
147
+ To enhance speed and overall performance, execute providers asynchronously. The total execution time will be determined by the duration of the slowest provider's execution.
148
+
149
+ ```python
150
+ import g4f
151
+ import asyncio
152
+
153
+ _providers = [
154
+ g4f.Provider.Aichat,
155
+ g4f.Provider.ChatBase,
156
+ g4f.Provider.Bing,
157
+ g4f.Provider.GptGo,
158
+ g4f.Provider.You,
159
+ g4f.Provider.Yqcloud,
160
+ ]
161
+
162
+ async def run_provider(provider: g4f.Provider.BaseProvider):
163
+ try:
164
+ response = await g4f.ChatCompletion.create_async(
165
+ model=g4f.models.default,
166
+ messages=[{"role": "user", "content": "Hello"}],
167
+ provider=provider,
168
+ )
169
+ print(f"{provider.__name__}:", response)
170
+ except Exception as e:
171
+ print(f"{provider.__name__}:", e)
172
+
173
+ async def run_all():
174
+ calls = [
175
+ run_provider(provider) for provider in _providers
176
+ ]
177
+ await asyncio.gather(*calls)
178
+
179
+ asyncio.run(run_all())
180
+ ```
181
+
182
+ ##### Proxy and Timeout Support
183
+
184
+ All providers support specifying a proxy and increasing timeout in the create functions.
185
+
186
+ ```python
187
+ import g4f
188
+
189
+ response = g4f.ChatCompletion.create(
190
+ model=g4f.models.default,
191
+ messages=[{"role": "user", "content": "Hello"}],
192
+ proxy="http://host:port",
193
+ # or socks5://user:pass@host:port
194
+ timeout=120, # in secs
195
+ )
196
+
197
+ print(f"Result:", response)
198
+ ```
199
+
200
+ [Return to Home](/)
docs/requirements.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### G4F - Additional Requirements
2
+
3
+ #### Introduction
4
+
5
+ You can install requirements partially or completely. So G4F can be used as you wish. You have the following options for this:
6
+
7
+ #### Options
8
+
9
+ Install g4f with all possible dependencies:
10
+ ```
11
+ pip install -U g4f[all]
12
+ ```
13
+ Or install only g4f and the required packages for the OpenaiChat provider:
14
+ ```
15
+ pip install -U g4f[openai]
16
+ ```
17
+ Install required packages for the Interference API:
18
+ ```
19
+ pip install -U g4f[api]
20
+ ```
21
+ Install required packages for the Web UI:
22
+ ```
23
+ pip install -U g4f[gui]
24
+ ```
25
+ Install required packages for uploading / generating images:
26
+ ```
27
+ pip install -U g4f[image]
28
+ ```
29
+ Install required packages for using the webdriver:
30
+ ```
31
+ pip install -U g4f[webdriver]
32
+ ```
33
+ Install required package for proxy support with aiohttp:
34
+ ```
35
+ pip install -U aiohttp_socks
36
+ ```
37
+ Install required package for loading cookies from browser:
38
+ ```
39
+ pip install browser_cookie3
40
+ ```
41
+ Install curl_cffi for better protection from being blocked:
42
+ ```
43
+ pip install curl_cffi
44
+ ```
45
+ Install all packages and uninstall this package for disabling the webdriver:
46
+ ```
47
+ pip uninstall undetected-chromedriver
48
+ ```
49
+
50
+ [Return to Home](/)
docs/waterfall.jpeg ADDED
docs/webview.md ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### G4F - Webview GUI
2
+
3
+ Open the GUI in a window of your OS. Runs on a local/static/ssl server and use a JavaScript API.
4
+ Supports login into the OpenAI Chat (.har files), Image Upload and streamed Text Generation.
5
+
6
+ Supports all platforms, but only Linux/Windows tested.
7
+
8
+ 1. Install all python requirements with:
9
+
10
+ ```bash
11
+ pip install g4f[webview]
12
+ ```
13
+
14
+ 2. *a)* Follow the **OS specific** steps here:
15
+ [pywebview installation](https://pywebview.flowrl.com/guide/installation.html#dependencies)
16
+
17
+ 2. *b)* **WebView2** on **Windows**: Our application requires the *WebView2 Runtime* to be installed on your system. If you do not have it installed, please download and install it from the [Microsoft Developer Website](https://developer.microsoft.com/en-us/microsoft-edge/webview2/). If you already have *WebView2 Runtime* installed but are encountering issues, navigate to *Installed Windows Apps*, select *WebView2*, and opt for the repair option.
18
+
19
+ 3. Run the app with:
20
+
21
+ ```python
22
+ from g4f.gui.webview import run_webview
23
+ run_webview(debug=True)
24
+ ```
25
+ or execute the following command:
26
+ ```bash
27
+ python -m g4f.gui.webview -debug
28
+ ```
29
+
30
+ [Return to Home](/)
etc/examples/api.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import json
3
+ url = "http://localhost:1337/v1/chat/completions"
4
+ body = {
5
+ "model": "",
6
+ "provider": "MetaAI",
7
+ "stream": True,
8
+ "messages": [
9
+ {"role": "assistant", "content": "What can you do? Who are you?"}
10
+ ]
11
+ }
12
+ lines = requests.post(url, json=body, stream=True).iter_lines()
13
+ for line in lines:
14
+ if line.startswith(b"data: "):
15
+ try:
16
+ print(json.loads(line[6:]).get("choices", [{"delta": {}}])[0]["delta"].get("content", ""), end="")
17
+ except json.JSONDecodeError:
18
+ pass
19
+ print()
etc/examples/ecosia.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import g4f
3
+ from g4f.client import AsyncClient
4
+
5
+ async def main():
6
+ client = AsyncClient(
7
+ provider=g4f.Provider.Ecosia,
8
+ )
9
+ async for chunk in client.chat.completions.create(
10
+ [{"role": "user", "content": "happy dogs on work. write some lines"}],
11
+ g4f.models.default,
12
+ stream=True,
13
+ green=True,
14
+ ):
15
+ print(chunk.choices[0].delta.content or "", end="")
16
+ print(f"\nwith {chunk.model}")
17
+
18
+ asyncio.run(main())
etc/examples/openaichat.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from g4f.client import Client
2
+ from g4f.Provider import OpenaiChat, RetryProvider
3
+
4
+ # compatible countries: https://pastebin.com/UK0gT9cn
5
+ client = Client(
6
+ proxies = {
7
+ 'http': 'http://username:password@host:port', # MUST BE WORKING OPENAI COUNTRY PROXY ex: USA
8
+ 'https': 'http://username:password@host:port' # MUST BE WORKING OPENAI COUNTRY PROXY ex: USA
9
+ },
10
+ provider = RetryProvider([OpenaiChat],
11
+ single_provider_retry=True, max_retries=5)
12
+ )
13
+
14
+ messages = [
15
+ {'role': 'user', 'content': 'Hello'}
16
+ ]
17
+
18
+ response = client.chat.completions.create(model='gpt-3.5-turbo',
19
+ messages=messages,
20
+ stream=True)
21
+
22
+ for message in response:
23
+ print(message.choices[0].delta.content or "")
etc/testing/_providers.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ from pathlib import Path
3
+ from colorama import Fore, Style
4
+
5
+ sys.path.append(str(Path(__file__).parent.parent))
6
+
7
+ from g4f import Provider, ProviderType, models
8
+ from g4f.Provider import __providers__
9
+
10
+
11
+ def main():
12
+ providers = get_providers()
13
+ failed_providers = []
14
+
15
+ for provider in providers:
16
+ if provider.needs_auth:
17
+ continue
18
+ print("Provider:", provider.__name__)
19
+ result = test(provider)
20
+ print("Result:", result)
21
+ if provider.working and not result:
22
+ failed_providers.append(provider)
23
+ print()
24
+
25
+ if failed_providers:
26
+ print(f"{Fore.RED + Style.BRIGHT}Failed providers:{Style.RESET_ALL}")
27
+ for _provider in failed_providers:
28
+ print(f"{Fore.RED}{_provider.__name__}")
29
+ else:
30
+ print(f"{Fore.GREEN + Style.BRIGHT}All providers are working")
31
+
32
+
33
+ def get_providers() -> list[ProviderType]:
34
+ return [
35
+ provider
36
+ for provider in __providers__
37
+ if provider.__name__ not in dir(Provider.deprecated)
38
+ and provider.__name__ not in dir(Provider.unfinished)
39
+ and provider.url is not None
40
+ ]
41
+
42
+ def create_response(provider: ProviderType) -> str:
43
+ response = provider.create_completion(
44
+ model=models.default.name,
45
+ messages=[{"role": "user", "content": "Hello, who are you? Answer in detail much as possible."}],
46
+ stream=False,
47
+ )
48
+ return "".join(response)
49
+
50
+ def test(provider: ProviderType) -> bool:
51
+ try:
52
+ response = create_response(provider)
53
+ assert type(response) is str
54
+ assert len(response) > 0
55
+ return response
56
+ except Exception:
57
+ return False
58
+
59
+
60
+ if __name__ == "__main__":
61
+ main()
62
+
etc/testing/log_time.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from time import time
2
+
3
+
4
+ async def log_time_async(method: callable, **kwargs):
5
+ start = time()
6
+ result = await method(**kwargs)
7
+ secs = f"{round(time() - start, 2)} secs"
8
+ return " ".join([result, secs]) if result else secs
9
+
10
+
11
+ def log_time_yield(method: callable, **kwargs):
12
+ start = time()
13
+ result = yield from method(**kwargs)
14
+ yield f" {round(time() - start, 2)} secs"
15
+
16
+
17
+ def log_time(method: callable, **kwargs):
18
+ start = time()
19
+ result = method(**kwargs)
20
+ secs = f"{round(time() - start, 2)} secs"
21
+ return " ".join([result, secs]) if result else secs
etc/testing/test_all.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import sys
3
+ from pathlib import Path
4
+ sys.path.append(str(Path(__file__).parent.parent.parent))
5
+
6
+ import g4f
7
+
8
+
9
+ async def test(model: g4f.Model):
10
+ try:
11
+ try:
12
+ for response in g4f.ChatCompletion.create(
13
+ model=model,
14
+ messages=[{"role": "user", "content": "write a poem about a tree"}],
15
+ temperature=0.1,
16
+ stream=True
17
+ ):
18
+ print(response, end="")
19
+
20
+ print()
21
+ except:
22
+ for response in await g4f.ChatCompletion.create_async(
23
+ model=model,
24
+ messages=[{"role": "user", "content": "write a poem about a tree"}],
25
+ temperature=0.1,
26
+ stream=True
27
+ ):
28
+ print(response, end="")
29
+
30
+ print()
31
+
32
+ return True
33
+ except Exception as e:
34
+ print(model.name, "not working:", e)
35
+ print(e.__traceback__.tb_next)
36
+ return False
37
+
38
+
39
+ async def start_test():
40
+ models_to_test = [
41
+ # GPT-3.5 4K Context
42
+ g4f.models.gpt_35_turbo,
43
+ g4f.models.gpt_35_turbo_0613,
44
+
45
+ # GPT-3.5 16K Context
46
+ g4f.models.gpt_35_turbo_16k,
47
+ g4f.models.gpt_35_turbo_16k_0613,
48
+
49
+ # GPT-4 8K Context
50
+ g4f.models.gpt_4,
51
+ g4f.models.gpt_4_0613,
52
+
53
+ # GPT-4 32K Context
54
+ g4f.models.gpt_4_32k,
55
+ g4f.models.gpt_4_32k_0613,
56
+ ]
57
+
58
+ models_working = []
59
+
60
+ for model in models_to_test:
61
+ if await test(model):
62
+ models_working.append(model.name)
63
+
64
+ print("working models:", models_working)
65
+
66
+
67
+ asyncio.run(start_test())
etc/testing/test_api.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import openai
2
+
3
+ # Set your Hugging Face token as the API key if you use embeddings
4
+ # If you don't use embeddings, leave it empty
5
+ openai.api_key = "YOUR_HUGGING_FACE_TOKEN" # Replace with your actual token
6
+
7
+ # Set the API base URL if needed, e.g., for a local development environment
8
+ openai.api_base = "http://localhost:1337/v1"
9
+
10
+ def main():
11
+ response = openai.ChatCompletion.create(
12
+ model="gpt-3.5-turbo",
13
+ messages=[{"role": "user", "content": "write a poem about a tree"}],
14
+ stream=True,
15
+ )
16
+ if isinstance(response, dict):
17
+ # Not streaming
18
+ print(response.choices[0].message.content)
19
+ else:
20
+ # Streaming
21
+ for token in response:
22
+ content = token["choices"][0]["delta"].get("content")
23
+ if content is not None:
24
+ print(content, end="", flush=True)
25
+
26
+ if __name__ == "__main__":
27
+ main()
etc/testing/test_async.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ from pathlib import Path
3
+ import asyncio
4
+
5
+ sys.path.append(str(Path(__file__).parent.parent))
6
+ sys.path.append(str(Path(__file__).parent.parent.parent))
7
+
8
+ import g4f
9
+ from testing._providers import get_providers
10
+ from testing.log_time import log_time_async
11
+
12
+ async def create_async(provider):
13
+ try:
14
+ response = await log_time_async(
15
+ provider.create_async,
16
+ model=g4f.models.default.name,
17
+ messages=[{"role": "user", "content": "Hello, are you GPT 3.5?"}]
18
+ )
19
+ print(f"{provider.__name__}:", response)
20
+ except Exception as e:
21
+ print(f"{provider.__name__}: {e.__class__.__name__}: {e}")
22
+
23
+ async def run_async():
24
+ responses: list = [
25
+ create_async(provider)
26
+ for provider in get_providers()
27
+ if provider.working
28
+ ]
29
+ await asyncio.gather(*responses)
30
+
31
+ print("Total:", asyncio.run(log_time_async(run_async)))
etc/testing/test_chat_completion.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ from pathlib import Path
3
+
4
+ sys.path.append(str(Path(__file__).parent.parent.parent))
5
+
6
+ import g4f, asyncio
7
+
8
+ print("create:", end=" ", flush=True)
9
+ for response in g4f.ChatCompletion.create(
10
+ model=g4f.models.default,
11
+ provider=g4f.Provider.Bing,
12
+ messages=[{"role": "user", "content": "write a poem about a tree"}],
13
+ stream=True
14
+ ):
15
+ print(response, end="", flush=True)
16
+ print()
17
+
18
+ async def run_async():
19
+ response = await g4f.ChatCompletion.create_async(
20
+ model=g4f.models.default,
21
+ provider=g4f.Provider.Bing,
22
+ messages=[{"role": "user", "content": "hello!"}],
23
+ )
24
+ print("create_async:", response)
25
+
26
+ asyncio.run(run_async())
etc/testing/test_gui.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import sys
2
+ from pathlib import Path
3
+ sys.path.append(str(Path(__file__).parent.parent.parent))
4
+
5
+ from g4f.gui import run_gui
6
+ run_gui()
etc/testing/test_interference.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # type: ignore
2
+ import openai
3
+
4
+ openai.api_key = ""
5
+ openai.api_base = "http://localhost:1337"
6
+
7
+
8
+ def main():
9
+ chat_completion = openai.ChatCompletion.create(
10
+ model="gpt-3.5-turbo",
11
+ messages=[{"role": "user", "content": "write a poem about a tree"}],
12
+ stream=True,
13
+ )
14
+
15
+ if isinstance(chat_completion, dict):
16
+ # not stream
17
+ print(chat_completion.choices[0].message.content)
18
+ else:
19
+ # stream
20
+ for token in chat_completion:
21
+ content = token["choices"][0]["delta"].get("content")
22
+ if content != None:
23
+ print(content, end="", flush=True)
24
+
25
+
26
+ if __name__ == "__main__":
27
+ main()