openrouter-pricing-basics
Understand OpenRouter model pricing tiers and cost calculation. Use when budgeting or comparing model costs. Trigger with phrases like 'openrouter pricing', 'openrouter cost', 'model pricing', 'openrouter budget'.
- License 许可
- MIT
- 最近更新
- 2026-05-26
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- openrouter-pricing-basics
- author
- Jeremy Longshore <jeremy@intentsolutions.io>
- license
- MIT
- version
- 1.0.0
- description
- Understand OpenRouter model pricing tiers and cost calculation. Use when budgeting or comparing model costs. Trigger with phrases like 'openrouter pricing', 'openrouter cost', 'model pricing', 'openrouter budget'.
- allowed-tools
- Read, Write, Edit, Grep
- compatible-with
- claude-code, codex, openclaw
02 资源文件 7
- 参考文档references/cost-comparison-tool.md1005 B
- 参考文档references/cost-optimization.md991 B
- 参考文档references/credit-system.md709 B
- 参考文档references/errors.md323 B
- 参考文档references/examples.md3.3 KB
- 参考文档references/model-pricing-tiers.md1.2 KB
- 参考文档references/monitoring-costs.md728 B
03 SKILL.md 正文
Openrouter Pricing Basics
Overview
This skill explains OpenRouter's per-token pricing model, how to calculate costs for different models, and strategies for staying within budget.
Prerequisites
- OpenRouter account with credits
- Understanding of token concepts (prompt vs completion tokens)
Instructions
- Understand the pricing model: OpenRouter charges per token with separate rates for prompt (input) and completion (output) tokens, listed as price per 1M tokens
- Query model pricing: Use the
/modelsendpoint and inspectpricing.promptandpricing.completionfields for each model - Estimate request costs: Calculate cost as
(prompt_tokens * prompt_price + completion_tokens * completion_price)using theusageobject from each response - Track cumulative spend: Use the
X-OpenRouter-Costresponse header or query/api/v1/auth/keyto check remaining credits - Optimize costs: Use cheaper models for simple tasks (e.g.,
google/gemma-2-9b-it:free) and reserve expensive models for complex reasoning
Output
- Cost-per-request calculations for your chosen models
- Credit balance and usage tracking setup
- Model pricing comparison table sorted by cost
Error Handling
| Error | Cause | Fix |
|---|---|---|
| 402 Payment Required | Insufficient credits for the chosen model | Top up credits or switch to a cheaper/free model |
| Unexpected costs | Completion tokens exceeded max_tokens | Always set max_tokens to cap output length |
| Price mismatch | Using outdated pricing data | Re-query /models endpoint; pricing updates dynamically |
See ${CLAUDE_SKILL_DIR}/references/errors.md for full error reference.
Examples
See ${CLAUDE_SKILL_DIR}/references/examples.md for runnable code samples.
Resources
04 同仓库更多 Skills
zustand-store-ts
Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reactive state patterns with Zustand.
zustand-store-creator
Zustand Store Creator - Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category.
zero-trust-config-helper
Zero Trust Config Helper - Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category.
zapier-integration-helper
Zapier Integration Helper - Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category.
zai-cli
Execute z.AI CLI providing vision, search, reader, and GitHub exploration via CLI and MCP. Use when user needs image/video analysis, OCR, UI-to-code conversion, error diagnosis, real-time web search, web page to markdown extraction, or GitHub code exploration. Trigger with phrases like "analyze this image", "search the web for", "read this page", "explore this repo", or "use zai". Requires Z_AI_API_KEY.
yt-research
Research competitor YouTube channels, niches, and trending topics for your content strategy. Use this skill whenever the user says "research channels", "analyze competitors", "find trending topics", "niche analysis", "competitive research", "what are other creators doing", "scrape YouTube channels", or wants to understand the competitive landscape for a specific tool or topic area. Use when working with yt research. Trigger with 'yt', 'research'.