# pip install openai
import os

from openai import OpenAI

client = OpenAI(base_url="https://api.klinch.cloud/v1", api_key=os.environ["KLINCH_API_KEY"])

stream = client.chat.completions.create(
    model="gpt-6.2-sol",
    messages=[{"role": "user", "content": "Write a short poem about the sea"}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
print()
