curl -X POST \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{"model": "c1-embed-latest", "stream": true, "messages": [{"role": "user", "content": "Hello, world!"}]}' \
  https://api.thesys.dev/v1/embed/chat/completions
  id: 1
  data: {"id":"chatcmpl-1743157601318-pzx9ougakm","object":"chat.completion.chunk","created":1743157601,"model":"c1-embed-latest","choices":[{"index":0,"delta":{"role":"assistant","content":{...}}]}

  id: 2
  data: {"id":"chatcmpl-1743157601318-pzx9ougakm","object":"chat.completion.chunk","created":1743157601,"model":"c1-embed-latest","choices":[{"index":0,"delta":{"content":{...}}]}

Streaming message chunks are returned by the API when stream=true is set in the request.

Request Headers

Authorization
string
required

The API key to use for the request.

Content-Type
string
required

The content type of the request. Should be application/json.

Request Body

messages
array
required

An array of messages of the conversation so far.

model
string
required

The model to use for the UI completion. Should be one of the models listed in the Models page.

temperature
number

The temperature to use for the UI completion. Should be between 0 and 1.

top_p
number

The top-p value to use for the UI completion. Should be between 0 and 1.

max_tokens
integer

The maximum number of tokens to use for the UI completion.

n
integer

The number of completions to generate.

stop
integer

Should be unset or set to 1.

stream
boolean

Whether to stream the response. Should be true for streaming.

All other request parameters are ignored.

curl -X POST \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{"model": "c1-embed-latest", "stream": true, "messages": [{"role": "user", "content": "Hello, world!"}]}' \
  https://api.thesys.dev/v1/embed/chat/completions
  id: 1
  data: {"id":"chatcmpl-1743157601318-pzx9ougakm","object":"chat.completion.chunk","created":1743157601,"model":"c1-embed-latest","choices":[{"index":0,"delta":{"role":"assistant","content":{...}}]}

  id: 2
  data: {"id":"chatcmpl-1743157601318-pzx9ougakm","object":"chat.completion.chunk","created":1743157601,"model":"c1-embed-latest","choices":[{"index":0,"delta":{"content":{...}}]}

SSE Event Stream

id
string

A identifier for this event.

data
object

One of the following objects:

Completion Chunk

id
string
required

A unique identifier for the UI completion. Will be the same in all events for a given completion.

object
string
required

The object type, which is always chat.completion.chunk

created
integer
required

Timestamp for when the chunk was created.

model
string
required

The model used to generate the UI completion.

usage
object

An object containing the usage statistics for the UI completion Only present if the generation is complete.

choices
array

An array of completions. Will always contain exactly one object.