from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.星高算力/v1")
stream = client.chat.completions.create(
model="grok-4-fast-reasoning",
messages=[{"role": "user", "content": "Write a short poem about the sea."}],
max_tokens=256,
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")