openrouter-sdk-patterns

Installation
SKILL.md

OpenRouter SDK Patterns

Overview

Build production-grade OpenRouter client wrappers using the OpenAI SDK. The OpenAI Python/TypeScript SDKs work natively with OpenRouter by changing base_url to https://openrouter.ai/api/v1. This skill covers typed wrappers, retry strategies, middleware, and reusable patterns.

Prerequisites

  • An OpenRouter API key (sk-or-v1-...) exported as OPENROUTER_API_KEY — see the openrouter-install-auth skill for setup
  • Python 3.8+ with the OpenAI SDK plus requests (used for the /auth/key credits check and /generation cost lookups), or Node.js 18+ with the OpenAI SDK
  • Optional: tenacity if you want the custom retry decorator beyond the SDK's built-in backoff
  • An app name and URL to send as HTTP-Referer / X-Title default headers for dashboard attribution

Instructions

Installs
1
GitHub Stars
2.8K
First Seen
13 days ago
openrouter-sdk-patterns — jeremylongshore/tons-of-skills-marketplace