使用此存储库或与之相关的任何代码,即表示你同意法律声明。作者不对本存储库的使用负责,也不认可它,作者也不对其他用户制作的任何副本、分叉、重新上传或与 GPT4Free 相关的任何其他内容负责。这是作者唯一的帐户和存储库。为防止冒充或不负责任的行为,请遵守本存储库使用的 GNU GPL 许可证。
[!警告] “gpt4free” 用作 PoC(概念验证),演示了具有多提供者请求的 api 包的开发,具有超时、负载均衡和流量控制等功能。
pip install -U g4f
docker pull hlohaus789/g4f
你的网站是否在这个存储库中,你想把它删除?通过电子邮件 takedown@g4f.ai 证明它是你的,它将尽快删除。- 为防止复制,请保护你的 API;)
你可以随时在这里留下一些反馈:https://forms.gle/FeWV9RLEedfdkmFN6
根据调查,以下是即将到来的改进列表
Openai()
g4f.client.Client
docker pull hlohaus789/g4f
docker run -p 8080:8080 -p 1337:1337 -p 7900:7900 --shm-size="2g" hlohaus789/g4f:latest
pip install -U g4f[all]
或者使用部分要求。
请参见:/docs/requirements
请参阅:/docs/git
请参见:/docs/docker
使用 Python
from g4f.client import Client
client = Client()
response = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": "Say this is a test"}],
...
)
print(response.choices[0].message.content)
使用 Python
from g4f.client import Client
client = Client()
response = client.images.generate(
model="gemini",
prompt="a white siamese cat",
...
)
image_url = response.data[0].url
结果:
另请参阅 Python:
要启动 Web 界面,请在 python 中键入以下代码:
from g4f.gui import run_gui
run_gui()
或执行以下命令:
python -m g4f.cli gui -port 8080 -debug
你可以使用 Interference API 为其他 OpenAI 与 G4F 的集成提供服务。
请参见:/docs/interference
要使用 Bing 和 OpenAi Chat 生成图像,你需要 cookie 或来自浏览器会话的令牌。在 Bing 中,你需要“_U”cookie,而在 OpenAI 中,你需要“access_token”。你可以在 create 函数中传递 cookie / 访问令牌,或者在运行 G4F 之前使用 setter:
set_cookies
from g4f.cookies import set_cookies
set_cookies(".bing.com", {
"_U": "cookie value"
})
set_cookies("chat.openai.com", {
"access_token": "token value"
})
set_cookies(".google.com", {
"__Secure-1PSID": "cookie value"
})
...
或者,G4F 从你的浏览器读取 cookie 或者它使用 Selenium 启动浏览器实例以进行登录。
browser_cookie3
webdriver
如果要隐藏或更改提供商的 IP 地址,可以通过环境变量全局设置代理:
export G4F_PROXY="http://host:port"
set G4F_PROXY=http://host:port
网站 | 供应商 | GPT-3.5的 | GPT-4的 | 流 | 地位 | 认证 |
---|---|---|---|---|---|---|
bing.com | g4f.Provider.Bing |
❌ | ✔️ | ✔️ | ❌ | |
free.chatgpt.org.uk | g4f.Provider.FreeChatgpt |
✔️ | ✔️ | ✔️ | ❌ | |
liaobots.site | g4f.Provider.Liaobots |
✔️ | ✔️ | ✔️ | ❌ | |
chat.openai.com | g4f.Provider.OpenaiChat |
✔️ | ✔️ | ✔️ | ✔️ | |
raycast.com | g4f.Provider.Raycast |
✔️ | ✔️ | ✔️ | ✔️ | |
beta.theb.ai | g4f.Provider.Theb |
✔️ | ✔️ | ✔️ | ❌ | |
chat.geekgpt.org | g4f.Provider.GeekGpt |
✔️ | ✔️ | ✔️ | ❌ |
网站 | 供应商 | GPT-3.5的 | GPT-4的 | 流 | 地位 | 认证 |
---|---|---|---|---|---|---|
chat3.aiyunos.top | g4f.Provider.AItianhuSpace |
✔️ | ❌ | ✔️ | ❌ | |
aichatonline.org | g4f.Provider.AiChatOnline |
✔️ | ❌ | ✔️ | ❌ | |
openchat.team | g4f.Provider.Aura |
✔️ | ❌ | ✔️ | ❌ | |
chatbase.co | g4f.Provider.ChatBase |
✔️ | ❌ | ✔️ | ❌ | |
chatforai.store | g4f.Provider.ChatForAi |
✔️ | ❌ | ✔️ | ❌ | |
chatgpt.ai | g4f.Provider.ChatgptAi |
✔️ | ❌ | ✔️ | ❌ | |
chat.chatgptdemo.net | g4f.Provider.ChatgptDemo |
✔️ | ❌ | ✔️ | ❌ | |
chatgpt-free.cc | g4f.Provider.ChatgptNext |
✔️ | ❌ | ✔️ | ❌ | |
chat.3211000.xyz | g4f.Provider.Chatxyz |
✔️ | ❌ | ✔️ | ❌ | |
gptalk.net | g4f.Provider.GPTalk |
✔️ | ❌ | ✔️ | ❌ | |
geminiprochat.com | g4f.Provider.GeminiProChat |
✔️ | ❌ | ✔️ | ❌ | |
gpt6.ai | g4f.Provider.Gpt6 |
✔️ | ❌ | ✔️ | ❌ | |
gptchatly.com | g4f.Provider.GptChatly |
✔️ | ❌ | ❌ | ❌ | |
ai18.gptforlove.com | g4f.Provider.GptForLove |
✔️ | ❌ | ✔️ | ❌ | |
gptgo.ai | g4f.Provider.GptGo |
✔️ | ❌ | ✔️ | ❌ | |
gpttalk.ru | g4f.Provider.GptTalkRu |
✔️ | ❌ | ✔️ | ❌ | |
koala.sh | g4f.Provider.Koala |
✔️ | ❌ | ✔️ | ❌ | |
app.myshell.ai | g4f.Provider.MyShell |
✔️ | ❌ | ✔️ | ❌ | |
onlinegpt.org | g4f.Provider.OnlineGpt |
✔️ | ❌ | ✔️ | ❌ | |
perplexity.ai | g4f.Provider.PerplexityAi |
✔️ | ❌ | ✔️ | ❌ | |
poe.com | g4f.Provider.Poe |
✔️ | ❌ | ✔️ | ✔️ | |
talkai.info | g4f.Provider.TalkAi |
✔️ | ❌ | ✔️ | ❌ | |
you.com | g4f.Provider.You |
✔️ | ❌ | ✔️ | ❌ | |
aitianhu.com | g4f.Provider.AItianhu |
✔️ | ❌ | ✔️ | ❌ | |
e.aiask.me | g4f.Provider.AiAsk |
✔️ | ❌ | ✔️ | ❌ | |
chatgpt.bestim.org | g4f.Provider.Bestim |
✔️ | ❌ | ✔️ | ❌ | |
chatanywhere.cn | g4f.Provider.ChatAnywhere |
✔️ | ❌ | ✔️ | ❌ | |
chatgpt4online.org | g4f.Provider.Chatgpt4Online |
✔️ | ❌ | ✔️ | ❌ | |
chat.chatgptdemo.ai | g4f.Provider.ChatgptDemoAi |
✔️ | ❌ | ✔️ | ❌ | |
chatgptfree.ai | g4f.Provider.ChatgptFree |
✔️ | ❌ | ❌ | ❌ | |
chatgptlogin.ai | g4f.Provider.ChatgptLogin |
✔️ | ❌ | ✔️ | ❌ | |
chatgptx.de | g4f.Provider.ChatgptX |
✔️ | ❌ | ✔️ | ❌ | |
chat-shared2.zhile.io | g4f.Provider.FakeGpt |
✔️ | ❌ | ✔️ | ❌ | |
freegpts1.aifree.site | g4f.Provider.FreeGpt |
✔️ | ❌ | ✔️ | ❌ | |
gptgod.site | g4f.Provider.GptGod |
✔️ | ❌ | ✔️ | ❌ | |
hashnode.com | g4f.Provider.Hashnode |
✔️ | ❌ | ✔️ | ❌ | |
sdk.vercel.ai | g4f.Provider.Vercel |
✔️ | ❌ | ✔️ | ❌ | |
chat.ylokh.xyz | g4f.Provider.Ylokh |
✔️ | ❌ | ✔️ | ❌ |
网站 | 供应商 | GPT-3.5的 | GPT-4的 | 流 | 地位 | 认证 |
---|---|---|---|---|---|---|
bard.google.com | g4f.Provider.Bard |
❌ | ❌ | ❌ | ✔️ | |
deepinfra.com | g4f.Provider.DeepInfra |
❌ | ❌ | ✔️ | ❌ | |
gemini.google.com | g4f.Provider.Gemini |
❌ | ❌ | ❌ | ✔️ | |
huggingface.co | g4f.Provider.HuggingChat |
❌ | ❌ | ✔️ | ❌ | |
llama2.ai | g4f.Provider.Llama2 |
❌ | ❌ | ✔️ | ❌ | |
labs.perplexity.ai | g4f.Provider.PerplexityLabs |
❌ | ❌ | ✔️ | ❌ | |
phind.com | g4f.Provider.Phind |
❌ | ❌ | ✔️ | ❌ | |
pi.ai | g4f.Provider.Pi |
❌ | ❌ | ✔️ | ❌ | |
theb.ai | g4f.Provider.ThebApi |
❌ | ❌ | ❌ | ✔️ | |
open-assistant.io | g4f.Provider.OpenAssistant |
❌ | ❌ | ✔️ | ✔️ |
型 | 基本提供程序 | 供应商 | 网站 |
---|---|---|---|
GPT-3.5-涡轮增压 | OpenAI的 | 5+ 供应商 | openai.com |
GPT-4型 | OpenAI的 | 2+ 供应商 | openai.com |
GPT-4-涡轮增压 | OpenAI的 | G4F。Provider.Bing | openai.com |
骆驼-2-7b-chat-hf | 拥抱脸 | 2+ 供应商 | huggingface.co |
骆驼-2-13b-chat-hf | 拥抱脸 | 2+ 供应商 | huggingface.co |
骆驼-2-70b-chat-hf | 拥抱脸 | 4+ 供应商 | huggingface.co |
代码Llama-34b-Instruct-hf | 拥抱脸 | 3+ 供应商 | huggingface.co |
混音-8x7B-Instruct-v0.1 | 拥抱脸 | 3+ 供应商 | huggingface.co |
Mistral-7B-Instruct-v0.1 | 拥抱脸 | 3+ 供应商 | huggingface.co |
海豚-2.6-混合体-8x7B | 拥抱脸 | G4F。提供程序.DeepInfra | huggingface.co |
lzlv_70b_fp16_hf | 拥抱脸 | G4F。提供程序.DeepInfra | huggingface.co |
艾罗波罗斯-70B | 拥抱脸 | G4F。提供程序.DeepInfra | huggingface.co |
艾罗波罗斯-L2-70B-GPT4-1.4.1 | 拥抱脸 | G4F。提供程序.DeepInfra | huggingface.co |
openchat_3.5 | 拥抱脸 | 2+ 供应商 | huggingface.co |
双子座 | 谷歌 | G4F。Provider.Gemini | gemini.google.com |
双子座-专业版 | 谷歌 | 2+ 供应商 | gemini.google.com |
克劳德-V2 | 人为 | 2+ 供应商 | anthropic.com |
圆周率 | 屈折 | G4F。提供程序.Pi | inflection.ai |
在终端中调用脚本:
create_provider.py
python etc/tool/create_provider.py
cURL
from __future__ import annotations
from ..typing import AsyncResult, Messages
from .base_provider import AsyncGeneratorProvider
class HogeService(AsyncGeneratorProvider):
url = "https://chat-gpt.com"
working = True
supports_gpt_35_turbo = True
@classmethod
async def create_async_generator(
cls,
model: str,
messages: Messages,
proxy: str = None,
**kwargs
) -> AsyncResult:
yield ""
supports_stream
True
create_async_generator
yield
g4f/provider/__init__.py
中添加提供程序名称
from .HogeService import HogeService
__all__ = [
HogeService,
]
import g4f
response = g4f.ChatCompletion.create(model='gpt-3.5-turbo', provider=g4f.Provider.PROVIDERNAME,
messages=[{"role": "user", "content": "test"}], stream=g4f.Provider.PROVIDERNAME.supports_stream)
for message in response:
print(message, flush=True, end='')
贡献者列表可在此处
获得 Vercel.py
文件包含来自 @ading2210 的 vercel-llm-api 的代码,该代码根据 GNU GPL v3 获得许可
前 1 名贡献者:@hlohaus
该程序在 GNU GPL v3 下获得许可
xtekky/gpt4free: Copyright (C) 2023 xtekky This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
本项目在 GNU_GPL_v3.0 下获得许可。 |
(🔼 返回页首)