# `ExAthena.Config`
[🔗](https://github.com/udin-io/ex_athena/blob/v0.7.1/lib/ex_athena/config.ex#L1)

Resolves the provider and per-call options for an ExAthena request.

Resolution order (per key):

  1. `opts[:key]` — per-call override always wins.
  2. `Application.get_env(:ex_athena, provider)[:key]` — provider-specific config.
  3. `Application.get_env(:ex_athena, :key)` — top-level library config.
  4. Provider default (if the provider declares one).

Matches the `stripity_stripe` / `ex_aws` pattern: per-call overrides win,
application config is the default, no global mutable state.

## Known providers

| Atom | Module |
|---|---|
| `:ollama` | `ExAthena.Providers.ReqLLM` |
| `:openai_compatible` | `ExAthena.Providers.ReqLLM` |
| `:openai` | `ExAthena.Providers.ReqLLM` |
| `:llamacpp` | `ExAthena.Providers.ReqLLM` |
| `:claude` | `ExAthena.Providers.ReqLLM` |
| `:anthropic` | `ExAthena.Providers.ReqLLM` |
| `:gemini` | `ExAthena.Providers.ReqLLM` |
| `:req_llm` | `ExAthena.Providers.ReqLLM` |
| `:mock` | `ExAthena.Providers.Mock` |

You may also pass any module that implements `ExAthena.Provider` directly.

# `get`

```elixir
@spec get(module(), atom(), keyword(), term()) :: term()
```

Look up a single configuration value for `provider_module` with the tiered
resolution order. `opts` wins, then provider-specific config, then top-level
config, then the supplied default.

The provider atom is derived from the module name: `Providers.Ollama` → `:ollama`.

# `pop_provider!`

```elixir
@spec pop_provider!(keyword()) :: {module(), keyword()}
```

Pop `:provider` from opts and return `{provider_module, remaining_opts}`.

Raises `ArgumentError` if no provider is set in opts or in application env.

# `provider_module`

```elixir
@spec provider_module(atom() | module()) :: module()
```

Resolve a provider atom (or module) to its implementing module.

# `provider_opts`

```elixir
@spec provider_opts(
  module(),
  keyword()
) :: keyword()
```

Build the keyword list passed to a provider's `query/2` / `stream/3` callback.

Flattens per-call overrides + application env for this provider into one
keyword list. Providers use `Keyword.get/3` on the result.

# `req_llm_provider_tag`

```elixir
@spec req_llm_provider_tag(atom() | module()) :: String.t() | nil
```

Translate an ExAthena provider atom into the `req_llm` provider tag used in
`"tag:model-id"` specs. Returns `nil` when the atom doesn't map to req_llm
(e.g. `:mock`, or a user-supplied module).

---

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