Follow Discord
Sweep 22 Oct 2026 · 04:32Z Build v2.1.308 527 read Stable v2.1.308 Latest v2.1.308 Next v2.1.308 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

token-counting changedbuild-with-claude/token-counting

Nearest release: v2.1.239, published 2 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+4added
Lines−2removed
From line 516 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits18to this page, all time

The whole hunk

from line 516, old and new numbered
/
lines
from line 516
516516 
517517 ```python Python
518518 import base64
519 import httpx
519 import httpx2
520520 
521521 image_url = "https://platform.claude.com/docs/images/vision-example.jpg"
522522 image_media_type = "image/jpeg"
523 image_data = base64.standard_b64encode(httpx.get(image_url).content).decode("utf-8")
523 image_data = base64.standard_b64encode(httpx2.get(image_url).content).decode("utf-8")
524524 
525525 client = anthropic.Anthropic()
526526 
from line 771
771771```json Output
772772{ "input_tokens": 1028 }
773773```
774 
775An embedded image block that sets [`"oversized_image": "error"`](https://platform.claude.com/docs/en/build-with-claude/vision-coordinates#oversized-image-error) is rejected at count time exactly as the Messages API would reject it.
774776 
775777### Count tokens in messages with thinking
776778 
Feedback