M5.1.6 arxiv-rag: cost ledger fields (embedding_calls) #43

Open
opened 2026-04-08 23:17:59 +00:00 by claude-code · 0 comments
Collaborator

Final sub-milestone of Issue #37. Design: ArxivRagProposal.

Goal

Extend the cost ledger so arxiv-rag calls record their embedding usage alongside the existing token / Tavily fields. Closes the per-researcher cost-tracking loop.

Scope

  • obs/costs.py:
    • Add embedding_calls: int = 0 and embedding_model: Optional[str] = None to ledger entries
    • Extend PriceTable.estimate_call_usd to accept an embedding component:
      • For local embedding models, contribute $0
      • For API embedding models (e.g. voyage-3), look up [embeddings."<model>"] in prices.toml and bill per-token
    • Seed prices.toml with [embeddings."nomic-embed-text-v1.5"] (free) and [embeddings."voyage-3"] (placeholder rate)
  • researchers/arxiv/agent.py records the number of retrieve_chunks calls and embedding model name, passes them through when calling ledger.record(...)
  • marchwarden costs rendering: include embedding_calls in the per-day / per-model breakdowns where it's nonzero

Tests

  • Local embedding model: ledger entry has embedding_calls > 0, estimated_cost_usd only counts the synthesis tokens
  • API embedding model with a price-table entry: estimated cost includes the embedding component
  • Existing web researcher entries still work (no embedding fields → costs render the same as today)

Branch

feat/arxiv-rag-cost-ledger

Blocked by: M5.1.5. Closes the M5.1 milestone.

Final sub-milestone of Issue #37. Design: [ArxivRagProposal](https://forgejo.labbity.unbiasedgeek.com/archeious/marchwarden/wiki/ArxivRagProposal). ## Goal Extend the cost ledger so arxiv-rag calls record their embedding usage alongside the existing token / Tavily fields. Closes the per-researcher cost-tracking loop. ## Scope - `obs/costs.py`: - Add `embedding_calls: int = 0` and `embedding_model: Optional[str] = None` to ledger entries - Extend `PriceTable.estimate_call_usd` to accept an embedding component: - For local embedding models, contribute $0 - For API embedding models (e.g. `voyage-3`), look up `[embeddings."<model>"]` in `prices.toml` and bill per-token - Seed prices.toml with `[embeddings."nomic-embed-text-v1.5"]` (free) and `[embeddings."voyage-3"]` (placeholder rate) - `researchers/arxiv/agent.py` records the number of `retrieve_chunks` calls and embedding model name, passes them through when calling `ledger.record(...)` - `marchwarden costs` rendering: include embedding_calls in the per-day / per-model breakdowns where it's nonzero ## Tests - Local embedding model: ledger entry has `embedding_calls > 0`, `estimated_cost_usd` only counts the synthesis tokens - API embedding model with a price-table entry: estimated cost includes the embedding component - Existing web researcher entries still work (no embedding fields → costs render the same as today) ## Branch `feat/arxiv-rag-cost-ledger` Blocked by: M5.1.5. Closes the M5.1 milestone.
claude-code changed title from A.6 arxiv-rag: cost ledger fields (embedding_calls) to M5.1.6 arxiv-rag: cost ledger fields (embedding_calls) 2026-04-08 23:23:15 +00:00
archeious added this to the Phase 5: Second Researcher milestone 2026-04-08 23:23:44 +00:00
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: archeious/marchwarden#43
No description provided.