Skip to content

Send hard invoice PDFs directly to Claude Haiku - #4

Merged
wydrox merged 1 commit into
mainfrom
cursor/anthropic-invoice-llm-cdcd
Nov 18, 2026
Merged

wydrox merged 1 commit into
mainfrom
cursor/anthropic-invoice-llm-cdcd

Conversation

@wydrox

@wydrox wydrox commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Summary

When ANTHROPIC_API_KEY is set, jdg-cli sync sends hard invoice PDFs to Claude as the PDF itself (Messages API, base64 document block, model claude-haiku-5-5, override JDG_ANTHROPIC_MODEL) and stores the same validated 12 fields as the OpenRouter path. No Poppler/OCR text is substituted.

Provider order is Anthropic, then OpenRouter, then local ppmlx. jdg-cli doctor and jdg-cli onboard --check show that the key is set and where it came from. jdg-cli onboard can save it. The attempt ledger stays per model, so a rejected Gemini try does not block Haiku. Transient failures (connection errors, HTTP 429, 5xx including 529) are retried under the existing rules, and llm_attempts.jsonl records input_tokens / output_tokens when the response includes them.

Test plan

  • cargo fmt --check
  • cargo test — 518 passed
  • pytest scripts — 25 passed
  • Request building and response parsing are unit-tested; no live Anthropic calls
Open in Web Open in Cursor 

ANTHROPIC_API_KEY selects the Messages API (claude-haiku-5-5 by default) ahead of OpenRouter and local ppmlx. The PDF goes up as a base64 document, the 12-field schema stays the same, and llm_attempts stays per model with token counts when the response includes them.

Co-authored-by: wydrox <wydrox@users.noreply.github.com>
@wydrox
wydrox merged commit 5603354 into main Nov 18, 2026
2 checks passed
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