openrouter-python-streaming

Stream OpenRouter LLM responses in Python using LiteLLM with async streaming and retry logic.

3|1|Updated Dec 23, 2025
One-click install
npx skills add https://github.com/marcus/marcus-skills --skill openrouter-python-streaming
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: openrouter-python-streaming
Source: https://github.com/marcus/marcus-skills/tree/main/skills/openrouter-python-streaming
Command: npx skills add https://github.com/marcus/marcus-skills --skill openrouter-python-streaming

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Connect to OpenRouter's unified API and stream LLM responses in Python, enabling real-time chat experiences and streaming insights without manual polling.

Core Features & Use Cases

  • Async streaming with LiteLLM and multi-provider access to 400+ models
  • Robust retry logic and backoff for transient failures
  • Production-ready usage patterns for building responsive AI assistants

Quick Start

Run the minimal example to start streaming responses from OpenRouter using LiteLLM.

Frequently Asked Questions about openrouter-python-streaming

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I stream LLM responses in Python using OpenRouter?

To stream LLM responses in Python using OpenRouter, this Skill implements async streaming via LiteLLM. It provides a unified API to access 400+ models and enables real-time chat experiences without manual polling.

What do I need to set up async streaming with LiteLLM and OpenRouter?

You need an OpenRouter API key and the litellm Python package to set up async streaming. This Skill uses these dependencies to establish production-ready streaming workflows and access multi-provider models.

Does LiteLLM handle transient failures during LLM streaming?

Yes, LiteLLM handles transient failures during LLM streaming through built-in retry logic and backoff. This Skill leverages these mechanisms to ensure robust streaming chat experiences when temporary network or API errors occur.

Can I access multiple LLM providers through a single Python API?

Yes, you can access multiple LLM providers through a single Python API using OpenRouter. This Skill supports multi-provider access to 400+ models via a unified API, allowing you to explore and integrate various models seamlessly.

What is the best way to build responsive AI assistants with real-time text generation?

The best way to build responsive AI assistants is by implementing async streaming with LiteLLM. This Skill provides production-ready usage patterns for real-time text generation, enabling immediate feedback and robust chat experiences.