g4fu

raw JSON →
10.3.2.4 verified Sat May 09 auth: no python

Fork of the gpt4free repository providing a collection of powerful language models for educational purposes only. Current version 10.3.2.4, with rapid releases and occasional yanked versions.

pip install g4fu
error ImportError: cannot import name 'Client' from 'g4fu'
cause Outdated version or incorrect import path.
fix
Update g4fu to >=10.3.2.4 and use 'from g4fu import Client'.
error ModuleNotFoundError: No module named 'g4fu'
cause Package not installed.
fix
Install with 'pip install g4fu'.
gotcha The package is a fork and may have breaking changes from the original gpt4free. Always pin your version.
fix Use g4fu==10.3.2.4 in your requirements.
breaking Version 10.3.2.2 was yanked due to module loading issues. Avoid using that version.
fix Upgrade to 10.3.2.4 or later.
deprecated The package is intended for educational purposes only and may be removed or changed without notice.
fix Do not rely on it in production.

Initialize a Client with an API key and send a chat completion request.

from g4fu import Client

client = Client(api_key=os.environ.get('G4FU_API_KEY', ''))
response = client.chat.completions.create(
    model='gpt-4',
    messages=[{'role': 'user', 'content': 'Hello!'}]
)
print(response.choices[0].message.content)