agentleFS
karanmrnkaranmrn/karanagentskills/skills/openrouter/SKILL.md

openrouter

Skill11 starsChanged 27 days agoMITView on GitHub

List, ask, compare and launch OpenRouter models from the shell. Use when the user types /openrouter, asks which models exist or what they cost, wants one answer from a named non-Claude model, wants two models compared on one prompt, or wants to start a coding session on another model.

  • Reads credentials

12 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run openrouter <command> --help for all flags.

    line 29
  2. Very specific:

    Run list with a filter. Show the user a short, relevant subset, not hundreds of rows.

    line 33
  3. Distinctive:

    If the user named a task, recommend two or three models.

    line 34

“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

OpenRouter

scripts/openrouter (in this skill's folder) calls https://openrouter.ai/api/v1 directly. It needs only python3. Below, openrouter means that script.

Every ask and compare spends credit on the user's OpenRouter account. list and launch are free. Before a paid call, check the price with list. Add --max-tokens to put a limit on the reply. Use a :free model when the task permits.

Key

The CLI reads OPENROUTER_API_KEY from the environment. If that is empty, it reads the file named by OPENROUTER_KEY_FILE. The file holds the bare key or a .env line OPENROUTER_API_KEY=<key>.

The key is a secret. Keep it out of commands, output, logs and commits. Refer to it only as $OPENROUTER_API_KEY.

Commands

openrouter list [filter]                     # id, context, $/M in, $/M out, free marker
openrouter ask <model> "<prompt>"            # streams the reply; tokens and cost go to stderr
openrouter ask <model> - < handoff.md        # "-" reads the prompt from stdin
openrouter compare <m1> <m2> "<prompt>"      # both replies side by side
openrouter launch <model> [--tool claude|codex|env]   # prints the session command

Run openrouter <command> --help for all flags.

Procedure

  1. Run list with a filter. Show the user a short, relevant subset, not hundreds of rows.
  2. If the user named a task, recommend two or three models. Give one line each on why, with the price.
  3. For one answer now, run ask. Tell the user the cost from the stderr line.
  4. To choose between models, run compare on one representative prompt.
  5. For a coding session, run launch and give the user the printed command.

A running session keeps its model. launch only prints a command that starts a new session. The user runs it in another terminal.

Launch notes

  • Claude Code talks to OpenRouter's Anthropic-compatible endpoint. It warns that it does not know the model's context window. The session still works.
  • Codex CLI uses the Responses API through -c overrides. Codex sends its full system prompt and project instructions, so even a short task can use many prompt tokens.
  • A model without tool calling cannot drive a coding agent. launch prints a warning for such a model.
  • OpenCode reads models from its own catalog, which can lag OpenRouter. Run opencode models openrouter to see what it accepts.

Errors

MessageCause
no API keySet OPENROUTER_API_KEY or OPENROUTER_KEY_FILE.
HTTP 401The key is not valid or was revoked.
HTTP 402The account or the key has no credit left. Tell the user. Do not retry.
unknown modelThe id changed or the model was retired. Run list with a filter.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.