Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Send PrivateLink config under privateService in create_inference_endp…
…oint (#4966)

* Send PrivateLink config under privateService in create_inference_endpoint

* [Inference] Keep account_id compatible for endpoint creation

* [Inference] Remove account_id compatibility test

---------

Co-authored-by: Lucain Pouget <lucainp@gmail.com>
  • Loading branch information
co42 and Wauplin authored Sep 23, 2026
commit 1e0c30576b4026155aaf5cd3a12aacecec4e6352
2 changes: 1 addition & 1 deletion src/huggingface_hub/_inference_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class InferenceEndpoint:
>>> endpoint.status
'running'
>>> endpoint.url
'https://my-text-to-image.region.vendor.endpoints.huggingface.cloud'
'https://68a0f3b5c6ee5c9dcc0e0a01.endpoints.huggingface.cloud'

# Run inference
>>> endpoint.client.text_to_image(...)
Expand Down
26 changes: 24 additions & 2 deletions src/huggingface_hub/hf_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9401,6 +9401,8 @@ def create_inference_endpoint(
region: str,
vendor: str,
account_id: str | None = None,
private_link_account_id: str | None = None,
private_link_region: str | None = None,
min_replica: int = 1,
max_replica: int = 1,
scaling_metric: InferenceEndpointScalingMetric | None = None,
Expand Down Expand Up @@ -9446,7 +9448,14 @@ def create_inference_endpoint(
vendor (`str`):
The cloud provider or vendor where the Inference Endpoint will be hosted (e.g. `"aws"`).
account_id (`str`, *optional*):
The account ID used to link a VPC to a private Inference Endpoint (if applicable).
Deprecated and ignored. Use `private_link_account_id` and `private_link_region` to configure
AWS PrivateLink.
private_link_account_id (`str`, *optional*):
The AWS account ID allowed to reach the Inference Endpoint through AWS PrivateLink. Requires
`private_link_region`.
private_link_region (`str`, *optional*):
The AWS region of the PrivateLink entry point (`"us-east-1"` or `"eu-west-1"`), where the VPC
endpoint of `private_link_account_id` will connect. Independent of the compute `region` and `vendor`.
min_replica (`int`, *optional*):
The minimum number of replicas (instances) to keep running for the Inference Endpoint. To enable
scaling to zero, set this value to 0 and adjust `scale_to_zero_timeout` accordingly. Defaults to 1.
Expand Down Expand Up @@ -9588,6 +9597,13 @@ def create_inference_endpoint(
```

"""
if account_id is not None:
warnings.warn(
"`account_id` has been ignored. Use `private_link_account_id` and `private_link_region` to configure"
" AWS PrivateLink.",
FutureWarning,
)

namespace = namespace or self._get_namespace(token=token)

if type == InferenceEndpointType.PROTECTED:
Expand All @@ -9612,7 +9628,6 @@ def create_inference_endpoint(
)

payload: dict = {
"accountId": account_id,
"compute": {
"accelerator": accelerator,
"instanceSize": instance_size,
Expand All @@ -9636,6 +9651,13 @@ def create_inference_endpoint(
},
"type": type,
}
if private_link_account_id is not None:
if private_link_region is None:
raise ValueError(
"`private_link_region` is required with `private_link_account_id`: the AWS region of the"
" PrivateLink entry point, 'us-east-1' or 'eu-west-1'."
)
payload["privateService"] = {"accountId": private_link_account_id, "region": private_link_region}
if scaling_metric:
payload["compute"]["scaling"]["measure"] = {scaling_metric: scaling_threshold} # type: ignore
model_payload: dict[str, Any] = payload["model"]
Expand Down
Loading