From raygent-skills
Use this skill when the user wants to call different LLM models through OpenRouter's unified API, compare model responses, track costs and response times, or find the best model for a task. Triggers include requests to test models, benchmark performance, use specific providers (OpenAI, Anthropic, Google, etc.), or optimize for speed/cost.
How this skill is triggered — by the user, by Claude, or both
Slash command
/raygent-skills:openrouterThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
OpenRouter provides a unified API to access hundreds of LLM models from different providers (OpenAI, Anthropic, Google, Meta, and more) with automatic routing, cost tracking, and performance monitoring. Use this skill to make API calls to any OpenRouter model, compare responses across models, track costs and latency, and optimize model selection.
OpenRouter provides a unified API to access hundreds of LLM models from different providers (OpenAI, Anthropic, Google, Meta, and more) with automatic routing, cost tracking, and performance monitoring. Use this skill to make API calls to any OpenRouter model, compare responses across models, track costs and latency, and optimize model selection.
To call an OpenRouter model:
OPENROUTER_API_KEY in your environmentscripts/call_openrouter.sh script with --model and --prompt flags--json flag for structured outputThe script returns:
The scripts/call_openrouter.sh script provides a flexible CLI interface:
# Basic call
bash scripts/call_openrouter.sh \
--model "anthropic/claude-3.5-sonnet" \
--prompt "Explain quantum computing" \
--json
# With optional parameters
bash scripts/call_openrouter.sh \
--model "openai/gpt-4o:nitro" \
--prompt "Write a haiku" \
--max-tokens 100 \
--temperature 0.7 \
--json
--model (required): Model ID (e.g., "anthropic/claude-3.5-sonnet")--prompt (required): User prompt/question--system: Optional system message--max-tokens: Maximum tokens to generate--temperature: Temperature (0.0-2.0)--json: Output as JSON (default: human-readable)OPENROUTER_API_KEY (required): Your API keyOPENROUTER_REFERER (optional): HTTP referer for tracking (default: http://localhost)OPENROUTER_TITLE (optional): Title for tracking (default: Local Test)MODEL (optional): Override the default modelThe script outputs:
choices[0].message.content: The model's responseusage.prompt_tokens: Input token countusage.completion_tokens: Output token countusage.total_tokens: Total tokens usedTo calculate costs:
(prompt_tokens × prompt_price) + (completion_tokens × completion_price)Example: If a model costs $0.0000025/token for prompts and $0.000002/token for completions, and uses 14 prompt + 277 completion tokens:
Retrieve the full models list with pricing and capabilities:
curl https://openrouter.ai/api/v1/models -H "Authorization: Bearer $OPENROUTER_API_KEY" > models.json
The list is sorted by creation date (newest first), serving as a proxy for quality.
Important: The models list can be very large. Consider saving to a file and using grep/jq to filter by:
OpenRouter uses provider/model-name:
anthropic/claude-3.5-sonnetopenai/gpt-4ogoogle/gemini-pro-1.5meta-llama/llama-3.1-405b-instruct:nitro - Use the fastest available provider for a model
anthropic/claude-3.5-sonnet:nitro
:online - Enable web search capabilities
openai/gpt-4o:online
Combine modifiers:
anthropic/claude-3.5-sonnet:nitro:online
Edit the script's PAYLOAD to use the desired model and messages:
{
"model": "anthropic/claude-3.5-sonnet",
"messages": [
{"role": "user", "content": "Explain quantum computing in simple terms"}
]
}
Run the script multiple times with different models and compare:
For speed: Try models with :nitro suffix
For cost: Filter models.json by lowest pricing values
While the OpenRouter API provides model information, provider-specific details like throughput, latency, and availability are only accessible via the web interface. You can programmatically open these pages with sorting parameters.
https://openrouter.ai/<model-slug>/providers?sort=<sorting-option>
Available Sorting Options:
throughput - Sort by provider throughput (tokens/sec)price - Sort by costlatency - Sort by response latencyFor the model moonshotai/kimi-k2-0905:
https://openrouter.ai/moonshotai/kimi-k2-0905/providers?sort=throughput
When you need to identify which provider offers the best throughput for a specific model:
openai/gpt-4o → openai/gpt-4o)https://openrouter.ai/<model-slug>/providers?sort=throughputNote: This information is not available through the API and requires web interface access. The :nitro modifier automatically routes to the fastest provider, but if you need to see provider-specific metrics, use the web interface with query parameters.
If you have browser automation capabilities:
mcp__chrome-devtools__new_page or similar to open the provider page?sort=throughput parameter ensures the page loads pre-sortedOpenRouter provides model rankings filtered by specific use cases and categories. These rankings show which models perform best for different tasks based on user ratings and token usage.
https://openrouter.ai/rankings?category=<category-value>#categories
| Category Display Name | Query Parameter Value | Example URL |
|---|---|---|
| Programming | programming | https://openrouter.ai/rankings?category=programming#categories |
| Roleplay | roleplay | https://openrouter.ai/rankings?category=roleplay#categories |
| Marketing | marketing | https://openrouter.ai/rankings?category=marketing#categories |
| Marketing/Seo | marketing/seo | https://openrouter.ai/rankings?category=marketing/seo#categories |
| Technology | technology | https://openrouter.ai/rankings?category=technology#categories |
| Science | science | https://openrouter.ai/rankings?category=science#categories |
| Translation | translation | https://openrouter.ai/rankings?category=translation#categories |
| Legal | legal | https://openrouter.ai/rankings?category=legal#categories |
| Finance | finance | https://openrouter.ai/rankings?category=finance#categories |
| Health | health | https://openrouter.ai/rankings?category=health#categories |
| Trivia | trivia | https://openrouter.ai/rankings?category=trivia#categories |
| Academia | academia | https://openrouter.ai/rankings?category=academia#categories |
programming, science)marketing/seo with a slash#categories anchor is optional but helps navigate to the categories sectionWhen you need to identify top-performing models for a particular domain:
https://openrouter.ai/rankings?category=<value>#categoriesExample for programming tasks:
https://openrouter.ai/rankings?category=programming#categories
If you have browser automation capabilities:
mcp__chrome-devtools__new_page to open the rankings page?category=<value> parameter loads the page with the selected categoryBash script that makes an API call to OpenRouter and returns timing, cost, and full response. Uses curl and jq for simple, dependency-free execution.
Requirements: jq (for JSON parsing)
Usage:
bash call_openrouter.sh --model "anthropic/claude-3.5-sonnet" --prompt "Your question" --json
Detailed reference on:
:nitro) and web search (:online) modifiersnpx claudepluginhub rawwerks/raygent-skills --plugin raygent-skillsGuides collaborative design exploration before implementation: explores context, asks clarifying questions, proposes approaches, and writes a design doc for user approval.
Creates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.
Resolves in-progress git merge or rebase conflicts by analyzing history, understanding intent, and preserving both changes where possible. Runs automated checks after resolution.