Skip to content

Expand Appendix A worked example in ai-credits-specification.md to show §3.5 cache_read deduction #39093

@github-actions

Description

@github-actions

Problem

Appendix A of docs/src/content/docs/specs/ai-credits-specification.md presents five token-class inputs and jumps directly to the final result:

cost_usd = 0.0054825
aic = 0.54825

However, this result cannot be reproduced by applying the §3.3 formula naively to the given inputs:

1000 × 0.000003   = 0.003
200  × 0.000015   = 0.003
400  × 0.0000003  = 0.00012
50   × 0.00000375 = 0.0001875
25   × 0.000015   = 0.000375
──────────────────────────────
sum               = 0.0066825   ← does NOT match 0.0054825

The correct result requires the §3.5 provider-specific deduction: subtract cache_read_tokens (400) from input_tokens (1000) before applying the input price. Appendix A silently applies this rule without mentioning it:

net input: (1000 - 400) × 0.000003 = 0.0018  ← §3.5 applied
...sum = 0.0054825  ✓

Impact

Spec implementors use Appendix A as a ground-truth verification test. An example that silently applies a non-obvious cross-sectional rule creates a hidden discrepancy — implementors either arrive at the wrong number (0.0066825) and trust their code is wrong, or waste time debugging what appears to be an internally inconsistent spec.

This undermines the trust and reliability the spec is meant to provide.

Proposed Fix

File: docs/src/content/docs/specs/ai-credits-specification.md (single file only)

Before (Appendix A):

### Appendix A: Worked Example

Given:

- Input: 1000 at $0.000003/token
- Output: 200 at $0.000015/token
- Cache read: 400 at $0.0000003/token
- Cache write: 50 at $0.00000375/token
- Reasoning: 25 at $0.000015/token

Result:

```text
cost_usd = 0.0054825
aic = 0.54825

**After**:
```markdown
### Appendix A: Worked Example

This example assumes the provider bundles cache-read tokens in the reported input total, so §3.5 applies.

Given:

- Input (raw): 1000 tokens at $0.000003/token
- Output: 200 tokens at $0.000015/token
- Cache read: 400 tokens at $0.0000003/token
- Cache write: 50 tokens at $0.00000375/token
- Reasoning: 25 tokens at $0.000015/token

Step 1 — Apply §3.5: net input = 1000 − 400 = **600 tokens**

Step 2 — Per-class cost:

```text
input:       600 × 0.000003    = 0.0018000
output:      200 × 0.000015    = 0.0030000
cache_read:  400 × 0.0000003   = 0.0001200
cache_write:  50 × 0.00000375  = 0.0001875
reasoning:    25 × 0.000015    = 0.0003750

Result:

cost_usd = 0.0054825
aic = 0.54825

### Acceptance Criteria

- [ ] Appendix A updated in `docs/src/content/docs/specs/ai-credits-specification.md` only
- [ ] §3.5 deduction explicitly called out with step showing net input = 600 tokens
- [ ] Step-by-step per-class breakdown verifies the existing `cost_usd = 0.0054825` result
- [ ] No other sections modified

### Design Principle

Trust and Reliability — accurate, transparent, independently verifiable information for conformance implementors.


<!-- gh-aw-tracker-id: delight-daily -->




> 📊 *User experience analysis by [Delight](https://github.com/github/gh-aw/actions/runs/27470638842)* · 456.8 AIC · ⌖ 22.2 AIC · ⊞ 20.3K · [◷](https://github.com/search?q=repo%3Agithub%2Fgh-aw+is%3Aissue+%22gh-aw-workflow-call-id%3A+github%2Fgh-aw%2Fdelight%22&type=issues)
> - [x] expires <!-- gh-aw-expires: 2026-06-15T15:26:07.071Z --> on Jun 15, 2026, 7:26 AM UTC-08:00

<!-- gh-aw-agentic-workflow: Delight, gh-aw-tracker-id: delight-daily, engine: copilot, version: 1.0.60, model: claude-sonnet-4.6, id: 27470638842, workflow_id: delight, run: https://github.com/github/gh-aw/actions/runs/27470638842 -->

<!-- gh-aw-workflow-id: delight -->
<!-- gh-aw-workflow-call-id: github/gh-aw/delight -->

Metadata

Metadata

Labels

cookieIssue Monster Loves Cookies!delightdocumentationImprovements or additions to documentation

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions