Agent skill

Openrouter Pricing Basics

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Understand OpenRouter pricing, calculate costs, and optimize spend.

MITAuto-check passedAI & LLM Engineering

Install Openrouter Pricing Basics

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill openrouter-pricing-basics -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace openrouter-pricing-basics --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/openrouter-pricing-basics .claude/skills/openrouter-pricing-basics && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
openrouter-pricing-basics
GitHub stars
2.8k
Token cost
~2.1k tokens
SKILL.md length
574 words
Files
8 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Understand OpenRouter pricing, calculate costs, and optimize spend.

  • Works in 6 steps: Read How Pricing Works: prepaid credits… → Query per-token rates via GET… → Estimate spend before committing: run… → …
  • Comparing model costs
  • SKILL.md covers Overview, Prerequisites, Instructions and How Pricing Works, plus 12 more sections
  • Calls curl and jq; reaches openrouter.ai; needs OPENROUTER_API_KEY

What it does

Openrouter Pricing Basics is an agent skill from jeremylongshore/tons-of-skills-marketplace. 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'.

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including reference files (for example `references/cost-comparison-tool.md`, `references/cost-optimization.md` and `references/credit-system.md`). Compatibility notes: Designed for Claude Code

It sits in AI & LLM Engineering, covering Model routing and gateways and Budgeting and forecasting. It works with OpenRouter. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Comparing model costs
  • Tasks that involve Model routing and gateways
  • Tasks that involve Budgeting and forecasting

Example prompts

  • “openrouter pricing”
  • “openrouter cost”
  • “model pricing”
  • “/openrouter-pricing-basics”

Requirements

  • Python 3
  • A credential in OPENROUTER_API_KEY
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Grep, Bash(python3:*), Bash(curl:*), Bash(jq:*)

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Read How Pricing Works: prepaid credits (5.5% fee, $0.80 minimum) are drawn down per request as (prompt_tokens * prompt_rate) +…
  2. Query per-token rates via GET /api/v1/models per Query Model Pricing, and place candidate models in the Cost Tiers table (free → premium).
  3. Estimate spend before committing: run estimate_cost() from Calculate Request Cost with your expected prompt/completion token counts.
  4. After sending real traffic, fetch the exact charge with GET /api/v1/generation?id= per Track Actual Cost Per Request.
  5. Watch the balance via GET /api/v1/auth/key per Check Credit Balance, and enable auto-topup for production keys.
  6. Cut costs with the :floor and :free variants per Save Money with Variants, and check Special Pricing for reasoning tokens, image inputs…

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Grep
    • Bash(python3:*)
    • Bash(curl:*)
    • Bash(jq:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • curl
    • jq

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • openrouter.ai

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • OPENROUTER_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Openrouter Pricing Basics loads about 2.1k tokens when it runs, and up to ~4.3k if it reads all its reference files. Until then it costs about 69 tokens; SKILL.md has 574 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~69
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 574 words, ~2,104 tokens.

Download SKILL.mdSave it as .claude/skills/openrouter-pricing-basics/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
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:*)
compatibility
Designed for Claude Code
version
1.20.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, openrouter, pricing, cost-optimization

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

  1. 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).
  2. Query per-token rates via GET /api/v1/models per Query Model Pricing, and place candidate models in the Cost Tiers table (free → premium).
  3. Estimate spend before committing: run estimate_cost() from Calculate Request Cost with your expected prompt/completion token counts.
  4. After sending real traffic, fetch the exact charge with GET /api/v1/generation?id= per Track Actual Cost Per Request.
  5. Watch the balance via GET /api/v1/auth/key per Check Credit Balance, and enable auto-topup for production keys.
  6. 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

  1. Buy credits at openrouter.ai/credits (5.5% fee, $0.80 minimum)
  2. Each request deducts (prompt_tokens * prompt_rate) + (completion_tokens * completion_rate)
  3. Check balance via GET /api/v1/auth/key or the dashboard
  4. Auto-topup is available to prevent service interruption

Query Model Pricing

bash
# Get pricing for all models
curl -s https://openrouter.ai/api/v1/models | jq '.data[] | select(.id == "anthropic/claude-3.5-sonnet") | {
  id: .id,
  prompt_per_M: ((.pricing.prompt | tonumber) * 1000000),
  completion_per_M: ((.pricing.completion | tonumber) * 1000000),
  context: .context_length
}'
# → { "id": "anthropic/claude-3.5-sonnet", "prompt_per_M": 3, "completion_per_M": 15, "context": 200000 }

Cost Tiers (Representative)

TierExample ModelPrompt/1MCompletion/1MUse Case
Freegoogle/gemma-2-9b-it:free$0.00$0.00Testing, prototyping
Budgetmeta-llama/llama-3.1-8b-instruct$0.06$0.06Simple Q&A, classification
Midopenai/gpt-4o-mini$0.15$0.60General purpose
Standardanthropic/claude-3.5-sonnet$3.00$15.00Complex reasoning, code
Premiumopenai/o1$15.00$60.00Deep reasoning

