diff options
author | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-02-22 04:35:11 +0100 |
---|---|---|
committer | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-02-22 04:35:11 +0100 |
commit | 1b4a86a857d9f9b77e0c7f0cd87468b627a250c8 (patch) | |
tree | f8a7102b0c633c6460a2e5fd9326434e18dfc9c6 /docs/client.md | |
parent | Move some modules, create providers dir (diff) | |
download | gpt4free-1b4a86a857d9f9b77e0c7f0cd87468b627a250c8.tar gpt4free-1b4a86a857d9f9b77e0c7f0cd87468b627a250c8.tar.gz gpt4free-1b4a86a857d9f9b77e0c7f0cd87468b627a250c8.tar.bz2 gpt4free-1b4a86a857d9f9b77e0c7f0cd87468b627a250c8.tar.lz gpt4free-1b4a86a857d9f9b77e0c7f0cd87468b627a250c8.tar.xz gpt4free-1b4a86a857d9f9b77e0c7f0cd87468b627a250c8.tar.zst gpt4free-1b4a86a857d9f9b77e0c7f0cd87468b627a250c8.zip |
Diffstat (limited to 'docs/client.md')
-rw-r--r-- | docs/client.md | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/docs/client.md b/docs/client.md index f2ba9bcd..6cc08ac3 100644 --- a/docs/client.md +++ b/docs/client.md @@ -2,13 +2,13 @@ #### Introduction -The G4F Client API introduces a new way to integrate advanced AI functionalities into your Python applications. This guide will help you transition from using the OpenAI client to the new G4F Client, offering compatibility with the existing OpenAI API alongside additional features. +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. #### Getting Started **Switching to G4F Client:** -Replace the OpenAI client import statement in your Python code as follows: +To begin using the G4F Client, simply update your import statement in your Python code: Old Import: ```python @@ -20,11 +20,11 @@ New Import: from g4f.client import Client as OpenAI ``` -The G4F Client maintains the same API interface as OpenAI, ensuring a seamless transition. +The G4F Client preserves the same familiar API interface as OpenAI, ensuring a smooth transition process. -#### Initializing the Client +### Initializing the Client -To use the G4F Client, create an instance with customized providers: +To utilize the G4F Client, create an new instance. Below is an example showcasing custom providers: ```python from g4f.client import Client @@ -33,7 +33,18 @@ from g4f.Provider import BingCreateImages, OpenaiChat, Gemini client = Client( provider=OpenaiChat, image_provider=Gemini, - proxies=None + ... +) +``` + +You also have the option to define a proxy in the client for all outgoing requests: + +```python +from g4f.client import Client + +client = Client( + proxies="http://user:pass@host", + ... ) ``` |