# `HuggingfaceClient.Hub.Client`
[🔗](https://github.com/huggingface/huggingface_client/blob/v0.1.0/lib/huggingface_client/hub/client.ex#L1)

Core HTTP client for HuggingFace Hub API interactions.

Provides authenticated GET, POST, PATCH, PUT, DELETE with:
- Bearer token authentication (with env-var fallback)
- JSON encoding/decoding via Req's built-in middleware
- Pagination via Link headers
- Consistent HubApiError on failures
- Private Hub endpoint support

## Configuration

    config :huggingface_client,
      hub_url: "https://my-enterprise-hub.co",
      default_token: "hf_xxx"

## Environment variable fallback (in order)

    HF_TOKEN, HUGGINGFACE_TOKEN, HUGGING_FACE_HUB_TOKEN

# `auth_headers`

```elixir
@spec auth_headers(String.t() | nil | false) :: list()
```

Builds Authorization header list from a token (or nil/false).

# `build_headers`

# `default_token`

```elixir
@spec default_token() :: String.t() | nil
```

# `delete`

# `delete`

```elixir
@spec delete(String.t(), String.t() | nil | false, keyword()) ::
  :ok | {:error, Exception.t()}
```

# `get`

# `get`

```elixir
@spec get(String.t(), String.t() | nil | false, keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

# `hub_url`

```elixir
@spec hub_url() :: String.t()
```

# `paginated_stream`

# `paginated_stream`

```elixir
@spec paginated_stream(String.t(), String.t() | nil | false, keyword()) ::
  Enumerable.t()
```

Returns a lazy stream across paginated API responses, following Link headers.

# `patch`

# `patch`

```elixir
@spec patch(String.t(), map(), String.t() | nil | false, keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

# `post`

# `post`

```elixir
@spec post(String.t(), map() | list() | binary(), String.t() | nil | false, keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

# `put`

# `put`

```elixir
@spec put(String.t(), map() | binary(), String.t() | nil | false, keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

# `stream_raw`

```elixir
@spec stream_raw(String.t(), String.t() | nil | false, keyword()) :: Enumerable.t()
```

Returns a raw binary chunk stream from an SSE endpoint.
Pipe into `HuggingfaceClient.Inference.SSE.parse_stream/1` to decode events.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
