hf_api_request: Make a Request to Hugging Face Inference API

View source: R/utils.R

hf_api_requestR Documentation

Make a Request to Hugging Face Inference API

Description

Internal helper function to construct and execute API requests.

Usage

hf_api_request(
  model_id,
  inputs,
  parameters = NULL,
  token = NULL,
  wait_for_model = TRUE,
  use_cache = TRUE,
  endpoint_url = NULL
)

Arguments

model_id

Character string. The model ID on Hugging Face Hub.

inputs

The input data (usually character vector or list).

parameters

Optional list of parameters for the inference.

token

Character string or NULL. API token for authentication.

wait_for_model

Deprecated no-op retained for internal compatibility.

use_cache

Deprecated no-op retained for internal compatibility.

endpoint_url

Character string or NULL. A custom Inference Endpoint URL. When provided, requests are sent to this URL instead of the public Inference API. Use for dedicated Inference Endpoints.

Value

The raw response from the API.


huggingfaceR documentation built on Aug. 30, 2026, 1:06 a.m.