主题
from openai import OpenAI
client = OpenAI(
base_url="https://az.gptplus5.com/v1",
api_key="sk-xxxx"
)
stream = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Say this is a test"}],
stream=True,
)
for chunk in stream:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")