openrouter-streaming-setup

Installation
SKILL.md

OpenRouter Streaming Setup

Overview

OpenRouter supports Server-Sent Events (SSE) streaming via stream: true, compatible with the OpenAI SDK. Streaming returns tokens as they're generated, reducing time-to-first-token (TTFT) from seconds to milliseconds. Usage stats are available via stream_options: {include_usage: true} in the final chunk. This skill covers Python and TypeScript streaming, SSE forwarding to browsers, and error recovery.

Prerequisites

  • An OpenRouter API key (sk-or-v1-...) exported as OPENROUTER_API_KEY — see the openrouter-install-auth skill for setup
  • Python 3.8+ or Node.js 18+ with the OpenAI SDK (the async example uses AsyncOpenAI from the same Python package)
  • FastAPI if you plan to forward the SSE stream to browsers per the SSE Forwarding section
  • A streaming-appropriate client timeout (e.g. 120s) — longer than for non-streaming requests

Instructions

Installs
1
GitHub Stars
2.6K
First Seen
10 days ago
openrouter-streaming-setup — jeremylongshore/claude-code-plugins-plus-skills