ChatAnthropicVertex missing labels parameter support for Vertex AI cost tracking
#1,361 opened on Nov 18, 2025
Repository metrics
- Stars
- (392 stars)
- PR merge metrics
- (PR metrics pending)
Description
Package (Required)
- langchain-google-genai
- langchain-google-vertexai
- langchain-google-community
- Other / not sure / general
Checked other resources
- I added a descriptive title to this issue
- I searched the LangChain documentation and API reference (linked above)
- I used the GitHub search to find a similar issue and didn't find it
- I am sure this is a feature request and not a bug report or question
Feature Description
I would like to see labels parameter support added to ChatAnthropicVertex to align its behavior with ChatVertexAI. ChatVertexAI already supports labels for Vertex AI cost tracking, but ChatAnthropicVertex lacks this same functionality, creating inconsistent behavior across the library.
Use Case
This feature helps maintain consistent cost tracking across all Vertex AI models. ChatVertexAI already supports labels for Gemini models, but Claude models via ChatAnthropicVertex don't have the same capability.
Proposed Solution
Implement the same labels pattern that already exists in ChatVertexAI:
# Currently works for Gemini
model = ChatVertexAI(
model_name="gemini-2.5-flash",
labels={"app": "my-app", "team": "ai-team"}
)
# Should work for Claude (currently missing)
model = ChatAnthropicVertex(
model_name="claude-sonnet-4-20250514",
labels={"app": "my-app", "team": "ai-team"} # Not supported yet
)
Alternatives Considered
I've tried manual application logging but this doesn't integrate with Vertex AI billing. Switching to Gemini models when labels are required forces suboptimal model selection for operational rather than applicative reasons.
Additional Context
- ChatVertexAI already implements this correctly in /chat_models.py
- Vertex AI platform supports labels for all model types including Model Garden
- This creates feature parity between the two chat model implementations
- Affects enterprise users requiring consistent cost allocation across all models