Skip to content
Back to skills

Openrouter Pricing Basics

ASecurity

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'.

  • 4 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 10, 2026
documentationgoapidocumentation

Works with

  • api

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned September 10, 2026

npx -y skills add micsapp/micstec-skills --skill openrouter-pricing-basics --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Openrouter Pricing Basics?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Openrouter Pricing Basics
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/micsapp-openrouter-pricing-basics/badge)](https://www.skillsdirectory.com/skills/micsapp-openrouter-pricing-basics)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: openrouter-pricing-basics
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
version: 1.0.0
license: MIT
author: Jeremy Longshore <jeremy@intentsolutions.io>
compatible-with: claude-code, codex, openclaw
---
# 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

1. **Understand the pricing model**: OpenRouter charges per token with separate rates for prompt (input) and completion (output) tokens, listed as price per 1M tokens
2. **Query model pricing**: Use the `/models` endpoint and inspect `pricing.prompt` and `pricing.completion` fields for each model
3. **Estimate request costs**: Calculate cost as `(prompt_tokens * prompt_price + completion_tokens * completion_price)` using the `usage` object from each response
4. **Track cumulative spend**: Use the `X-OpenRouter-Cost` response header or query `/api/v1/auth/key` to check remaining credits
5. **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

- [OpenRouter Documentation](https://openrouter.ai/docs)
- [OpenRouter Models](https://openrouter.ai/models)
- [OpenRouter API Reference](https://openrouter.ai/docs/api-reference)
- [OpenRouter Status](https://status.openrouter.ai)

Files in this skill

  • SKILL.md2.4 KB
  • 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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.