Gengxi API Developer Docs

Streaming

Consume Responses and Chat Completions incrementally over server-sent events.

Responses streaming

Set stream to true. The response uses Content-Type: text/event-stream.

bashCopy
curl https://api.gengxi.ai/v1/responses \
  -H "Authorization: Bearer $GENGXI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "YOUR_MODEL",
    "input": "Hello"
 ,
    "stream": true
  }'
  • response.created
  • response.output_*
  • response.*.delta
  • response.completed
  • response.failed

Chat Completions streaming

Chat Completions emits data: chat.completion.chunk records and normally finishes with data: [DONE].

textCopy
data: {"object":"chat.completion.chunk", ...}

data: [DONE]

Client guidance

  • Parse complete SSE frames rather than arbitrary network chunks.
  • Handle reconnects and partial output in your application.
  • Stop and surface response.failed events.
  • Apply normal request timeout and cancellation controls.