Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion skills/openrouter-models/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ For other install methods (Claude Code plugin marketplace, Cursor Rules, etc.) s

See [SKILL.md](SKILL.md) for the full reference, including:

- Listing and sorting models by newest, price, or throughput (`list-models.ts`)
- Listing and sorting models by newest, price, throughput, intelligence, or Design Arena ELO (`list-models.ts`)
- Filtering by category (programming, roleplay, vision, etc.)
- Looking up a specific model's pricing, context length, and modalities
- Per-provider latency, uptime, and throughput via `get-endpoints.ts`
Expand Down
19 changes: 15 additions & 4 deletions skills/openrouter-models/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Pick the right script based on what the user is asking:
| Find recently added models | `list-models.ts --sort newest` | "What are the newest models?" |
| Find cheapest models | `list-models.ts --sort price` | "What's the cheapest model?" |
| Find highest throughput models | `list-models.ts --sort throughput` | "Which models have the most output capacity?" |
| Find most intelligent models | `list-models.ts --sort intelligence` | "What are the smartest models?" |
| Find best design models | `list-models.ts --sort design-arena-elo` | "Best models for design/UI tasks?" |
| Find models in a category | `list-models.ts --category X` | "Best programming models?" |
| Search by name | `search-models.ts "query"` | "Do they have Claude?" |
| Resolve an informal model name | `resolve-model.ts "query"` | "Use the nano banana 2.0 model" |
Expand Down Expand Up @@ -77,12 +79,18 @@ Categories: `programming`, `roleplay`, `marketing`, `marketing/seo`, `technology
### Sort Results

```bash
cd <skill-path>/scripts && npx tsx list-models.ts --sort newest # Recently added first
cd <skill-path>/scripts && npx tsx list-models.ts --sort price # Cheapest first
cd <skill-path>/scripts && npx tsx list-models.ts --sort context # Largest context first
cd <skill-path>/scripts && npx tsx list-models.ts --sort throughput # Most output tokens first
cd <skill-path>/scripts && npx tsx list-models.ts --sort newest # Recently added first
cd <skill-path>/scripts && npx tsx list-models.ts --sort price # Cheapest first
cd <skill-path>/scripts && npx tsx list-models.ts --sort context # Largest context first
cd <skill-path>/scripts && npx tsx list-models.ts --sort throughput # Most output tokens first
cd <skill-path>/scripts && npx tsx list-models.ts --sort latency # Lowest latency first
cd <skill-path>/scripts && npx tsx list-models.ts --sort popular # Most popular first
cd <skill-path>/scripts && npx tsx list-models.ts --sort intelligence # Highest Artificial Analysis intelligence index first
cd <skill-path>/scripts && npx tsx list-models.ts --sort design-arena-elo # Highest Design Arena ELO first
```

Sorting is performed server-side. Models without a score for benchmark-based sorts (intelligence, design-arena-elo) are placed last.

Models with upcoming `expiration_date` values trigger a stderr warning.

## Search Models
Expand Down Expand Up @@ -136,6 +144,9 @@ Returns for each provider:
|---|---|---|
| `category` | `?category=programming` | Server-side category filter |
| `supported_parameters` | `?supported_parameters=tools` | Only models supporting this parameter |
| `sort` | `?sort=intelligence-high-to-low` | Server-side sort order |

Available `sort` values: `most-popular`, `newest`, `top-weekly`, `pricing-low-to-high`, `pricing-high-to-low`, `context-high-to-low`, `throughput-high-to-low`, `latency-low-to-high`, `intelligence-high-to-low`, `design-arena-elo-high-to-low`. Models without a score for the chosen benchmark are placed last.

**Tips for working with the response:**

Expand Down
39 changes: 24 additions & 15 deletions skills/openrouter-models/scripts/list-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,30 @@ const args = parseArgs(process.argv.slice(2));
const category = args.get("category") as string | undefined;
const sort = args.get("sort") as string | undefined;

const path = category
? `/models?category=${encodeURIComponent(category)}`
: "/models";
// Map user-friendly sort flags to the API's server-side sort parameter values
const SORT_MAP: Record<string, string> = {
newest: "newest",
price: "pricing-low-to-high",
context: "context-high-to-low",
throughput: "throughput-high-to-low",
speed: "throughput-high-to-low",
latency: "latency-low-to-high",
popular: "most-popular",
intelligence: "intelligence-high-to-low",
"design-arena-elo": "design-arena-elo-high-to-low",
};

const apiSort = sort ? SORT_MAP[sort] : undefined;
if (sort && !apiSort) {
console.error(`Unknown sort option: "${sort}". Available: ${Object.keys(SORT_MAP).join(", ")}`);
process.exit(1);
}

const params = new URLSearchParams();
if (category) params.set("category", category);
if (apiSort) params.set("sort", apiSort);

const path = params.size > 0 ? `/models?${params}` : "/models";

const json = await fetchApi(path, apiKey);
let models = (json.data ?? []).map(formatModel);
Expand All @@ -20,16 +41,4 @@ if (expiring.length > 0) {
);
}

if (sort === "newest") {
models.sort((a: any, b: any) => (b.created ?? 0) - (a.created ?? 0));
} else if (sort === "price") {
models.sort((a: any, b: any) => parseFloat(a.pricing?.prompt ?? "0") - parseFloat(b.pricing?.prompt ?? "0"));
} else if (sort === "context") {
models.sort((a: any, b: any) => (b.context_length ?? 0) - (a.context_length ?? 0));
} else if (sort === "throughput" || sort === "speed") {
models.sort((a: any, b: any) =>
(b.top_provider?.max_completion_tokens ?? 0) - (a.top_provider?.max_completion_tokens ?? 0)
);
}

console.log(JSON.stringify(models, null, 2));