| name | openrouter-pricing-basics |
| description | Understand OpenRouter pricing, calculate costs, and optimize spend. Use when budgeting, comparing model costs, or tracking spend. Triggers: 'openrouter pricing', 'openrouter cost', 'model pricing', 'openrouter budget', 'how much does openrouter cost'.
|
| allowed-tools | Read, Write, Edit, Grep, Bash(python3:*), Bash(curl:*), Bash(jq:*) |
| version | 1.20.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","openrouter","pricing","cost-optimization"] |
| compatibility | Designed for Claude Code |
OpenRouter Pricing Basics
Overview
OpenRouter charges per token with separate rates for prompt (input) and completion (output) tokens. Prices are listed per token in the models API (multiply by 1M for per-million rates). Credits are prepaid with a 5.5% processing fee ($0.80 minimum). Free models are available for testing and low-volume use.
Prerequisites
- An OpenRouter API key (
sk-or-v1-...) exported as OPENROUTER_API_KEY — see the openrouter-install-auth skill for setup
curl and jq for the model-pricing and credit-balance queries
- Python 3.8+ with the OpenAI SDK plus the
requests package for the cost-calculation and generation-endpoint snippets
- Prepaid credits for paid models — the public models/pricing endpoint needs no auth, but real completions require credits or a
:free model
Instructions
- Read How Pricing Works: prepaid credits (5.5% fee, $0.80 minimum) are drawn down per request as
(prompt_tokens * prompt_rate) + (completion_tokens * completion_rate).
- Query per-token rates via
GET /api/v1/models per Query Model Pricing, and place candidate models in the Cost Tiers table (free → premium).
- Estimate spend before committing: run
estimate_cost() from Calculate Request Cost with your expected prompt/completion token counts.
- After sending real traffic, fetch the exact charge with
GET /api/v1/generation?id= per Track Actual Cost Per Request.
- Watch the balance via
GET /api/v1/auth/key per Check Credit Balance, and enable auto-topup for production keys.
- Cut costs with the
:floor and :free variants per Save Money with Variants, and check Special Pricing for reasoning tokens, image inputs, per-request fees, and BYOK.
How Pricing Works
- Buy credits at openrouter.ai/credits (5.5% fee, $0.80 minimum)
- Each request deducts
(prompt_tokens * prompt_rate) + (completion_tokens * completion_rate)
- Check balance via
GET /api/v1/auth/key or the dashboard
- Auto-topup is available to prevent service interruption
Query Model Pricing
curl -s https://openrouter.ai/api/v1/models | jq