Client error using openai 1.6.1 say i given two argument but only have one

The default method of the openai python library is to use an OPENAI_API_KEY environment variable set in your operating system. Then the API calls just work everywhere.

The client creation accepts parameters which are non-positional, meaning you need to specify the name of the parameter you are setting, such as:

from openai import OpenAI
o_client = OpenAI(timeout = 60)

That is the same way you would specify the parameter api_key and its value.

1 Like