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

Represents a configured HuggingFace Inference client.

Holds the access token and default options that are merged with per-call options.

## Creating a client

    client = HuggingfaceClient.Client.new("hf_your_token")

    # With defaults
    client = HuggingfaceClient.Client.new("hf_your_token",
      provider: "groq",
      bill_to: "my-org"
    )

## Using with an inference endpoint

    client = HuggingfaceClient.Client.endpoint(
      "hf_token",
      "https://xyz.eu-west-1.aws.endpoints.huggingface.cloud/gpt2"
    )

## Option schema

| Option | Type | Description |
|--------|------|-------------|
| `:provider` | `string` | Default provider (e.g. `"groq"`, `"together"`) |
| `:bill_to` | `string` | HF organisation to bill the request to |
| `:endpoint_url` | `string` | Custom endpoint URL (overrides provider routing) |
| `:retry_on_503` | `boolean` | Auto-retry on 503 responses (default: `true`) |
| `:req_opts` | `keyword` | Extra options forwarded to `Req` |

# `t`

```elixir
@type t() :: %HuggingfaceClient.Client{
  access_token: String.t() | nil,
  bill_to: String.t() | nil,
  endpoint_url: String.t() | nil,
  provider: String.t() | nil,
  req_opts: keyword(),
  retry_on_503: boolean()
}
```

# `endpoint`

```elixir
@spec endpoint(String.t() | nil, String.t(), keyword()) :: t()
```

Creates a `Client` tied to a specific inference endpoint URL.

Equivalent to calling `client.endpoint(url)` in the JS package.

# `merge_opts`

```elixir
@spec merge_opts(t(), map()) :: map()
```

Merges client defaults with per-call options.

Per-call options always take precedence.

# `new`

```elixir
@spec new(
  String.t() | nil,
  keyword()
) :: t()
```

Creates a new `Client` with the given access token and options.

Raises `InputError` if options are invalid.

# `options_schema`

```elixir
@spec options_schema() :: NimbleOptions.t()
```

Validates and returns the NimbleOptions schema for documentation.

---

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