Skip to content
Back to skills

2241 Monitoring Costs 3da71739

ASecurity

```python def get_request_cost(response, model_pricing): usage = response.usage return calculate_cost( model_pricing, usage.prompt_tokens, usage.completion_tokens )

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
devopspython

Works with

  • cli

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 2241-monitoring-costs_3da71739 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2241 Monitoring Costs 3da71739?

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

Security grade badge for 2241 Monitoring Costs 3da71739
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2241-monitoring-costs-3da71739/badge)](https://www.skillsdirectory.com/skills/tools-only-2241-monitoring-costs-3da71739)

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

SKILL.md
# Monitoring Costs

## Monitoring Costs

### Per-Request Cost
```python
def get_request_cost(response, model_pricing):
    usage = response.usage
    return calculate_cost(
        model_pricing,
        usage.prompt_tokens,
        usage.completion_tokens
    )

response = client.chat.completions.create(...)
cost = get_request_cost(response, {"prompt": 10, "completion": 30})
print(f"Request cost: ${cost:.6f}")
```

### Dashboard Monitoring
```
openrouter.ai/activity shows:
- Per-request costs
- Daily/weekly/monthly totals
- Model breakdown
- Usage trends
```

### Budget Alerts
```
Set up monitoring:
1. Per-key credit limits
2. Daily spend tracking
3. Alerts when approaching limits
4. Automatic key disable at limit
```

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…