Repository navigation
Update Chapter 8 pricing artifacts, offline routing tests, and Prometheus validation - #8
Merged
Merged
Conversation
Co-authored-by: brianray <676284+brianray@users.noreply.github.com>
Co-authored-by: brianray <676284+brianray@users.noreply.github.com>
Co-authored-by: brianray <676284+brianray@users.noreply.github.com>
Co-authored-by: brianray <676284+brianray@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Verify and update pricing in pricing.json
Update Chapter 8 pricing artifacts, offline routing tests, and Prometheus validation
Sep 21, 2026
brianray
marked this pull request as ready for review
September 21, 2026 17:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates the Chapter 8 companion files so pricing stays JSON-driven, token routing/budget examples are covered by deterministic offline tests, and the Prometheus dashboard artifacts are validated in CI. It also reconciles Chapter 8 path references with the repository’s nested layout.
Pricing source of truth
chapters/ch08/pricing.jsonmetadata for the retrieval date and clarifies that live Anthropic pricing could not be re-verified from the sandbox due to unreachable public hosts.PRICING_PATH/table_8_1_rates()with no separate hardcoded rate table.Model router coverage
count_tokens,route_model, andcost_estimate_usd.force_large=True, and that the chapter-opening cost figure matches bothpricing.jsonandcost_estimate_usd().Token budget management (Listing 8.2)
chapters/ch08/token_budget.pyaround an explicit budgeted context shape that includesquestion.MockProviderbehavior, and raises when the context still cannot fit.Prometheus dashboard artifacts (Listing 8.3)
chapters/ch08/dashboard_rules.yml.llm_token_price_usd_per_mtokas per-model, per-price-type constant recording rules sourced from the same values aspricing.json.dashboard_queries.promqlto include commented Chapter 8 cost queries and restores the/ 1e6conversion so token-rate × USD-per-million-token math stays dimensionally correct.CI / parser validation
chapters/ch08/verify_promql.shto validate both the rules file and each PromQL expression throughpromtool.contents: readpermissions.Example of the updated pricing join pattern: