Add cheap model aliases to your OpenRouter setup for tasks from simple to complex, cutting API costs 50-90% without changing your default model.
OpenClaw skills run inside an OpenClaw container. EasyClawd deploys and manages yours โ no server setup needed.
Cut your OpenRouter API costs 50-90%. Adds cheap and powerful model aliases to your setup, then advises when to switch models based on task complexity. 8 presets, 29 models, zero config risk โ only adds aliases, never changes your default. 3 clicks to set up. Built by Jeff J Hunter. Changelog v1.1.0 โ Cost Tracker, Mix & Match, Monthly Calculator ๐ธ Cost Tracker: agent logs model switches, "how much have I saved?" shows running total with monthly projection ๐ Mix & Match: build custom presets by picking one model per tier from the full 29-model registry ๐ Monthly Cost Calculator: "estimate my monthly costs" compares default vs. optimized spending Author branding and links added Security fix from v1.0.1 included v1.0.1 โ Security Fix Removed insecure fallback that accepted API keys via chat Agent now always uses OpenClaw's native auth wizard (openclaw models auth add) Added OPENROUTER_API_KEY to required env in metadata v1.0.0 โ Initial Release 8 presets: balanced, code-machine, claude-diehards, big-context, openai-focused, tool-master, ultra-budget, free-tier 29 verified OpenRouter models with aliases, pricing, and strengths Smart Cost Advisor suggests model switches based on task complexity Additive only โ never changes default model, fallbacks, or existing config Uses OpenClaw's native openclaw models aliases add โ no custom scripts Setup: 3 Approve clicks, zero terminal usage Advisor on/off toggle Easy undo: just remove aliases
---
name: cost-optimizer
version: 1.1.0
description: "Cut your OpenRouter API costs 50-90%. Adds cheap and powerful model aliases to your setup, then advises when to switch models based on task complexity. 8 presets, 29 models, zero config risk โ only adds aliases, never changes your default. 3 clicks to set up. NEW: Cost Tracker shows your actual savings, Mix & Match builds custom presets from 29 models, Monthly Calculator estimates your spend. Built by Jeff J Hunter."
tags: [cost, models, openrouter, budget, optimization, savings, model-switching, money, api-costs]
author: Jeff J Hunter
homepage: https://jeffjhunter.com
metadata:
openclaw:
emoji: "๐ฐ"
requires:
bins: ["openclaw"]
env: ["OPENROUTER_API_KEY"]
stateDirs: ["~/.openclaw"]
persistence: "This skill creates ~/.openclaw/cost-tracker.md to log model switches and savings estimates. No network activity, no external API calls beyond OpenRouter (which OpenClaw already uses)."
---
# OpenClaw Cost Optimizer
> ## โ AGENT RULES โ READ BEFORE DOING ANYTHING
> 1. **Use EXACT text from this file.** Do not paraphrase menus, preset names, or instructions. If you invent preset names, the config-patcher will break.
> 2. **Only these 8 presets exist:** `balanced`, `code-machine`, `claude-diehards`, `big-context`, `openai-focused`, `tool-master`, `ultra-budget`, `free-tier`. No others. Never invent names like "strict", "thrifty", "standard", "quality", "performance", "max", "custom" โ they don't exist and will cause errors.
> 3. **NEVER tell the user to open a terminal or run commands.** You have the exec tool. USE IT. Run every command yourself via exec. The user's only job is clicking "Approve" on the exec popup. If you find yourself typing "Run this in your terminal" โ STOP. Use exec instead.
> 4. **One step at a time.** Run one exec, show the result, explain it, then proceed.
> 5. **We NEVER change the user's default model, fallbacks, or existing config.** We ONLY add model aliases. Their setup stays exactly as it was.
**Cut your API costs 50-90%. No terminal. No config editing. 3 clicks.**
Right now, every task you give your agent โ even "what time is it?" โ uses the same expensive model. Heartbeats, pings, simple questions โ all billed at the same rate as complex architecture work.
This skill fixes that. It adds cheap and powerful models to your setup, then tells you when to switch to something cheaper or more powerful โ with the cost difference and the reason why. You say yes or no. That's it.
Your current default model stays exactly the same. We only ADD options. Nothing is removed or changed.
8 presets. 29 models. Zero risk. Nothing to undo.
**NEW in v1.1.0:**
- ๐ธ **Cost Tracker** โ "how much have I saved?" shows your actual savings since install
- ๐ **Mix & Match** โ build a custom preset from the full 29-model registry
- ๐ **Monthly Calculator** โ "estimate my monthly costs" to plan your budget
**Requires:** OpenClaw + an OpenRouter API key (free at https://openrouter.ai)
---
# How It Works โ Full Walkthrough
---
## Step 1: First Chat โ Pick a Preset
When the skill loads, the agent introduces itself and shows a menu. The agent must output the EXACT text below:
> **๐จ AGENT: OUTPUT THE EXACT TEXT BELOW VERBATIM. DO NOT PARAPHRASE. DO NOT INVENT YOUR OWN PRESET NAMES.**
> The formatting, emojis, section headers, pricing indicators, and warnings are all intentional.
```
๐ The Cost Optimizer skill is now active!
Right now, every task you give me โ even simple questions โ uses
the same expensive model. That means heartbeats, pings, and
"what time is it?" cost the same as "build me an auth system."
I'm going to fix that. I'll add cheap and powerful models to your
setup, then tell you when to switch. Your current default stays
exactly the same โ I only ADD options.
What describes you best?
โโ RECOMMENDED โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1. ๐ฐ Best balance of cost and quality ยขยข
(recommended for most people)
2. ๐ป I mostly write code ยขยข
โโ MORE OPTIONS โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
3. ๐ I love Claude and want Claude models $$$
4. ๐ I work with huge files or long code $$
5. ๐ค I prefer OpenAI models $$
6. ๐ง I use a lot of tools / MCP servers $$
โโ BUDGET โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
7. ๐ช Cheapest possible โ tight budget ยข
โ ๏ธ Uses free models โ may have slow
starts and occasional disconnects
8. ๐ I want $0 cost โ free models only FREE
โ ๏ธ ALL models are free tier โ expect
delays, rate limits, and downtime.
Best for testing, not production.
Pricing: FREE = $0 | ยข < $0.50/M | ยขยข < $2/M | $$ = $2-15/M | $$$ = $15+/M
(per million tokens โ a typical task uses 1K-10K tokens)
```
Just pick a number. If you're not sure, pick 1.
> **AGENT โ Preset mapping (do not show this to user):**
> 1โ`balanced`, 2โ`code-machine`, 3โ`claude-diehards`, 4โ`big-context`, 5โ`openai-focused`, 6โ`tool-master`, 7โ`ultra-budget`, 8โ`free-tier`
> Vague answer โ `balanced`. "I don't know" โ `balanced` + "We can change later."
---
## Step 2: The Agent Explains What Will Change
After the user picks, the agent explains what models are being added โ in plain English.
Example for "balanced":
```
Great choice! Here's what I'm going to add to your setup:
โ
Flash-Lite โ ultra-cheap model for simple tasks (ยข)
โ /model flashlite
โ
MiniMax M2.1 โ strong coding/writing model (ยขยข)
โ /model minimax
โ
Kimi K2.5 โ frontier-class for complex work (ยขยข)
โ /model kimi25
โ
Gemini Flash โ fast all-rounder (ยข)
โ /model flash
Your current default model stays exactly the same.
I'm just adding these as options you can switch to anytime.
I'll set this up now โ you'll see a couple of Approve popups.
Just click Approve on each one.
```
---
## Step 3: Agent Runs Everything โ User Just Clicks Approve
The agent handles ALL commands via the exec tool. The user never touches a terminal.
> **๐จ AGENT SETUP INSTRUCTIONS:**
>
> **Step 3a: Check OpenRouter auth.** Use exec:
> ```
> openclaw models status
> ```
> Look at the output. If OpenRouter auth is missing or shows "No API key found for provider openrouter":
> - Tell the user they need an OpenRouter API key from https://openrouter.ai (free)
> - Run via exec: `openclaw models auth add --provider openrouter`
> - This starts OpenClaw's built-in interactive auth wizard
> - The user follows the prompts to enter their key securely
> - **NEVER ask the user to paste API keys into chat.** Always use the auth wizard via exec.
> Keys in chat are a security risk โ the auth wizard stores them safely in the credential store.
>
> **Step 3b: Add model aliases.** Use exec to run ALL aliases for the chosen preset in ONE command.
> See the "Preset Alias Commands" section below for the exact command per preset.
> This is ONE exec call โ ONE Approve click.
>
> **Step 3c: Restart gateway.** Use exec:
> ```
> openclaw gateway restart
> ```
> Wait for confirmation. ONE more Approve click.
>
> **Total: 2-3 Approve clicks.** That's it.
>
> **DO NOT tell users to run commands in a terminal. ALWAYS use exec.**
> If exec fails, troubleshoot the error and retry exec.
---
## Preset Alias Commands
Each preset is a single exec command that adds all model aliases at once. Use the EXACT command for the chosen preset:
> **AGENT: Copy the exact command below for the user's chosen preset. Do not modify it.**
### 1. balanced (recommended)
```
openclaw models aliases add flashlite openrouter/google/gemini-2.5-flash-lite && openclaw models aliases add minimax openrouter/minimax/minimax-m2.1 && openclaw models aliases add kimi25 openrouter/moonshotai/kimi-k2.5 && openclaw models aliases add flash openrouter/google/gemini-2.5-flash
```
**Tiers:** Base=flashlite (ยข) | Work=minimax (ยขยข) | Frontier=kimi25 (ยขยข)
### 2. code-machine
```
openclaw models aliases add devfree openrouter/mistralai/devstral-small:free && openclaw models aliases add minimax openrouter/minimax/minimax-m2.1Read full documentation on ClawHub