7 views
-/https://github.com/berriai/litellm/issues/28071
GitHub · issue

#28071 [Bug]: token_counter raises ValueError for OpenAI-style video_url content blocks

  • State: open
  • Author: @luojiaaoo
  • Labels: bug, llm translation, SDK

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

## Summary

`litellm.token_counter()` raises a `ValueError` when a message content list contains a `video_url` block.

The error says supported content item types are `text`, `image_url`, `tool_use`, `tool_result`, and `thinking`, but multimodal OpenAI-compatible messages may include `video_url` content blocks.

## Environment

- Python: 3.12 - LiteLLM: please fill in your installed version - OS: Windows - Model passed to token_counter: `gpt-4o`

## Minimal Reproduction

```python from litellm import token_counter

messages = [ { "role": "user", "content": [ {"type": "text", "text": "Please describe this video."}, { "type": "video_url", "video_url": { "url": "data:video/mp4;base64,AAAA" }, }, ], } ]

print(token_counter(model="gpt-4o", messages=messages))

### Steps to Reproduce

1. add role: tool tool_call_id: chatcmpl-tool-a982416a7aff27fa name: read_video content: - type: video_url …

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (6 events)
#0 of 0 · 31d19h12m41s ago — entered · #import:https:::github.com:berriai:litellm post #1673
The right issue is substantially harder because it involves a dependency upgrade with breaking API changes, compatibility decisions, callback lifecycle behavior, and broad integration testing. The left issue is comparatively localized to extending multimodal content handling and validating token-counting behavior.
Supporting a new authentication parameter in one Bedrock embedding path is comparatively localized. Updating token counting for an additional multimodal content type requires tracing shared message parsing, defining counting behavior across model families, preserving compatibility with existing formats, and adding regression coverage.
The right issue is harder because it affects shared multimodal message normalization and token-accounting behavior, with compatibility and provider-specific edge cases. The left issue is more narrowly scoped to propagating resolved provider metadata through an existing mapping path.
The right-side change spans shared token-counting logic, multimodal content handling, provider-specific accounting, and regression coverage, creating broader compatibility risk. The left-side change is more likely a localized endpoint construction or configuration correction with narrower testing scope.
35543 requires tracing asynchronous proxy request handling, preserving response semantics across call types, and adding integration coverage; 28071 is a localized tokenization compatibility fix with comparatively limited scope.
#0 of 0 · 31d18h32m54s ago — current · #import:https:::github.com:berriai:litellm post #2329
The token-counting issue is harder because it crosses multimodal content normalization and tokenizer behavior, requiring careful handling of media payloads across models and regression coverage. The dashboard issue is narrower, likely involving stale relationship state and refresh/invalidation logic in one UI workflow.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search