missuo / FreeGPT35

Utilize the unlimited free GPT-3.5-Turbo API service provided by the login-free ChatGPT Web.
GNU Affero General Public License v3.0
3.34k stars 1.03k forks source link

python client can not be used. #25

Closed OpenJarvisAI closed 7 months ago

OpenJarvisAI commented 7 months ago

Since

client = OpenAI(
        api_key="sk-fwref", base_url=base_url
    )

    a = client.models.list()

the Client will call base_url model list inside to connect, but it cannot return a response, how to make it work with python client?

missuo commented 7 months ago
import openai

openai.api_key = 'anything'
openai.base_url = "http://localhost:3040/v1/"

completion = openai.chat.completions.create(
    model="gpt-3.5-turbo",
    messages=[
        {"role": "user", "content": "Hello"},
    ],
)

print(completion.choices[0].message.content)