DragonLair.ai
Get access

Streaming (SSE)

OpenAI-compatible chat streaming is supported. Cancellation and modality behavior depends on the selected model and provider.

Enable streaming

curl -sS -N https://api.cybertronic.dev/v1/chat/completions \
  -H "Authorization: Bearer $DAROUTER_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model":"auto","stream":true,"messages":[{"role":"user","content":"Count to three"}]}'

Python SDK:

stream = client.chat.completions.create(
    model="auto",
    stream=True,
    messages=[{"role": "user", "content": "Count to three"}],
)
for event in stream:
    print(event.choices[0].delta.content or "", end="")

Cancellation honesty

Client disconnect and cancellation behavior varies by upstream provider. Unsupported stream options return HTTP 400 rather than being silently ignored.

Headers on streamed responses

Selected-model and route explanation headers are still the source of truth for what ran. Pair with /docs/headers.

OpenAPI operations

Contract: /v1/openapi.json.

  • POST /v1/chat/completions with stream=true — SSE chunks (OpenAI-compatible subset)

Use OpenAI Python/TS streaming helpers pointed at DragonLair base_url, or curl -N. No first-party SDK.