Skip to content

Instantly share code, notes, and snippets.

@dzianisv
Created July 21, 2023 10:38
Show Gist options
  • Select an option

  • Save dzianisv/5ba6dd217d083b9a3de8416c9f940b15 to your computer and use it in GitHub Desktop.

Select an option

Save dzianisv/5ba6dd217d083b9a3de8416c9f940b15 to your computer and use it in GitHub Desktop.
GPT for Free
#!/usr/bin/env python3
import g4f
from g4f.Provider import *
import inspect
providers = [Ails,
You,
Bing,
Yqcloud,
Theb,
Aichat,
Bard,
Vercel,
Forefront,
Lockchat,
Liaobots,
H2o,
ChatgptLogin,
DeepAi,
GetGpt,
AItianhu,
EasyChat,
Acytoo,
DfeHub,
AiService,
BingHuan,
Wewordle,
ChatgptAi
]
for provider in providers:
try:
response = g4f.ChatCompletion.create(model=g4f.Model.gpt_35_turbo, provider=provider, messages=[
{"role": "user", "content": "Hello world"}], stream=True)
for message in response:
print(message)
print(f"{provider.__name__} is good")
except Exception as e:
print(f"{provider.__name__} failed with {e}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment