Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Add VertexAI `claude-opus-4` + Assign users to orgs on creation (#11572)

Krish Dholakia25c0d3930796
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json
index 3cda936572e..5207a341554 100644
--- a/litellm/model_prices_and_context_window_backup.json
+++ b/litellm/model_prices_and_context_window_backup.json
@@ -7655,6 +7655,32 @@
"supports_reasoning": true,
"supports_tool_choice": true
},
+ "vertex_ai/claude-opus-4": {
+ "max_tokens": 32000,
+ "max_input_tokens": 200000,
+ "max_output_tokens": 32000,
+ "input_cost_per_token": 1.5e-05,
+ "output_cost_per_token": 7.5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01,
+ "search_context_size_high": 0.01
+ },
+ "cache_creation_input_token_cost": 1.875e-05,
+ "cache_read_input_token_cost": 1.5e-06,
+ "litellm_provider": "vertex_ai-anthropic_models",
+ "mode": "chat",
+ "supports_function_calling": true,
+ "supports_vision": true,
+ "tool_use_system_prompt_tokens": 159,
+ "supports_assistant_prefill": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_response_schema": true,
+ "supports_tool_choice": true,
+ "supports_reasoning": true,
+ "supports_computer_use": true
+ },
"vertex_ai/claude-opus-4@20250514": {
"max_tokens": 32000,
"max_input_tokens": 200000,
@@ -7681,6 +7707,32 @@
"supports_reasoning": true,
"supports_computer_use": true
},
+ "vertex_ai/claude-sonnet-4": {
+ "max_tokens": 64000,
+ "max_input_tokens": 200000,
+ "max_output_tokens": 64000,
+ "input_cost_per_token": 3e-06,
+ "output_cost_per_token": 1.5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01,
+ "search_context_size_high": 0.01
+ },
+ "cache_creation_input_token_cost": 3.75e-06,
+ "cache_read_input_token_cost": 3e-07,
+ "litellm_provider": "vertex_ai-anthropic_models",
+ "mode": "chat",
+ "supports_function_calling": true,
+ "supports_vision": true,
+ "tool_use_system_prompt_tokens": 159,
+ "supports_assistant_prefill": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_response_schema": true,
+ "supports_tool_choice": true,
+ "supports_reasoning": true,
+ "supports_computer_use": true
+ },
"vertex_ai/claude-sonnet-4@20250514": {
"max_tokens": 64000,
"max_input_tokens": 200000,
diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml
index 65b07b5f5f3..7151a3e065b 100644
--- a/litellm/proxy/_new_secret_config.yaml
+++ b/litellm/proxy/_new_secret_config.yaml
@@ -80,13 +80,13 @@ general_settings:
# master_key: os.environ/PROXY_MASTER_KEY
litellm_settings:
- cache: true
- cache_params:
- type: redis
- ttl: 600
- password: os.environ/REDIS_PASSWORD
- supported_call_types: ["acompletion", "completion"]
- callbacks: ["prometheus"]
+ # cache: true
+ # cache_params:
+ # type: redis
+ # ttl: 600
+ # password: os.environ/REDIS_PASSWORD
+ # supported_call_types: ["acompletion", "completion"]
+ callbacks: ["prometheus", "langfuse"]
router_settings:
redis_password: os.environ/REDIS_PASSWORD
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py
index db272af34f5..e9da5eb1c81 100644
--- a/litellm/proxy/_types.py
+++ b/litellm/proxy/_types.py
@@ -911,6 +911,7 @@ class NewUserRequest(GenerateRequestBase):
)
send_invite_email: Optional[bool] = None
sso_user_id: Optional[str] = None
+ organizations: Optional[List[str]] = None
class NewUserResponse(GenerateKeyResponse):
@@ -2518,7 +2519,10 @@ class OrgMemberAddRequest(LiteLLMPydanticObjectBase):
member_data = data.get("member")
if isinstance(member_data, list):
# If member is a list of dictionaries, convert each dictionary to a Member object
- members = [OrgMember(**item) for item in member_data]
+ if all(isinstance(item, dict) for item in member_data):
+ members = [OrgMember(**item) for item in member_data]
+ else:
+ members = [item for item in member_data]
# Replace member_data with the list of Member objects
data["member"] = members
elif isinstance(member_data, dict):
diff --git a/litellm/proxy/management_endpoints/internal_user_endpoints.py b/litellm/proxy/management_endpoints/internal_user_endpoints.py
index 0de01e98620..1fb38b28063 100644
--- a/litellm/proxy/management_endpoints/internal_user_endpoints.py
+++ b/litellm/proxy/management_endpoints/internal_user_endpoints.py
@@ -46,6 +46,9 @@ from litellm.types.proxy.management_endpoints.internal_user_endpoints import (
UserListResponse,
)
+if TYPE_CHECKING:
+ from litellm.proxy.proxy_server import PrismaClient
+
router = APIRouter()
@@ -120,6 +123,41 @@ async def _check_duplicate_user_email(
)
+async def _add_user_to_organizations(
+ user_id: str,
+ organizations: List[str],
+ prisma_client: "PrismaClient",
+ user_api_key_dict: UserAPIKeyAuth,
+):
+ """
+ Add a user to organizations
+ """
+ from litellm.proxy.management_endpoints.organization_endpoints import (
+ organization_member_add,
+ )
+
+ tasks = []
+ for organization_id in organizations:
+ tasks.append(
+ organization_member_add(
+ data=OrganizationMemberAddRequest(
+ organization_id=organization_id,
+ member=[
+ OrgMember(
+ user_id=user_id,
+ role=LitellmUserRoles.INTERNAL_USER,
+ )
+ ],
+ ),
+ http_request=Request(
+ scope={"type": "http", "path": "/user/new"},
+ ),
+ user_api_key_dict=user_api_key_dict,
+ )
+ )
+ await asyncio.gather(*tasks, return_exceptions=True)
+
+
@router.post(
"/user/new",
tags=["Internal User management"],
@@ -169,6 +207,7 @@ async def new_user(
- key_alias: Optional[str] - Alias for the key auto-created on `/user/new`. Default is None.
- sso_user_id: Optional[str] - The id of the user in the SSO provider.
- object_permission: Optional[LiteLLM_ObjectPermissionBase] - internal user-specific object permission. Example - {"vector_stores": ["vector_store_1", "vector_store_2"]}. IF null or {} then no object permission.
+ - organizations: List[str] - List of organization id's the user is a member of
Returns:
- key: (str) The generated api key for the user
- expires: (datetime) Datetime object for when key expires.
@@ -195,6 +234,11 @@ async def new_user(
status_code=400, detail=CommonProxyErrors.db_not_connected_error.value
)
+ if prisma_client is None:
+ raise HTTPException(
+ status_code=500,
+ detail=CommonProxyErrors.db_not_connected_error.value,
+ )
# Check for duplicate email
await _check_duplicate_user_email(data.user_email, prisma_client)
@@ -208,6 +252,10 @@ async def new_user(
data_json = data.json() # type: ignore
data_json = _update_internal_new_user_params(data_json, data)
+ organization_ids = cast(
+ Optional[List[str]], data_json.pop("organizations", None)
+ )
+
response = await generate_key_helper_fn(request_type="user", **data_json)
# Admin UI Logic
# Add User to Team and Organization
@@ -254,6 +302,16 @@ async def new_user(
else:
raise e
+ user_id = cast(Optional[str], response.get("user_id", None))
+
+ if organization_ids is not None and user_id is not None:
+ await _add_user_to_organizations(
+ user_id=user_id,
+ organizations=organization_ids,
+ prisma_client=prisma_client,
+ user_api_key_dict=user_api_key_dict,
+ )
+
special_keys = ["token", "token_id"]
response_dict = {}
for key, value in response.items():
diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json
index 3cda936572e..5207a341554 100644
--- a/model_prices_and_context_window.json
+++ b/model_prices_and_context_window.json
@@ -7655,6 +7655,32 @@
"supports_reasoning": true,
"supports_tool_choice": true
},
+ "vertex_ai/claude-opus-4": {
+ "max_tokens": 32000,
+ "max_input_tokens": 200000,
+ "max_output_tokens": 32000,
+ "input_cost_per_token": 1.5e-05,
+ "output_cost_per_token": 7.5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01,
+ "search_context_size_high": 0.01
+ },
+ "cache_creation_input_token_cost": 1.875e-05,
+ "cache_read_input_token_cost": 1.5e-06,
+ "litellm_provider": "vertex_ai-anthropic_models",
+ "mode": "chat",
+ "supports_function_calling": true,
+ "supports_vision": true,
+ "tool_use_system_prompt_tokens": 159,
+ "supports_assistant_prefill": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_response_schema": true,
+ "supports_tool_choice": true,
+ "supports_reasoning": true,
+ "supports_computer_use": true
+ },
"vertex_ai/claude-opus-4@20250514": {
"max_tokens": 32000,
"max_input_tokens": 200000,
@@ -7681,6 +7707,32 @@
"supports_reasoning": true,
"supports_computer_use": true
},
+ "vertex_ai/claude-sonnet-4": {
+ "max_tokens": 64000,
+ "max_input_tokens": 200000,
+ "max_output_tokens": 64000,
+ "input_cost_per_token": 3e-06,
+ "output_cost_per_token": 1.5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01,
+ "search_context_size_high": 0.01
+ },
+ "cache_creation_input_token_cost": 3.75e-06,
+ "cache_read_input_token_cost": 3e-07,
+ "litellm_provider": "vertex_ai-anthropic_models",
+ "mode": "chat",
+ "supports_function_calling": true,
+ "supports_vision": true,
+ "tool_use_system_prompt_tokens": 159,
+ "supports_assistant_prefill": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_response_schema": true,
+ "supports_tool_choice": true,
+ "supports_reasoning": true,
+ "supports_computer_use": true
+ },
"vertex_ai/claude-sonnet-4@20250514": {
"max_tokens": 64000,
"max_input_tokens": 200000,