Repository navigation
[Automated] Draft docs (agentgateway): llm: account for Anthropic usage iterations (+2 related) - #1376
Open
github-actions[bot] wants to merge 4 commits into
Open
[Automated] Draft docs (agentgateway): llm: account for Anthropic usage iterations (+2 related)#1376github-actions[bot] wants to merge 4 commits into
github-actions[bot] wants to merge 4 commits into
Conversation
…ge iterations (+2 related) Signed-off-by: GitHub Action <action@github.com>
Deploying agentproxy with
|
| Latest commit: |
a7ca0a5
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5538ac11.agentproxy.pages.dev |
| Branch Preview URL: | https://pr-tracker-draft-agentgatewa-0ynu.agentproxy.pages.dev |
Signed-off-by: Art Berger <art.berger@solo.io>
Signed-off-by: Art Berger <art.berger@solo.io>
- Remove the messages.md bullet. That list covers Messages requests converted to OpenAI formats, and iterations come from an Anthropic upstream. - Add per-iteration pricing to the K8s costs page (catalog/mod.rs prices each usage line at its own model on an Exact match). - Gate the new asset text with upstream version tokens only. Signed-off-by: Art Berger <art.berger@solo.io>
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.
[agentgateway/agentgateway#4050, #4072, #4080](agentgateway/agentgateway#4050, agentgateway/agentgateway#4072, agentgateway/agentgateway#4080) — llm: account for Anthropic usage iterations
Docs versions:
standalone/main,kubernetes/mainNo code-path rule covers 3 touched file(s). The planner could route these only by identifier search, so the candidate pages may miss what they changed, including in the other mode:
crates/agentgateway/src/parse/websocket.rscrates/llm/src/lib.rscrates/llm/src/types/detect.rsWhat changes for users: Anthropic Messages responses can include
usage.iterationswhen Anthropic runs more than one sampling iteration for one request. Agentgateway now preserves that array, sums the iteration entries for normalized usage, telemetry, costs, and converted Chat Completions responses, and prices an iteration by its ownmodelwhen that model has an exact catalog match. The deprecatedAGENTGATEWAY_MESSAGES_PREFER_COMPLETIONSoverride is removed, so Messages requests prefer Responses when a provider supports both Responses and Chat Completions.What the docs now say: The Anthropic provider, standalone Messages API-type page, Kubernetes custom-provider page, and both mode-specific Model costs pages now state how
usage.iterationsaffects client responses, normalized usage, and model-cost calculations. The Bedrock and Messages preference candidates were checked, but the main-tree pages already describe the final fixed Responses preference without the removed override.Not verified: No cluster or proxy was run; the documented behavior is unrun.
How
agentgateway-4050was drafted, and what was not verifiedPlan, and what changed it
usage.iterationsaccounting and the Messages preference env-var removal on the LLM usage, cost, and provider-format pages.#4080reverts the unintended Bedrock native-Runtime changes from#4072, and the main-tree Messages/custom-provider pages already state the final fixed Responses preference.usage.iterationson the Anthropic provider, Messages conversion, custom provider, and Model costs pages; wrote no Bedrock behavior edit.Why a documentation change is necessary
The
#4050dossier adds theusage.iterationsfield to Anthropic usage parsing and shows tests where top-levelusagereports only the final message iteration. The same diff sums every iteration for normalized token counts, keeps the per-iteration array in Messages responses, and prices each iteration separately when a model cost catalog contains a matching model. The existing pages described Anthropic cache-token conventions and model cost fields, but did not say that multi-iteration Anthropic usage replaces the top-level totals for accounting. The#4080dossier removesAGENTGATEWAY_MESSAGES_PREFER_COMPLETIONS; the current main docs already say the Responses preference is fixed, so no page needed that part.What changed on disk
assets/agw-docs/pages/agentgateway/llm/providers/anthropic.md— Adds a main-only note thatusage.iterationsis preserved and summed for telemetry, costs, and converted Chat Completions responses.assets/agw-docs/standalone/cost-catalog.md— Adds a main-only Model costs note for pricing each Anthropic iteration by its own model when the model has an exact catalog match.content/docs/kubernetes/main/documentation/llm/cost-controls/costs.md— Adds the same Model costs behavior for Kubernetes mode.content/docs/kubernetes/main/integrations/llm/providers/custom.md— Addsusage.iterationsbehavior to the converted replies and errors list.content/docs/standalone/main/documentation/llm/api-types/messages.md— Addsusage.iterationsbehavior to the Messages conversion list.How to verify this change
/v1/messagesrequest that returns an Anthropic response withusage.iterations.jq '.usage.iterations'shows the per-iteration array, and the normalized telemetry uses the sum of the entries./v1/chat/completionsroute.jq '.usage.prompt_tokens, .usage.completion_tokens'shows counts from the summed iterations, including cache tokens.usage.iterations[].modelvalue, then check the access log or cost fields. The request cost is the sum of the iteration costs, with exact per-iteration model matches priced from their own catalog entries.What was not verified
No cluster, local proxy, or Anthropic upstream was run; the configuration and requests are unrun.
No live response with
usage.iterationswas generated.Release note placement was not run.
How the pages were chosen (triage report)
Feature clusters
These pull requests document one feature between them:
assets/agw-docs/pages/agentgateway/llm/providers/bedrock.md, so this looks like one change split across pull requests and separate drafts would conflictDraft a documentation change
agentgateway/agentgateway#4080 — llm: revert Bedrock changes and drop messages preference env
agentgateway/websiteNew configuration: no page mentions it yet
agentgateway/agentgateway#4050 — llm: account for Anthropic usage iterations
agentgateway/websiteusageonly covers the finalmessageiteration. Every iteration, including compaction, is reported separately inusage.iterations, and the billed total is the sum of those entries:crates/agentgateway/src/parse/websocket.rscrates/llm/src/lib.rscrates/llm/src/types/detect.rsagentgateway/agentgateway#4072 — Drop deprecated AGENTGATEWAY_MESSAGES_PREFER_COMPLETIONS
agentgateway/websiteA surface this change does not reach
them again: they describe a field on a deployment mode the code change
never reached, so a reader following them would configure something that
does not exist yet. The rest of the draft is untouched.
content/docs/kubernetes/main/documentation/llm/cost-controls/costs.mdcontent/docs/kubernetes/main/integrations/llm/providers/custom.mdEither the control-plane work for that mode is still owed, or the topic
belongs only to the other mode. The run summary names which surface and
which identifiers.
Release notes
This pull request also adds its release-note entries:
content/docs/standalone/main/release-notes/release-notes.md: llm: account for Anthropic usage iterations (fix, under LLM)Release notes kept out of a tree. Check that each change really does not reach the trees named here:
kubernetes/main, because the draft edited no page there. If the change also reaches that tree, add the note there.Draft branch:
pr-tracker-draft-agentgateway-4050-plus2