# `LlmCall.Client`
[🔗](https://github.com/gilbertwong96/llm_call/blob/main/lib/llm_call/client.ex#L1)

A provider, resolved for calling.

Built by a provider module's `client/1`, which turns the declaration plus the
call options into concrete values: endpoint, headers (including auth), query
parameters, transport options, timeout, and the `%LlmCall.Config{}` the codecs
receive.

The client holds **no selected codec**: `codecs` is the provider's map, and each
call names one (`codec: :chat` by default for `complete/3` and `stream/3`).

Values are materialised at build time, so changing `config :llm_call` afterwards
does not mutate an existing client; build a new one.

## Timeout

`timeout` is the **read** timeout, handed to Finch as `:receive_timeout`: each
body chunk must arrive within it, but it is not a deadline for the whole call.
A large response on a slow link, or a provider that keeps sending, can outlast
it. For a wall-clock cap, pass Finch's total timeout through `http_opts:
[request_timeout: ...]`. On an HTTP/1 pool it is checked between reads, so a
streaming call's effective bound is `request_timeout` plus one `timeout`; Finch
implements it on HTTP/2 as a wall-clock timer for the whole response, where the
bound is `request_timeout` itself.

# `t`

```elixir
@type t() :: %LlmCall.Client{
  base_url: String.t(),
  codecs: %{required(atom()) =&gt; module()},
  config: LlmCall.Config.t(),
  credentials: nil | map() | (-&gt; map()),
  headers: [{String.t(), String.t()}],
  http_opts: keyword(),
  provider: module(),
  query: %{optional(String.t()) =&gt; String.t() | integer() | boolean()},
  signer: nil | %{service: String.t(), region: String.t()},
  timeout: timeout()
}
```

# `codec`

```elixir
@spec codec(t(), atom()) :: module() | nil
```

The codec registered under `name`, or `nil`.

# `codec!`

```elixir
@spec codec!(t(), atom()) :: module()
```

The codec registered under `name`; raises when the provider does not declare it.

---

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