# Streaming Parameter

> mdapi.io - Minimal Data API I/O: a content transformation layer primitive for AI systems.
>
> Transforms files and webpages into AI-ready Markdown and structured data, optimized for LLM efficiency and token usage.

Server-Sent Events delivery: the `stream` parameter, the frame shape and the termination markers.

The `stream` parameter enables Server-Sent Events (SSE) streaming for real-time response delivery.

**Type:** `boolean`
**Default:** `false` (non-streaming)

Example:
```bash
curl "https://mdapi.io/?input=...&stream=true"
```

Response format (OpenAI-compatible SSE, one JSON object per `data:` line):
```json
data: {"type":"token_info","token_status":"valid","token_balance":0.99,"token_expires":1798761600}
data: {"type":"products","parts":{...},"attachments":[...]}   // only when the request produced an index
data: {"choices":[{"index":0,"delta":{"content":" chunk"},"finish_reason":null}]}
data: {"choices":[{"index":0,"delta":{"content":" more"},"finish_reason":null}]}
data: {"choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: [DONE]
```

**Native streaming per protocol.** Every protocol delivers a *real* content stream when `stream: true`, but each emits it in its own native frame format (so existing clients keep working):

- **REST** - OpenAI-compatible `choices/delta` frames
- **OpenAI** - `chat.completion.chunk` (`choices/delta`)
- **MCP** - `notifications/message` content chunks, then one final `tools/call` result frame, then the SSE terminator `data: [DONE]` (not a JSON-RPC frame - skip it; the result frame is already the answer)
- **ACP** - `session/update` notification chunks (one stable `messageId` per turn), then a final response carrying only `stopReason`, then the SSE terminator `data: [DONE]`
- **A2A** - `result.task` (`TASK_STATE_WORKING`) start frame, `result.artifactUpdate` (`{artifact, append, lastChunk}`) content frames, then `result.statusUpdate` (`TASK_STATE_COMPLETED`), then the SSE terminator `data: [DONE]`
- **OpenAI Responses** - SSE framed as Responses events - 9 events from `response.created` to `response.completed`

> **Note on MCP transport vs. the `stream` parameter.** The MCP manifest advertises `transport.type: "streamable-http"` - that is the MCP *transport*
> (how JSON-RPC requests are delivered to `POST /mcp`). It is unrelated to the `stream` *parameter*, which independently enables SSE streaming of the
> conversion **content**. You can use MCP without streaming; and when you do pass `stream: true`, the content arrives as SSE frames alongside the transport.

A stream that fails does not fake a clean end: after an error there is no `[DONE]` and no `finish_reason: "stop"`. The failure arrives in the protocol's own error frame - the OpenAI error envelope on the OpenAI endpoint, a JSON-RPC error object on MCP, ACP and A2A - and carries a stable code: `stream_error` for a failure while the content was being produced, `stream_timeout` when the model went quiet for too long. Branch on that code, not on the message.

```
data: {"error":{"message":"Stream error","type":"stream_error","param":null,"code":"stream_error","detail":"..."}}

data: {"jsonrpc":"2.0","id":1,"error":{"code":-32603,"message":"Stream error","data":{"code":"stream_error","detail":"..."}}}
```

The first is the OpenAI envelope (the REST `GET /` SSE path and `/v1/chat/completions`), the second the JSON-RPC object (MCP, ACP, A2A). On the Responses endpoint the frame is `{"type":"error","code":"stream_error","message":"Stream error","param":null}`. `message` and `detail` are free text and may change; only the code is a contract. A stream that stops because the upstream stopped answering carries the same envelope with `stream_timeout` in place of `stream_error`.

## Links

- **About service:** https://mdapi.io/about
- **Privacy:** https://mdapi.io/privacy
- **Contact:** https://mdapi.io/contact
- **Agent entry point:** https://mdapi.io/AGENTS.md or https://mdapi.io/agents.md or https://mdapi.io/agent.md
- **Agent access:** https://mdapi.io/auth.md
- **API documentation and conversion:** https://mdapi.io
- **MCP server manifest:** https://mdapi.io/mcp
- **Health check:** https://mdapi.io/health
- **Documentation index:** https://mdapi.io/llms.txt
- **Full API documentation:** https://mdapi.io/llms-full.txt
- **AI discovery:** https://mdapi.io/.well-known/ai-discovery.json or https://mdapi.io/ai-discovery.json
- **AI Agent discovery:** https://mdapi.io/.well-known/agent.json or https://mdapi.io/agent.json
- **A2A Agent card:** https://mdapi.io/.well-known/agent-card.json or https://mdapi.io/agent-card.json
- **ACP manifest:** https://mdapi.io/.well-known/acp.json or https://mdapi.io/acp.json
- **x402 payment manifest:** https://mdapi.io/.well-known/x402.json or https://mdapi.io/x402.json or https://mdapi.io/.well-known/x402
- **OpenAPI specification (JSON):** https://mdapi.io/.well-known/openapi.json or https://mdapi.io/openapi.json
- **OpenAPI specification (YAML):** https://mdapi.io/.well-known/openapi.yaml or https://mdapi.io/openapi.yaml
- **MAPI specification:** https://mdapi.io/.well-known/mapi.md or https://mdapi.io/mapi.md
- **Skill specification:** https://mdapi.io/.well-known/skill.md or https://mdapi.io/skill.md
- **ARD manifest:** https://mdapi.io/.well-known/ard.json or https://mdapi.io/.well-known/ai-catalog.json or https://mdapi.io/ard.json
- **Agent Plugins manifest:** https://mdapi.io/.well-known/plugin/plugin.json or https://mdapi.io/.well-known/plugin.json
- **Agent Plugins MCP config:** https://mdapi.io/.well-known/plugin/mcp.json
- **Agent Plugins conversion skill:** https://mdapi.io/.well-known/plugin/skills/mdapi-conversion/SKILL.md
- **API documentation pages:** https://mdapi.io/docs
- **Example pages:** https://mdapi.io/docs/examples

## External Links

- **github.com** https://github.com/mdapiio/mdapi.io
- **skills.sh** https://www.skills.sh/mdapiio/mdapi.io
- **skillsmp.com** https://skillsmp.com/creators/mdapiio/mdapi.io
- **clawhub.ai** https://clawhub.ai/mdapiio
- **x.com** https://x.com/mdapiio

## Disclaimer

**The service is provided "AS IS".**


> mdapi.io is an edge-native service-transport primitive for AI, autonomous agents, and the Web4 ecosystem.
