Skip to content

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
mainfrom
claude/project-thread-70gghf
Open

cboulanger wants to merge 1 commit into
mainfrom
claude/project-thread-70gghf

Conversation

@cboulanger

Copy link
Copy Markdown
Collaborator

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).

  • google-llm: reports each request and the usage_metadata token counts (thinking tokens count as completion tokens).
  • mpcdf-llm: reports requests, rate-limit headers and the usage of the response (httpx, so post_completion() does not see it).
  • kisski: the /extract route calls the API without a registry provider; its calls are recorded with metered_call() as one call of the user.
  • archival-edition: wraps the Anthropic provider it creates with the user's key in MeteredProvider.
  • annotation-review, auto-annotation (complete, annotate, model test): set 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 engines stays unchanged. The new tests skip there; they pass against the core branch of #1087.


Generated by Claude Code

…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
@cboulanger cboulanger self-assigned this Dec 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants