Интроспекция OpenRouter для агентов и cron: кредиты, бюджеты, модели, статус провайдеров.

Звёзды2 133
Авторmvanhorn

Установка

SKILL.md

<!-- GENERATED FILE — DO NOT EDIT. This file is a verbatim mirror of library/ai/openrouter/SKILL.md, regenerated post-merge by tools/generate-skills/. Hand-edits here are silently overwritten on the next regen. Edit the library/ source instead. See the repository agent guide, section "Generated artifacts: registry.json, cli-skills/". --><!-- -->

OpenRouter — Printing Press CLI

Prerequisites: Install the CLI

This skill drives the openrouter-pp-cli binary. You must verify the CLI is installed before invoking any command from this skill. If it is missing, install it first:

  1. Install via the Printing Press installer. It defaults binaries to $HOME/.local/bin on macOS/Linux and %LOCALAPPDATA%\Programs\PrintingPress\bin on Windows:<!-- -->
    npx -y @mvanhorn/printing-press-library install openrouter --cli-only
    
  2. Verify: openrouter-pp-cli --version
  3. Ensure the reported install directory is on $PATH for the agent/runtime that will invoke this skill.

If the npx install fails (no Node, offline, etc.), fall back to a direct Go install (requires Go 1.26.5 or newer):

go install github.com/mvanhorn/printing-press-library/library/ai/openrouter/cmd/openrouter-pp-cli@latest

If --version reports "command not found" after install, the runtime cannot see the binary directory on $PATH. Do not proceed with skill commands until verification succeeds.

When to Use This CLI

Use this CLI when an AI agent needs OpenRouter introspection data and you're optimizing for token efficiency. Absorbed commands accept --agent for compact JSON; the 8 novel commands ship --llm mode for terse key:value output. Use it when you need cost attribution beyond model+provider (which-cron-fired-the-call). Use it for pre-flight gates in bash compositions and for local-catalog querying that would otherwise blow context. Skip it for chat — use grahamking/ort for chat ergonomics.

Unique Capabilities

These capabilities aren't available in any other tool for this API.

Local state that compounds

  • usage cost-by — Group your OpenRouter spend by which cron/agent fired the call, not just by model. Joins local generations with caller tags from your tool-call logger.

    Use this when an agent needs to answer 'which automated job is burning my OpenRouter budget?' before deciding what to throttle.

    openrouter usage cost-by --group cron --since 7d --llm
    
  • models query — Query the model catalog with structured filters (tools=true, cost.completion<1, ctx>=64k) — compiled to SQL over a local SQLite cache. Works offline.

    Use this when an agent needs to shortlist models for an experiment without hallucinating pricing or pasting 400 model rows into context.

    openrouter models query "tools=true cost.completion<1 ctx>=64k modality=text" --llm
    
  • generation explain — For a generation id, returns the cost, latency, prompt/completion token counts, AND a delta vs the cheapest provider for the same model+token-count.

    Use this when an agent needs to decide whether a generation was expensive because of the model choice, the prompt size, or the provider markup.

    openrouter generation explain gen-abc123 --llm
    

Agent-native plumbing

  • providers degraded — Returns the set of currently-degraded provider/model pairs by polling /providers and per-model /endpoints. Pipe into your router to preempt 429s.

    Use this in a router or fallback chain when an agent needs to skip degraded provider/model pairs before dispatch instead of after a failed call.

    openrouter providers degraded --json | jq -r '.[].model_id'
    
  • usage anomaly — Flags days where per-model cost exceeds 2σ of the trailing 7-day mean. Deterministic z-score, no LLM in the loop. Designed for cron.

    Use this in a daily cron when an agent needs to detect cost regressions before a credit-low alarm fires.

    openrouter usage anomaly --since 24h --baseline 7d --llm
    
  • key eta — Projects when your weekly OpenRouter cap will trip, based on /key.limit_reset, current usage, and your trailing 7-day burn rate.

    Use this in a daily cron when an agent needs to know whether scheduled work will fit in the remaining weekly cap.

    openrouter key eta --llm
    
  • budget — Set a weekly USD cap per cron job (budget set scan-pipeline 2usd). Pre-flight check returns exit 0 (under cap) or 8 (over) from tagged generations.

    Use this when an agent needs structural budget enforcement per sub-agent or per cron, not aspirational env-var quotas.

    openrouter budget check scan-pipeline && ./scan-pipeline.mjs
    
  • endpoints failover — For a model id, lists all providers serving it ranked by current status, pricing, and observed p50 latency from local cache. Pipe-feeds routers.

    Use this when an agent needs to choose a provider for a given model based on current availability, not the static config order.

    openrouter endpoints failover anthropic/claude-opus-4-7 --json
    

Command Reference

activity — Manage activity

  • openrouter-pp-cli activity — Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management...

credits — Credit management endpoints

  • openrouter-pp-cli credits — Get total credits purchased and used for the authenticated user. [Management...

endpoints — Endpoint information

  • openrouter-pp-cli endpoints — Preview the impact of ZDR on the available endpoints

generation — Generation history endpoints

  • openrouter-pp-cli generation get — Get request & usage metadata for a generation
  • openrouter-pp-cli generation list-content — Get stored prompt and completion content for a generation

key — Manage key

  • openrouter-pp-cli key — Get information on the API key associated with the current authentication session

keys — Manage keys

  • openrouter-pp-cli keys create — Create a new API key for the authenticated user. <!-- -->Management key<!-- -->...
  • openrouter-pp-cli keys delete — Delete an existing API key. <!-- -->Management key<!-- --> required.
  • openrouter-pp-cli keys get — Get a single API key by hash. <!-- -->Management key<!-- --> required.
  • openrouter-pp-cli keys list — List all API keys for the authenticated user. <!-- -->Management key<!-- --> required.
  • openrouter-pp-cli keys update — Update an existing API key. <!-- -->Management key<!-- --> required.

models — Model information endpoints

  • openrouter-pp-cli models get — List all models and their properties
  • openrouter-pp-cli models list-count — Get total count of available models
  • openrouter-pp-cli models list-user — List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provi...

openrouter-auth — Manage openrouter auth

  • openrouter-pp-cli openrouter-auth create-keys-code — Create an authorization code for the PKCE flow to generate a user-controlled API key
  • openrouter-pp-cli openrouter-auth exchange-code-for-apikey — Exchange an authorization code from the PKCE flow for a user-controlled API key

providers — Provider information endpoints

  • openrouter-pp-cli providers — List all providers

Finding the right command

When you know what you want to do but not which command does it, ask the CLI directly:

openrouter-pp-cli which "<capability in your own words>"

which resolves a natural-language capability query to the best matching command from this CLI's curated feature index. Exit code 0 means at least one match; exit code 2 means no confident match — fall back to --help or use a narrower query.

Recipes

Pre-flight gate before expensive cron

openrouter budget check scan-pipeline --json

Returns exit 0 if under cap or 8 if over. Compose with && in bash to gate expensive jobs without half-execution.

Cost attribution for the week

openrouter usage cost-by --group cron --since 7d --llm

Returns one row per cron name with total cost — answers 'which automated job is burning my OpenRouter budget'.

Shortlist tool-capable cheap deep-context models (with --select narrowing)

openrouter models query "tools=true cost.completion<1 ctx>=64k" --agent --select id,context_length,pricing.completion

Local SQLite + dotted --select narrows ~400 models to a handful of fields. Agent context cost: ~150 tokens vs ~425KB raw.

Detect cost regression before credit-low alarm fires

openrouter usage anomaly --since 24h --baseline 7d --llm

Flags per-model days exceeding 2σ over trailing 7-day mean. Daily cron catches runaway loops 1-3 days before /credits hits zero.

Pre-empt 429s by skipping degraded providers

openrouter providers degraded --json

Returns {added, degraded, removed} arrays from set-diff vs prior snapshot. Pipe-feeds your router/suspension logic. Replaces reactive 429-and-learn with leading-indicator polling.

Auth Setup

Set OPENROUTER_API_KEY for per-call operations (creds, models, usage, generation lookup). For sub-key management (keys list/create/delete), set OPENROUTER_MANAGEMENT_KEY separately — OpenRouter's API splits these intentionally and this CLI honors the split. Both variables are read fresh per command; nothing is persisted to disk by default.

Run openrouter-pp-cli doctor to verify setup.

Agent Mode

Add --agent to any command. Expands to: --json --compact --no-input --no-color --yes.

  • Pipeable — JSON on stdout, errors on stderr

  • Filterable — --select keeps a subset of fields. Dotted paths descend into nested structures; arrays traverse element-wise. Critical for keeping context small on verbose APIs:

    openrouter-pp-cli credits --agent --select id,name,status
    
  • Previewable — --dry-run shows the request without sending

  • Offline-friendly — sync/search commands can use the local SQLite store when available

  • Non-interactive — never prompts, every input is a flag

  • Explicit retries — use --idempotent only when an already-existing create should count as success, and --ignore-missing only when a missing delete target should count as success

Response envelope

Commands that read from the local store or the API wrap output in a provenance envelope:

{
  "meta": {"source": "live" | "local", "synced_at": "...", "reason": "..."},
  "results": <data>
}

Parse .results for data and .meta.source to know whether it's live or local. A human-readable N results (live) summary is printed to stderr only when stdout is a terminal — piped/agent consumers get pure JSON on stdout.

Agent Feedback

When you (or the agent) notice something off about this CLI, record it:

openrouter-pp-cli feedback "the --since flag is inclusive but docs say exclusive"
openrouter-pp-cli feedback --stdin < notes.txt
openrouter-pp-cli feedback list --json --limit 10

Entries are stored locally at ~/.openrouter-pp-cli/feedback.jsonl. They are never POSTed unless OPENROUTER_FEEDBACK_ENDPOINT is set AND either --send is passed or OPENROUTER_FEEDBACK_AUTO_SEND=true. Default behavior is local-only.

Write what surprised you, not a bug report. Short, specific, one line: that is the part that compounds.

Output Delivery

Every command accepts --deliver <sink>. The output goes to the named sink in addition to (or instead of) stdout, so agents can route command results without hand-piping. Three sinks are supported:

SinkEffect
stdoutDefault; write to stdout only
file:<path>Atomically write output to <path> (tmp + rename)
webhook:<url>POST the output body to the URL (application/json or application/x-ndjson when --compact)

Unknown schemes are refused with a structured error naming the supported set. Webhook failures return non-zero and log the URL + HTTP status on stderr.

Named Profiles

A profile is a saved set of flag values, reused across invocations. Use it when a scheduled agent calls the same command every run with the same configuration - HeyGen's "Beacon" pattern.

openrouter-pp-cli profile save briefing --json
openrouter-pp-cli --profile briefing credits
openrouter-pp-cli profile list --json
openrouter-pp-cli profile show briefing
openrouter-pp-cli profile delete briefing --yes

Explicit flags always win over profile values; profile values win over defaults. agent-context lists all available profiles under available_profiles so introspecting agents discover them at runtime.

Exit Codes

CodeMeaning
0Success
2Usage error (wrong arguments)
3Resource not found
4Authentication required
5API error (upstream issue)
7Rate limited (wait and retry)
10Config error

Argument Parsing

Parse $ARGUMENTS:

  1. Empty, help, or --help → show openrouter-pp-cli --help output
  2. Starts with install → ends with mcp → MCP installation; otherwise → see Prerequisites above
  3. Anything else → Direct Use (execute as CLI command with --agent)

MCP Server Installation

Install the MCP binary from this CLI's published public-library entry or pre-built release, then register it:

claude mcp add openrouter-pp-mcp -- openrouter-pp-mcp

Verify: claude mcp list

Direct Use

  1. Check if installed: which openrouter-pp-cli If not found, offer to install (see Prerequisites at the top of this skill).
  2. Match the user query to the best command from the Unique Capabilities and Command Reference above.
  3. Execute with the --agent flag:<!-- -->
    openrouter-pp-cli <command> [subcommand] [args] --agent
    
  4. If ambiguous, drill into subcommand help: openrouter-pp-cli <command> --help.

Вставить в README

Ссылка на карточку для вашего README — без картинок и счётчиков.

[DarkPlay: pp-openrouter](https://darkplay.ru/ai/skills/mvanhorn-printing-press-library-pp-openrouter)

Похожие скиллы и другие разделы каталога

Популярное в разделе «Скиллы»

Самые востребованные скиллов раздела по установкам и звёздам.

find-skillsvercel-labs · Помогает находить и устанавливать навыки агентов по запросам вроде «как сделать X»…
4 400 000 устан.
grill-memattpocock · Настойчивое интервью для доработки плана или дизайна.
1 600 000 устан.
hyperframesheygen-com · Обязательная точка входа для любых задач по видео, анимации и motion-графике в…
1 600 000 устан.
hyperframes-cliheygen-com · Цикл разработки HyperFrames CLI: init, add, render, preview, publish и другие команды.
1 600 000 устан.
agent-browservercel-labs · CLI для автоматизации браузера для ИИ-агентов: навигация по страницам, заполнение форм…
1 600 000 устан.
media-useheygen-com · Agent Media OS: единый навык для медиа в HyperFrames — BGM, SFX, изображения, голос, LUT.
1 500 000 устан.
hyperframes-registryheygen-com · Установка и подключение блоков реестра в композиции HyperFrames через add и catalog.
1 400 000 устан.
grill-with-docsmattpocock · Настойчивое интервью для доработки плана или дизайна, попутно создающее документацию (ADR…
1 300 000 устан.
improve-codebase-architecturemattpocock · Поиск в кодовой базе возможностей для углубления, визуальный HTML-отчёт о них и детальный…
1 300 000 устан.
tddmattpocock · Разработка через тестирование (TDD): red-green-refactor и интеграционные тесты.
1 300 000 устан.
Похожее в других разделах каталога

Соседние разделы каталога: возможно, нужный инструмент живёт там.

byom-reviewanthropics · Код-ревью любой моделью через OpenRouter: стандартные и состязательные проверки со…
38 комп.
consensusanthropics · Собирает разные точки зрения ИИ параллельно: Consensus опрашивает GPT-5.2, Gemini 3.1 Pro…
38 комп.
enzymeanthropics · Семантическая индексация заметок Obsidian: кластеры по концепциям и тематические вопросы.
38 комп.
octoanthropics · Мульти-LLM оркестрация для Claude Code и Cowork: 8 провайдеров, workflow Double Diamond…
38 комп.
openrouter-packjeremylongshore · Набор из 30 навыков для OpenRouter: маршрутизация LLM, выбор моделей и оптимизация затрат.
2 926 ★
openrouteropenrouterteam · Навыки для платформы OpenRouter
15 комп.
llm-routerjamesrochabrun · Маршрутизация запросов к LLM между провайдерами (OpenAI, Grok, Groq, DeepSeek) через…
46 комп.
openroutervm0-ai · OpenRouter API: маршрутизация запросов к сотням LLM через один OpenAI-совместимый…
156 комп.
Argus API Spend· Учёт расходов на API, балансов и запаса средств по OpenAI, Anthropic, OpenRouter и 25…
—
Banana Peel· OpenRouter для браузерных агентов. Один MCP для маршрутизации задач по 250+ исполнителям.
—

Лучшие ИИ-инструменты для автоматизации и ассистентов

Ассистенты и автоматизация

Подборка ИИ-ассистентов для автоматизации рутины и ускорения рабочих процессов. Сервисы, которые берут на себя переписку, анализ данных, ведение базы знаний и подготовку продаж, эк

Give Me Public
Есть бесплатный тариф
5.0
AITunnelAitunnel
По запросу
5.0
STIVAStiva
По запросу
5.0
Wikibot (Викибот)Wikibot
По запросу
4.9
mymeet.aiMymeet
По запросу
4.9
InsighterInsighter
По запросу
4.9
TGHuntTghunt
Есть бесплатный тариф
4.9
LegiscanLegiscan
По запросу
4.9
RouterAIRouterai
По запросу
4.9
Wikibot 1.0 (Викибот)Wikibot
По запросу
4.9

Лучшие ИИ-инструменты для генерации видео

Генерация видео

Подборка нейросетей для генерации и монтажа видео. Инструменты, которые превращают текст в готовые ролики, экономят часы на съемках и постпродакшне. Подходит для SMM-специалистов,

VEED.IOVeed
По запросу
5.0
MootionMootion
По запросу
5.0
FlyviFlyvi
Есть бесплатный тариф
4.9
Google Veo 3.1Google
Платно
4.9
Sora (OpenAI)OpenAI
Платно
4.9
PikaPika
Платно
4.9
captions space
Есть бесплатный тариф
4.8
Клайп
Есть бесплатный тариф
4.8
viralpulse.appViralpulse
По запросу
4.8
Viral Maker AIViral-maker
Есть бесплатный тариф
4.8

Лучшие ИИ-инструменты для генерации текста и копирайтинга

Генерация текста и копирайтинг

Подборка нейросетей для генерации текстов и копирайтинга. Сервисы, которые помогают создавать статьи, посты и рекламные объявления с нуля или по черновику, экономя часы рутинной ра

NeuroscribeNeuroscribe
Есть бесплатный тариф
5.0
GoGPTGogpt
По запросу
5.0
ChatsonicChatsonic
По запросу
4.9
НейроТекстерNeuro-texter
По запросу
4.9
ChatGPTOpenAI
По подписке
4.9
Редактум
Есть бесплатный тариф
4.8
ChadGPTChadgpt
По запросу
4.8
Cosmo ScribeCosmoscribe
Есть бесплатный тариф
4.8
Memo HelperCopilot33
По запросу
4.8
LibraChatLibrachat
Есть бесплатный тариф
4.8