Streaming Messages
Parameter Settings
Code
curl https://api.arcee.ai/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "MODEL_NAME",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is the difference between SLMs and LLMs?"
}
],
"stream":true
}'from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY", # Your Arcee API Platform API Key
base_url="https://api.arcee.ai/api/v1/")
response = client.chat.completions.create(
model="MODEL_NAME",
messages=[
{"role":"system", "content":"You are a helpful assistant"},
{"role":"user", "content": "What is the difference between SLMs and LLMs?"},
],
stream=True
)
for chunk in response:
if chunk and hasattr(chunk, 'choices') and chunk.choices:
delta = chunk.choices[0].delta
if hasattr(delta, 'content') and delta.content is not None:
print(delta.content, end="", flush=True)Response Example
Last updated


