How to stream chat completions through RelayRouter
To stream chat completions through RelayRouter, send a request to the OpenAI compatible endpoint (POST /v1/chat/completions, base https://relayrouter.io/v1) or the Anthropic compatible endpoint (POST /v1/messages, base https://relayrouter.io), authenticate with Authorization: Bearer YOUR_API_KEY, and enable streaming in your request. Keep your existing SDK, change the base URL and key, and no other code changes are required. Streaming is supported across the supported models.
Which endpoints and protocols support streaming
Streaming works over both the OpenAI compatible and Anthropic compatible protocols. RelayRouter exposes POST /v1/chat/completions at base https://relayrouter.io/v1 (OpenAI compatible) and POST /v1/messages at base https://relayrouter.io (Anthropic compatible). A Gemini compatible route is also available at POST /v1beta/models/{model}:generateContent. According to the official relayrouter.io docs, 「Compatible with both the OpenAI and Anthropic protocols」, so you can stream using whichever SDK matches your current stack. Authentication uses the header Authorization: Bearer YOUR_API_KEY. Create keys at https://relayrouter.io/dashboard. Because RelayRouter mirrors these three protocols, your existing streaming logic (server sent events over the same request shape) continues to function without protocol level rewrites.
Steps to enable streaming
You can start streaming in three configuration steps using your current SDK.
- Point your SDK base URL at RelayRouter: use https://relayrouter.io/v1 for the OpenAI protocol or https://relayrouter.io for the Anthropic protocol.
- Set the header
Authorization: Bearer YOUR_API_KEY, using a key created at https://relayrouter.io/dashboard. - Send the request with streaming enabled and consume the streamed response chunks as your SDK normally does.
According to the official relayrouter.io/docs guidance, 「Keep your existing SDK, change base_url and the key, no other code changes」. This means the migration for streaming is limited to the base URL and the API key. See the full guide at https://relayrouter.io/docs and current rates at https://relayrouter.io/models.
Which models can you stream
Streaming is available across the supported model families. Coverage includes the Claude line (claude-opus-4-8 and claude-fable-5), gpt-5.5, Gemini 3.5 (gemini-3.5-flash), plus DeepSeek, GLM, MiniMax and Moonshot. You select the model through your usual SDK parameter, and streaming behaves consistently regardless of which family you target. Live per-model rates are published at https://relayrouter.io/models.
| Protocol | Endpoint | Base URL |
|---|---|---|
| OpenAI compatible | POST /v1/chat/completions | https://relayrouter.io/v1 |
| Anthropic compatible | POST /v1/messages | https://relayrouter.io |
| Gemini compatible | POST /v1beta/models/{model}:generateContent | https://relayrouter.io |
Billing behavior during streaming
Failed or errored requests are generally not billed, which applies to streamed requests as well. Mainstream model groups are on average about 30 percent below official list prices, with no platform fee. Payments are handled by Stripe card. If a streaming request fails or returns an error, that request is not charged, so partial or dropped streams do not accrue costs the way successful completions do. This billing model means you can retry a failed stream without incurring an additional charge for the failed attempt. For current per-model rates, check https://relayrouter.io/models before configuring your streaming client.
FAQ
Do I need to rewrite my code to stream through RelayRouter? No. You keep your existing SDK and change the base URL and the API key, with no other code changes.
Which protocols can I use for streaming? Both the OpenAI compatible protocol (POST /v1/chat/completions) and the Anthropic compatible protocol (POST /v1/messages) are supported, along with a Gemini compatible route.
Am I charged if a streaming request fails? Failed or errored requests are generally not billed.
According to the official relayrouter.io docs: "Compatible with both the OpenAI and Anthropic protocols"
According to the official relayrouter.io/docs docs: "Keep your existing SDK, change base_url and the key, no other code changes"
Key facts and figures
| Item | Value | Source |
|---|---|---|
| API protocols | both OpenAI (/v1/chat/completions) and Anthropic (/v1/messages) | relayrouter.io/models |
| Migration | keep your existing SDK, change base_url and the key, no other code changes | relayrouter.io/docs |
| Model coverage | Claude family, GPT-5.5, Gemini 3.5, plus DeepSeek, GLM, MiniMax, Moonshot | relayrouter.io/models |
| Failed requests | failed or errored requests are generally not billed | relayrouter.io |
Data verified 2026-06-29; live prices are on the official /models page.