ClipRelay AI

Claude Code Native /v1/messages Gateway with 90% Prompt Caching Discount | ClipRelay AI Blog

The December Sonnet 5 quote discounts eligible reads by 90%. Compare ten turns including the first write, changing input and full-price output.

Published: 2026-12-06 · Featured Model: claude-sonnet-5

TL;DR: The December Sonnet 5 quote discounts eligible reads by 90%. Compare ten turns including the first write, changing input and full-price output.

Separate four billing buckets

We checked claude-sonnet-5 on 6 December. The read rate was one tenth of ordinary input. The sole positive-charge ledger entry showed 14 prompt tokens, 3 output tokens and zero recorded cache reads. That confirms traffic, with no observed hit in this sample. The discount is a rate comparison.

The first four rows isolate million-token buckets for accounting. The next three model ten independent turns with a stable 20,000-token prefix, 1,000 fresh input tokens and 500 output tokens each. They exclude growing history and use the listed short-lived write tier. Tokens in the prefix occupy exactly one bucket per turn.

What $10 buys

Each row spends a separate USD balance at this site's current retail rates per second, image or million tokens. Round unit cost to a microdollar, then round counts down. A dash means unavailable. Extra takes, checkout taxes and editor fees are excluded.

UnitTier × quantity × ratePer unitWhole units for $10Left
1M tokensclaude-sonnet-5 input × 1 × $0.7$0.714$0.2
1M tokensclaude-sonnet-5 cachedInput × 1 × $0.07$0.07142$0.06
1M tokensclaude-sonnet-5 cacheWrite × 1 × $0.875$0.87511$0.375
1M tokensclaude-sonnet-5 output × 1 × $3.5$3.52$3
10 turns, uncachedclaude-sonnet-5 input × 0.2 × $0.7
claude-sonnet-5 input × 0.01 × $0.7
claude-sonnet-5 output × 0.005 × $3.5
$0.164560$0.13
1 write + 9 hitsclaude-sonnet-5 cacheWrite × 0.02 × $0.875
claude-sonnet-5 cachedInput × 0.18 × $0.07
claude-sonnet-5 input × 0.01 × $0.7
claude-sonnet-5 output × 0.005 × $3.5
$0.0546183$0.0082
10 writesclaude-sonnet-5 cacheWrite × 0.2 × $0.875
claude-sonnet-5 input × 0.01 × $0.7
claude-sonnet-5 output × 0.005 × $3.5
$0.199550$0.025

Savings across the session

At current rates the read saves 90.0%. The one-write, nine-hit session saves 66.8%. A changing prefix can trigger a write premium every time. Put tool definitions and repository conventions first. Append timestamps, questions and diffs last.

Route Claude Code through Messages

Use a fresh Bash shell with a scoped key. The client appends /v1/messages to the origin. Check /status and the model ID before working. The configured gateway receives the context you send. Review repository access and remove secrets first.

export ANTHROPIC_BASE_URL=https://cliprelayai.com
export ANTHROPIC_AUTH_TOKEN="$CLIPRELAY_API_KEY"
claude --model claude-sonnet-5

Verify a hit with two paid requests

This synthetic prefix avoids sharing source files. Run the calls back to back. Check cache_creation_input_tokens and cache_read_input_tokens in usage, then reconcile with request history. Missing or zero reads cannot substantiate savings. Check prefix length, byte identity, expiry and routing before scaling up.

set -eu
for i in 1 2; do
  python3 -c 'import json,sys
rules = "\n".join(f"Item {n} requires review by the editor." for n in range(800))
print(json.dumps(dict(model="claude-sonnet-5", max_tokens=32,
    system=[dict(type="text",text=rules,cache_control=dict(type="ephemeral"))],
    messages=[dict(role="user",content="Who reviews item "+sys.argv[1]+"?")])))' "$i" |
  curl -fsS https://cliprelayai.com/v1/messages \
    -H "x-api-key: $CLIPRELAY_API_KEY" -H "anthropic-version: 2023-06-01" \
    -H "Content-Type: application/json" --data-binary @- |
  python3 -c 'import json,sys; print(json.load(sys.stdin)["usage"])'
done

Recheck the quote before spending

On 6 December 2026 we queried the public pricing endpoint and remote MCP catalog. Run the Python 3 check against production, then compare model IDs in MCP with the Bash request below. These lookups do not generate assets. Set CLIPRELAY_API_KEY in your shell for authenticated calls.

# python3
import json, urllib.request
from decimal import Decimal as D, ROUND_HALF_UP
req = urllib.request.Request("https://cliprelayai.com/v1/cliprelay-pricing", headers={"User-Agent": "ClipRelay-budget/1.0"})
with urllib.request.urlopen(req, timeout=30) as f:
    models = json.load(f, parse_float=D)["data"]["models"]
rows = [
    [["claude-sonnet-5","input",1]],
    [["claude-sonnet-5","cachedInput",1]],
    [["claude-sonnet-5","cacheWrite",1]],
    [["claude-sonnet-5","output",1]],
    [["claude-sonnet-5","input",0.2],["claude-sonnet-5","input",0.01],["claude-sonnet-5","output",0.005]],
    [["claude-sonnet-5","cacheWrite",0.02],["claude-sonnet-5","cachedInput",0.18],["claude-sonnet-5","input",0.01],["claude-sonnet-5","output",0.005]],
    [["claude-sonnet-5","cacheWrite",0.2],["claude-sonnet-5","input",0.01],["claude-sonnet-5","output",0.005]],
]
for parts in rows:
    total = D(0)
    for model, tier, qty in parts:
        m = models[model]
        price = D(str(m["retail"][tier]))
        if not m.get("enabled", True) or price <= 0:
            raise ValueError(model)
        total += price * D(str(qty))
    total = total.quantize(D(".000001"), rounding=ROUND_HALF_UP)
    print(parts, total, int(10 // total), 10 % total)
curl -fsS https://cliprelayai.com/mcp \
  -H "Authorization: Bearer $CLIPRELAY_API_KEY" \
  -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "list_models",
    "arguments": {
      "type": "text"
    }
  }
}'

Global Cards & Alipay Instant Checkout ($5 Minimum)

Self-serve USD top-ups from $5 ($5–$500+) via Visa, Mastercard, Amex, Apple Pay, Google Pay, and Alipay. Credits never expire, and failed video/image tasks automatically refund 100%. Support: support@cliprelayai.com.