# `Pixir.Provider.TransportPolicy`
[🔗](https://github.com/Ranvier-Technologies/pixir/blob/main/lib/pixir/provider/transport_policy.ex#L1)

Runtime Provider transport policy.

`:auto` prefers a per-key WebSocket connection and falls back to HTTP/SSE for
transport failures. The fallback reuses the same HTTP request body, so safe
`prompt_cache_key` metadata survives across transports. `previous_response_id` lives
only inside the WebSocket connection process and is discarded on fallback.

# `policy`

```elixir
@type policy() :: :auto | :websocket | :http_sse
```

# `stream`

```elixir
@spec stream(map(), acc, (term(), acc -&gt; acc), keyword()) ::
  {:ok, acc} | {:error, term()} | {:error, term(), acc}
when acc: term()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
