#29764 [Bug]: Anthropic `/v1/messages/count_tokens` ignores configured `api_base` and hardcodes `api.anthropic.com`, breaking vLLM Anthropic-compatible backends
## Check for existing issues
- [x] I have searched the existing issues and checked that my issue is not a duplicate.
## What happened?
I am using LiteLLM with a self-hosted vLLM backend that exposes the Anthropic-compatible Messages API.
The reason for using `custom_llm_provider: anthropic` is intentional: when using `hosted_vllm`, LiteLLM converts Anthropic `/v1/messages` requests into `/v1/chat/completions`, and that adapter path is not fully compatible with Claude Code / Anthropic Messages features such as content blocks, tool use, tool results, thinking blocks, and other Anthropic-native request shapes.
So the intended setup is:
```yaml model_list: - model_name: claude-opus-* litellm_params: custom_llm_provider: anthropic model: ultra api_base: http://<vllm-host>:<port>/v1 api_key: <vllm-api-key> ```
In this setup, `/v1/messages` should be forwarded to the configured Anthropic-compatible backend, not to Anthropic SaaS.
That works for normal message generation.
However, when Claude Code calls:
```text POST /v1/messages/count_tokens ```
LiteLLM does not forward the request to the configured `api_base`.
Instead, LiteLLM attempts to call:
…