Closed Judimax closed 2 months ago
Technically this question should be asked in the g4f repository, but since I'm here...
If you are using g4f api and want to specify a provider, here's two ways:
Remove from this command the provider you want to use.
g4f api --debug DEBUG --ignored-providers AItianhu AItianhuSpace Acytoo AiAsk AiChatOnline AiChatting AiService Aibn Aichat Ails Aivvm AsyncGeneratorProvider AsyncProvider Aura Bard BaseProvider Berlin Bestim Bing ChatAiGpt ChatAnywhere ChatBase ChatForAi Chatgpt4Online ChatgptAi ChatgptDemo ChatgptDemoAi OpenaiChat ChatgptDuo ChatgptFree ChatgptLogin ChatgptNext ChatgptX Chatxyz CodeLinkAva CreateImagesProvider Cromicle DeepInfra DfeHub EasyChat Equing FakeGpt FastGpt Forefront FreeChatgpt FreeGpt GPTalk GeekGpt Gemini GetGpt Gpt6 GptChatly GptForLove GptGo GptGod GptTalkRu H2o Hashnode HuggingChat Koala Komo Liaobots Llama2 Lockchat MikuChat MyShell Myshell OnlineGpt Opchatgpts OpenAssistant PerplexityAi PerplexityLabs Phind Pi Poe Raycast RetryProvider TalkAi Theb ThebApi V50 Vercel Vitalentum Wewordle Wuguokai Ylokh You Yqcloud
Add {"provider": "Provider"}
to your request body
e.g:
from openai import OpenAI
client = OpenAI(
api_key="asdf",
base_url="http://localhost:1337/v1"
)
response = client.chat.completions.create(
model="gpt-3.5-turbo",
extra_body={"provider": "You"},
messages=[{"role": "user", "content": "write a poem about a tree"}],
)
print(response.choices[0].message.content)
For more info, check https://github.com/xtekky/gpt4free/issues/1584
Greetings I get this error I tried looking around in the g4f docs on how to swithch providers to no avail