Skip to content
Back to skills

Claude Api Xray

ASecurity

X-rays a Claude Messages API call. Splits a response's usage into cache read, cache write, uncached input and output, prices each segment, and tells whether prompt caching is actually hitting. Use when the user shares an API response or usage block, asks why a Claude call cost what it did, or why caching seems not to work.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 17, 2026
ai-agentsgitapibackend

Works with

  • api

Security analysis

A100/100

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

Scanned November 17, 2026

npx -y skills add ferhatatagun/claudoscope --skill claude-api-xray --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Claude Api Xray?

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

Security grade badge for Claude Api Xray
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ferhatatagun-claude-api-xray/badge)](https://www.skillsdirectory.com/skills/ferhatatagun-claude-api-xray)

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: claude-api-xray
description: X-rays a Claude Messages API call. Splits a response's usage into cache read, cache write, uncached input and output, prices each segment, and tells whether prompt caching is actually hitting. Use when the user shares an API response or usage block, asks why a Claude call cost what it did, or why caching seems not to work.
---

# Claude API X-Ray

A single request is four things billed at four rates. Show them separately.

## Input
The `usage` object of a Messages API response (or several, to compare runs), and the model id. If the user has no usage block, ask for one; do not invent numbers.

## Segments
From `usage`:

| Segment | Field | Rate (per `references/models.md`) |
|---|---|---|
| uncached input | `input_tokens` | model input rate |
| cache write | `cache_creation_input_tokens` | 1.25x input (5-minute TTL) |
| cache read | `cache_read_input_tokens` | input x model's cache-read multiplier |
| output | `output_tokens` | model output rate |

`cost = sum(segment_tokens / 1e6 * rate)`. On models that think by default, `output_tokens` already includes thinking tokens. Haiku 5.5 switches to a higher rate card above 100K prompt tokens (prompt = uncached + cache write + cache read).

## Is caching working?
- First call with `cache_control`: expect a cache write, zero cache read.
- Same request again within 5 minutes: the written segment should become a cache read. If `cache_read_input_tokens` is 0 on the second run, the prefix changed or is too short.
- Common causes: a timestamp, request id or user name early in the system prompt; tool definitions or message order changing; `cache_control` placed after volatile content; prefix below the model's minimum cacheable length; more than 5 minutes between calls.
- Saving from a hit: `cache_read_tokens * (input_rate - read_rate) / 1e6`.

## Latency (if the user has timings)
Time to first token (first content block of any kind, not only text), total time, throughput = `output_tokens / (total - ttft)`.

## Report
A table of the four segments (tokens, rate, cost, % of total), total cost, cost delta against the previous run if given, a one-line caching verdict, and the single most valuable fix.

## Notes
- Most current models reject `temperature`/`top_p`/`top_k` with a 400. Do not suggest them.
- Prices are a dated snapshot. Say so and do not quote prices from memory.

Interactive version (bring your own key, no backend): https://claudoscope-labs.vercel.app, source github.com/ferhatatagun/claudoscope.

Files in this skill

  • SKILL.md2.5 KB
  • references/models.md1.3 KB

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.

View all in ai-agents →

Comments

Loading comments…

Newsletter

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