Make your first request
Use an API key from your workspace. Your login password, email verification code and invitation code are not API credentials.
Set your environment
Keep the key on your server, outside source control. The hosted base URL is:
sh
export STREAMINGTELLIGENCE_BASE_URL="https://streamingtelligence.com/v1"
export STREAMINGTELLIGENCE_API_KEY="YOUR_API_KEY"
export STREAMINGTELLIGENCE_MODEL="MODEL_ALLOWED_BY_YOUR_INVITATION"Use the model identifier shown in your workspace. Model availability depends on your invitation and the connected upstream; an example name is not a promise of access.
Send a streaming request
sh
curl --no-buffer "$STREAMINGTELLIGENCE_BASE_URL/chat/completions" \
-H "Authorization: Bearer $STREAMINGTELLIGENCE_API_KEY" \
-H "Content-Type: application/json" \
-d @- <<JSON
{
"model": "${STREAMINGTELLIGENCE_MODEL}",
"messages": [
{"role": "user", "content": "Describe this moment."}
],
"stream": true
}
JSONThe streaming response uses text/event-stream. Each data: message contains a JSON chunk; [DONE] marks completion. See streaming responses for an SDK example and cancellation handling.
Use the Python client
Install the official OpenAI Python client, then point it at your hosted base URL:
sh
pip install openaipython
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["STREAMINGTELLIGENCE_API_KEY"],
base_url=os.environ["STREAMINGTELLIGENCE_BASE_URL"],
)
with client.chat.completions.create(
model=os.environ["STREAMINGTELLIGENCE_MODEL"],
messages=[{"role": "user", "content": "Describe this moment."}],
stream=True,
) as stream:
for chunk in stream:
if chunk.choices:
print(chunk.choices[0].delta.content or "", end="", flush=True)