Calculate Request Cost

python
def estimate_cost(model_id: str, prompt_tokens: int, completion_tokens: int) -> float:
    """Calculate cost for a single request."""
    import requests
    models = requests.get("https://openrouter.ai/api/v1/models").json()["data"]
    model = next((m for m in models if m["id"] == model_id), None)
    if not model:
        raise ValueError(f"Model {model_id} not found")

    prompt_rate = float(model["pricing"]["prompt"])       # Cost per token
    completion_rate = float(model["pricing"]["completion"])
    return (prompt_tokens * prompt_rate) + (completion_tokens * completion_rate)

# Example: Claude 3.5 Sonnet, 1000 prompt + 500 completion tokens
cost = estimate_cost("anthropic/claude-3.5-sonnet", 1000, 500)
print(f"Estimated cost: ${cost:.6f}")  # ~$0.0105

Track Actual Cost Per Request

python
import requests

# Method 1: From response usage (estimate)
response = client.chat.completions.create(
    model="anthropic/claude-3.5-sonnet",
    messages=[{"role": "user", "content": "Hello"}],
    max_tokens=100,
)
# response.usage.prompt_tokens, response.usage.completion_tokens

# Method 2: Query generation endpoint (exact cost from OpenRouter)
gen = requests.get(
    f"https://openrouter.ai/api/v1/generation?id={response.id}",
    headers={"Authorization": f"Bearer {os.environ['OPENROUTER_API_KEY']}"},
).json()
print(f"Exact cost: ${gen['data']['total_cost']}")
print(f"Tokens: {gen['data']['tokens_prompt']} prompt + {gen['data']['tokens_completion']} completion")

Check Credit Balance

