Openrouter free
Skill shihabshahrier/openrouter-free-infer/skills/openrouter-free
Dynamic OpenRouter free-model integration. Provides CLI for discovery, health checks, and chat. Automatically fetches, caches, and refreshes models. Supports fallback routing and capability detection.From its SKILL.md
npx -y skills add shihabshahrier/openrouter-free-infer --skill openrouter-freeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
4.0 KB, 811 tokens by cl100k_base, as published. Nobody here has run it
openrouter-free
Integrate OpenRouter's free AI models with dynamic discovery, local caching, and fallback routing.
Trigger
User invokes /openrouter-free [command] [args] or asks to "list free models", "chat with a free model", or "check OpenRouter status".
Process
- Environment Check: Ensure
OPENROUTER_API_KEYis set. If missing, show setup instructions and stop. - Initialization: If first run or
initcommand, fetch all models fromGET https://openrouter.ai/api/v1/models. - Caching:
- Store models in
~/.opencode/openrouter-model-cache.json. - Use
0o600permissions. - Respect
CACHE_TTL_MS(default 1h).
- Store models in
- Filtering & Discovery:
- Filter for models containing
:freeor specific capability tags. - Map short aliases (e.g.,
r1,qwen,gemma) to full IDs fromreferences/discovery.md.
- Filter for models containing
- Execution:
- Discovery: List models with
models [filter]. - Interactive: Start REPL with
use <model|alias>. - One-shot: Execute single message with
chat "<msg>" [--model <id>]. - Health: Ping models with
health [model]to report latency.
- Discovery: List models with
- Resilience:
- On 429/5xx, retry with exponential backoff (1s, 2s, 4s).
- On model failure during
useorchat, fallback to the next best model usingfallback-router.ts.
Output
- CLI Listings: Tabular or list format for models and health status.
- Chat: Streaming SSE response for interactive and one-shot modes.
- Cache File: Updated
openrouter-model-cache.jsononrefreshor TTL expiry. - Errors: Graceful exit messages with fix suggestions for common API/Config errors.
Error Handling
| Error | Fix |
|---|---|
| Missing API key | export OPENROUTER_API_KEY="sk-or-v1-..." |
| 429 Rate Limit | Exponential backoff, then notify user. |
| Model 404/503 | Fallback to next best model in registry. |
| Cache Expired | Auto-refresh from API. |
Token Efficiency Rules
- Use
openrouter-free models freeto list available models before suggesting one. - Prefer
openrouter-free healthover individual pings for bulk status. - Cache results locally to avoid redundant API calls.
- Limit model display to
OPENROUTER_MAX_DISPLAY(default 30).
Open-Weight Model Rules
- Strict Command Syntax: Always use the defined CLI commands; do not hallucinate flags.
- Model IDs: Use full provider/model strings (e.g.,
google/gemma-2-9b-it:free) unless an alias is confirmed. - Streaming: Ensure
--stream(if applicable) or default streaming behavior is respected for long outputs. - Environment: Do not modify
.envfiles directly unless instructed; guide the user to set variables.
Boundaries
- Does not manage paid OpenRouter models unless explicitly requested.
- Does not store user chat history beyond the current REPL session.
- Does not modify any project files outside of
~/.opencode/cache.
Usage Examples
# Discover all free models with vision support
openrouter-free models vision
# Chat with the longest-context free model
openrouter-free use best-free
# One-shot with a specific alias
openrouter-free chat "Write a Python HTTP server" --model r1
# Check which free models are responsive
openrouter-free health
What ships with it: 33 files
68.2 KB alongside SKILL.md, 17 of them executable
.claude-plugin/
- marketplace.json2.1 KB
- plugin.json104 B
.clinerules/
- openrouter-free.md565 B
.codex/
- config.toml652 B
- hooks.json909 B
- README.md53 B
.cursor/
.windsurf/
agents/
- openai.yaml118 B
references/
- api-usage.md1.0 KB
- capabilities.md1.5 KB
- discovery.md3.5 KB
- error-handling.md1.3 KB
- openrouter-api.md3.3 KB
src/
- alias-manager.test.tsruns3.7 KB
- alias-manager.tsruns2.6 KB
- cache-manager.test.tsruns2.0 KB
- cache-manager.tsruns2.1 KB
- capability-detector.test.tsruns2.9 KB
- capability-detector.tsruns1.4 KB
- cli.tsruns9.3 KB
- config-loader.tsruns865 B
- fallback-router.test.tsruns2.8 KB
- fallback-router.tsruns3.5 KB
- health-checker.test.tsruns2.0 KB
- health-checker.tsruns2.2 KB
- index.tsruns4.1 KB
- model-registry.tsruns3.2 KB
- provider-adapter.tsruns4.7 KB
- types.tsruns2.8 KB
- index.tsruns363 B
- package.json528 B
- tsconfig.json350 B