Streaming
Handle events, usage and terminal errors.
A stream may contain usage events with no choices, completion markers or errors after output has begun. Process each event and check the terminal state; an initial HTTP 200 does not prove completion.
Time to first byte and stream idle timeouts differ from the route maximum of 15 minutes. Clients, proxies or providers may end requests earlier; this is not a promise of 15 minutes for every request.
Streaming
event: content_block_delta
data: {"delta":{"text":"Hello","type":"text_delta"},"index":0,"type":"content_block_delta"}
event: message_delta
data: {"delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":128}}Response headers
| HTTP headers | Meaning |
|---|---|
| x-mientaymedia-request-id | Retain x-mientaymedia-request-id when present and the failure time for investigation. Exclude API keys and sensitive payloads from reports. |
| Retry-After | Honor Retry-After and use bounded exponential backoff with jitter. Cap attempts and total time. For video jobs that may already exist, look up the job ID before submitting again. |
| x-mientaymedia-model | Actual model processed |
| x-mientaymedia-model-mapped-from | The model name you submit, if already mapped |
| x-mientaymedia-input-tokens | Charged input tokens |
| x-mientaymedia-output-tokens | Charged output token |
| x-mientaymedia-cost-vnd | Cost of call (VND) |
| x-mientaymedia-price-vnd-per-mtok | Token price is applicable |
| x-mientaymedia-price-vnd-per-request | Fixed price per call (if any) |
For streaming requests, token/cost headers are not available (cost is only known when the stream ends) — check the Usage page.
Examples receive source review and local checks; this does not establish compatibility with every app version. Check settings, send a small request and confirm usage before production use.