g4f is very similar to the OpenAI Python Sdk, the g4f completion syntax was made to work exactly like the sdk with some ClassNames being different.The Client Class
As of the new v1 library of the OpenAi sdk, g4f is initialised with the g4f.client.Client class.
Clientclass accepts several arguments, you can set a default provider there. More on the Provider structure of g4f further down.
Client(...) Class Arguments
The provider to use for the client. If not specified, the default provider will be used.
The image provider provider to use for the client. If not specified, the default provider will be used.
Create completions
Once initialised, you can use theclient object to create chat completions. Here again, client.chat.completions.create works like the OpenAI sdk, with the same parameters.
create(...) basic Params
(For more advanced params and usage and examples, refer to the Full Documentation)
The provider to use for the chat completion. Imported from 
g4f.Provider.ProviderName. Different working providers are outlined in the g4f README.If set, the completion will be streamed, i.e. Tokens will be sent sequentially as soon as generated.
create will return a generator.Stream completions
You may want to useg4f with streaming Response, you can do this with stream=True in the client.chat.completions.create method.