bash
curl -s https://openrouter.ai/api/v1/auth/key \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" | jq '{
    credits_used: .data.usage,
    credit_limit: .data.limit,
    remaining: ((.data.limit // 0) - .data.usage),
    is_free_tier: .data.is_free_tier
  }'

Save Money with Variants

python
# :floor variant picks the cheapest provider for a model
response = client.chat.completions.create(
    model="anthropic/claude-3.5-sonnet:floor",  # Cheapest provider
    messages=[{"role": "user", "content": "Hello"}],
    max_tokens=100,
)

# :free variant uses free providers (where available)
response = client.chat.completions.create(
    model="google/gemma-2-9b-it:free",
    messages=[{"role": "user", "content": "Hello"}],
    max_tokens=100,
)
Show full SKILL.md (241 more words)Show less

Special Pricing

ItemPricing
Reasoning tokensCharged as output tokens at completion rate
Image inputsPer-image charge listed in pricing.image
Per-request feeSome models charge a flat fee per request (pricing.request)
BYOKFirst 1M requests/month free; then 5% of normal provider cost
Free model limits50 req/day (free users), 1000 req/day (with $10+ credits)

Output

  • A per-model pricing record from the models API: prompt_per_M, completion_per_M, context (e.g. $3 / $15 per 1M tokens for anthropic/claude-3.5-sonnet)
  • A pre-request dollar estimate from estimate_cost() and the exact post-request figures from the generation endpoint: total_cost, tokens_prompt, tokens_completion
  • A credit-balance snapshot from /api/v1/auth/key: credits_used, credit_limit, remaining, is_free_tier

Examples

Check remaining credits before a batch job:

bash
curl -s https://openrouter.ai/api/v1/auth/key \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" | jq '{
    credits_used: .data.usage,
    remaining: ((.data.limit // 0) - .data.usage)
  }'
# {"credits_used": 2.34, "remaining": 47.66}

Estimating first keeps surprises out: 1,000 prompt + 500 completion tokens on anthropic/claude-3.5-sonnet comes to roughly $0.0105 via estimate_cost(), and the generation endpoint then confirms the exact charge. More worked examples: references/examples.md.

Error Handling

HTTPCauseFix
402Insufficient creditsTop up at openrouter.ai/credits or use :free model
402Key credit limit reachedIncrease key limit or use a different key

Enterprise Considerations

  • Set per-key credit limits via the dashboard or provisioning API to isolate blast radius
  • Query /api/v1/generation?id= after each request for exact cost auditing
  • Use :floor variant to automatically pick the cheapest provider
  • Route simple tasks to budget models and complex tasks to premium models (see openrouter-model-routing)
  • Set max_tokens on every request to cap completion cost
  • Enable auto-topup to prevent service interruptions in production

References

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 7 other files (references) in skills/.curated/openrouter-pricing-basics of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/cost-comparison-tool.md
  • references/cost-optimization.md
  • references/credit-system.md
  • references/errors.md
  • references/examples.md
  • references/model-pricing-tiers.md
  • references/monitoring-costs.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Openrouter Pricing Basics next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Openrouter Pricing Basics compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Openrouter Pricing Basics this skilljeremylongshore/tons-of-skills-marketplace2.8k—~2.1kAutomated safety check: PassMIT
Context ManagerMark393295827/third-brain-v7-skills141—~1.5kAutomated safety check: PassMIT
Add Modelget-convex/convex-evals130—~1.5kAutomated safety check: NotesApache-2.0
To Imgrtadewald/skills185—~673Automated safety check: NotesNone
Openrouterdavidondrej/skills4.1k—~1.3kAutomated safety check: PassMIT
Openrouter Text2musicQinghongLin/data2story-skill155—~618Automated safety check: PassMIT

Similar skills

  • Context Manager

    Mark393295827/third-brain-v7-skills

    A skill your agent uses when a long-running agent task needs context budgeting, checkpointing, compaction, retrieval, or capability-based model routing.

    141 GitHub stars~1.5k tokensUpdated 22 days ago
    AI & LLM EngineeringAuto-check passed
  • Add Model

    get-convex/convex-evals

    Add a new model to the convex-evals coding leaderboard, and optionally the decision benchmark, through a PR, then dispatch its baseline runs.

    130 GitHub stars~1.5k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check: notes
  • To Img

    rtadewald/skills

    Gera imagens em paralelo via OpenRouter a partir de um pedido simples ou de um batch com prompts e filenames definidos.

    185 GitHub stars~673 tokensUpdated 12 days ago
    AI & LLM EngineeringAuto-check: notes
  • Openrouter

    davidondrej/skills

    Design, build, debug, and optimize OpenRouter API integrations.

    4.1k GitHub stars~1.3k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Openrouter Text2music

    QinghongLin/data2story-skill

    Generate atmospheric sound-design / SFX (NOT speech, NOT the front-of-blog BGM) via OpenRouter using Google Lyria 3 Pro.

    155 GitHub stars~618 tokensUpdated 3 mo ago
    AI & LLM EngineeringAuto-check passed
  • Fabrica Personagens

    corosolto/client

    Fábrica de personagens e skins do CS BRASIL, da ficha ao personagem no jogo com avatar e arte de resultado.

    257 GitHub stars~1.6k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check: notes

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Works with

Questions about Openrouter Pricing Basics

What does Openrouter Pricing Basics do?

Understand OpenRouter pricing, calculate costs, and optimize spend. Openrouter Pricing Basics is an agent skill from jeremylongshore/tons-of-skills-marketplace. Understand OpenRouter pricing, calculate costs, and optimize spend.

When should I use Openrouter Pricing Basics?

Openrouter Pricing Basics fits situations like: comparing model costs; tasks that involve Model routing and gateways; tasks that involve Budgeting and forecasting.

How do I install Openrouter Pricing Basics in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill openrouter-pricing-basics -a claude-code`. Or copy the skill folder (skills/.curated/openrouter-pricing-basics in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/openrouter-pricing-basics in your project. Claude Code loads it when a task matches its description.

How do I install Openrouter Pricing Basics in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill openrouter-pricing-basics -a codex`. Or copy the skill folder (skills/.curated/openrouter-pricing-basics in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/openrouter-pricing-basics in your project. Codex loads it when a task matches its description.

Can I use Openrouter Pricing Basics in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill openrouter-pricing-basics -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/openrouter-pricing-basics, .gemini/skills/openrouter-pricing-basics, .github/skills/openrouter-pricing-basics and .opencode/skills/openrouter-pricing-basics in your project.

What does Openrouter Pricing Basics need to run?

Going by SKILL.md and its folder, Openrouter Pricing Basics needs the command-line tools its instructions call (curl and jq) and credentials named OPENROUTER_API_KEY. Our summary lists: Python 3; A credential in OPENROUTER_API_KEY. Its frontmatter pre-approves these tools: Read, Write, Edit, Grep, Bash(python3:*), Bash(curl:*), Bash(jq:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Openrouter Pricing Basics access the network?

SKILL.md names 1 domain. In commands or code: openrouter.ai; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Openrouter Pricing Basics safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Openrouter Pricing Basics use?

Openrouter Pricing Basics is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Openrouter Pricing Basics use?

About 2.1k tokens (SKILL.md is roughly 8.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2.2k tokens, read only when the agent opens those files.

What are the alternatives to Openrouter Pricing Basics?

Skills that share tags, products or a category with Openrouter Pricing Basics: Context Manager (Mark393295827/third-brain-v7-skills, 141 stars), Add Model (get-convex/convex-evals, 130 stars), To Img (rtadewald/skills, 185 stars) and Openrouter (davidondrej/skills, 4.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Openrouter Pricing Basics?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.