Skip to content

fix(llm): accept nullable Anthropic input usage - #44128

Closed
primorLee wants to merge 1 commit into
anomalyco:devfrom
primorLee:anthropic-null-usage
Closed

fix(llm): accept nullable Anthropic input usage#44128
primorLee wants to merge 1 commit into
anomalyco:devfrom
primorLee:anthropic-null-usage

Conversation

@primorLee

Copy link
Copy Markdown

Issue for this PR

Closes #43759

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Accepts null for Anthropic's terminal input_tokens. Normalized usage keeps the earlier count from message_start, while raw provider metadata preserves the terminal null. Adds a regression test for both behaviors.

How did you verify your code works?

  • bun test test/provider/anthropic-messages.test.ts --timeout 30000 from packages/llm — 29 passed
  • bun typecheck from packages/llm — passed
  • Prettier check passed for both changed files
  • git diff --check passed

Screenshots / recordings

Not applicable.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential duplicate found:

This PR appears to be addressing the same issue as PR #44128. Both are fixing Anthropic's nullable input usage/tokens handling in the LLM package. PR #44116 likely covers the same or very similar functionality for handling null values in Anthropic's usage metadata.

@primorLee

Copy link
Copy Markdown
Author

Context on the duplicate flag: this PR reopens #44102, which was created at 08:55 UTC before #44116 at 11:16 UTC, after #44102 was automatically closed by the two-hour PR-template deadline while I was completing validation. I compared the current diffs and they are byte-for-byte identical. I am happy for the maintainers to keep whichever PR is easiest to review; there was no intent to duplicate another contributor's work.

@primorLee
primorLee force-pushed the anthropic-null-usage branch from a249393 to f2b4985 Compare August 22, 2026 13:07
@primorLee primorLee closed this Aug 23, 2026
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.

ai: accept nullable Anthropic input usage

1 participant