Repository navigation
feat(google-llm,mpcdf-llm,kisski,annotation-review,auto-annotation,archival-edition): report inference usage to the editor - #106
Open
cboulanger wants to merge 1 commit into
Open
cboulanger wants to merge 1 commit into
cboulanger wants to merge 1 commit into
Conversation
…chival-edition): report inference usage to the editor google-llm and mpcdf-llm report requests, token counts (and mpcdf-llm rate-limit headers) to the editor's inference usage recording (pdf-tei-editor#1012, plugin API 1.13). The kisski extract route records its direct API calls with metered_call(), archival-edition wraps its own Anthropic provider in MeteredProvider, and annotation-review and auto-annotation attribute their calls to the document and feature with inference_context(). With an older editor, the imports fall back to no-ops. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S2kb9eoDp7snoSu7qNACBq
This branch has not been deployed
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.
Requested by Christian · project thread
Plugin side of mpilhlt/pdf-tei-editor#1012, for the usage recording in mpilhlt/pdf-tei-editor#1087 (plugin API 1.13).
usage_metadatatoken counts (thinking tokens count as completion tokens).usageof the response (httpx, sopost_completion()does not see it)./extractroute calls the API without a registry provider; its calls are recorded withmetered_call()as one call of the user.MeteredProvider.inference_context(stable_id, feature).kisski (provider), anthropic-llm and inference-endpoints need no change:
post_completion()reports for them. llamore gets its provider from the registry and runs inside the extraction context that core sets.With an editor before plugin API 1.13, the imports fall back to no-ops, so
enginesstays unchanged. The new tests skip there; they pass against the core branch of #1087.Generated by Claude Code