openrouter-reference-architecture

Featured

Design production architectures using OpenRouter as the LLM gateway. Use when planning system design, reviewing architecture, or scaling AI applications. Triggers: 'openrouter architecture', 'openrouter system design', 'openrouter at scale', 'llm gateway architecture'.

AI & Automation 2,266 stars 315 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# OpenRouter Reference Architecture ## Overview OpenRouter serves as a unified LLM gateway, abstracting provider complexity. A production architecture wraps it with caching, rate limiting, cost controls, observability, and async processing. This skill provides three reference architectures: simple (single service), standard (microservice), and enterprise (event-driven). ## Architecture 1: Simple (Single Service) ``` ┌─────────────┐ ┌──────────────────────────┐ ┌──────────────┐ │ Your App │────▶│ OpenRouter Client │────▶│ OpenRouter │ │ │ │ - Retry (SDK built-in) │ │ /api/v1 │ │ │◀────│ - Cost tracking │◀────│ │ │ │ │ - Structured logging │ └──────────────┘ └─────────────┘ └──────────────────────────┘ ``` ```python import os, logging from openai import OpenAI log = logging.getLogger("llm") client = OpenAI( base_url="https://openrouter.ai/api/v1", api_key=os.environ["OPENROUTER_API_KEY"], max_retries=3, timeout=30.0, default_headers={"HTTP-Referer": "https://my-app.com", "X-Title": "my-app"}, ) def complete(prompt, model="openai/gpt-4o-mini", **kwargs): kwargs.setdefault("max_tokens", 1024) response = client.chat.completions.create( model=model, messages=[{"role": "user", "content": prompt}], **kwargs, ) log.info(f"[{response.model}] {response.usage.prompt_tokens}+{response.usage.completion_tokens} t...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

openrouter-model-routing

Implement intelligent model routing to optimize cost, quality, and latency on OpenRouter. Use when building multi-model systems or optimizing spend across task types. Triggers: 'openrouter routing', 'model routing', 'route to model', 'model selection openrouter'.

2,266 Updated today
jeremylongshore
AI & Automation Featured

openrouter-hello-world

Send your first OpenRouter API request and understand the response. Use when learning OpenRouter, testing setup, or verifying connectivity. Triggers: 'openrouter hello world', 'openrouter first request', 'test openrouter', 'openrouter quickstart'.

2,266 Updated today
jeremylongshore
AI & Automation Featured

openrouter-sdk-patterns

Build reusable OpenRouter client wrappers with retries, typing, and middleware. Use when creating SDKs or client libraries. Triggers: 'openrouter sdk', 'openrouter client wrapper', 'openrouter patterns', 'openrouter library'.

2,266 Updated today
jeremylongshore
AI & Automation Featured

openrouter-usage-analytics

Track and analyze OpenRouter API usage patterns, costs, and performance. Use when building dashboards, optimizing spend, or reporting on AI usage. Triggers: 'openrouter analytics', 'openrouter usage', 'openrouter metrics', 'track openrouter spend'.

2,266 Updated today
jeremylongshore
AI & Automation Featured

openrouter-performance-tuning

Optimize OpenRouter request latency and throughput. Use when building real-time applications, reducing TTFT, or scaling request volume. Triggers: 'openrouter performance', 'openrouter latency', 'openrouter speed', 'optimize openrouter throughput'.

2,266 Updated today
jeremylongshore