openrouter-context-optimization

Installation
SKILL.md

OpenRouter Context Optimization

Overview

OpenRouter models have varying context windows (4K to 1M+ tokens). Since pricing is per-token, stuffing unnecessary context wastes money and can degrade output quality. This skill covers context window lookup, token estimation, conversation trimming, chunking strategies, and Anthropic prompt caching for large contexts.

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 and requests for model-metadata lookup; tiktoken for exact token counting per the references
  • curl and jq to query context windows and pricing from /api/v1/models
  • Node.js 18+ if you use the TypeScript context-budget calculator in the references

Instructions

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