mirror of
https://github.com/Routstr/routstr-core.git
synced 2026-08-09 02:54:37 +00:00
21 lines
485 B
Python
21 lines
485 B
Python
import os
|
|
|
|
from openai import OpenAI
|
|
|
|
client = OpenAI(
|
|
api_key=os.environ.get("TOKEN"),
|
|
base_url=os.environ.get("API_URL", "https://api.routstr.com/v1"),
|
|
)
|
|
|
|
stream = client.responses.create(
|
|
model="claude-4.5-sonnet",
|
|
input="Write a short poem about rust.",
|
|
stream=True,
|
|
)
|
|
|
|
for event in stream:
|
|
# Note: Depending on the SDK version and response structure,
|
|
# you might access event.output_delta or similar fields
|
|
print(event, end="", flush=True)
|
|
print()
|