# `LLMProxy.Providers.OpenAICodex.OAuth`
[🔗](https://github.com/elixir-vibe/llm_proxy/blob/v0.3.1/lib/llm_proxy/providers/openai_codex/oauth.ex#L1)

OAuth credential refresh boundary for the OpenAI Codex provider.

ReqLLM returns refreshed OpenAI credentials as provider JSON with string keys.
This module is the only place in LLMProxy that parses that external shape and
converts it into typed data and atom-keyed storage updates.

# `refresh_fun`

```elixir
@type refresh_fun() :: (map(), keyword() -&gt; {:ok, map()} | {:error, term()})
```

# `t`

```elixir
@type t() :: %LLMProxy.Providers.OpenAICodex.OAuth{
  access: String.t(),
  account_id: String.t() | nil,
  expires_at: DateTime.t(),
  refresh: String.t()
}
```

# `from_refresh_response`

```elixir
@spec from_refresh_response(map()) :: {:ok, t()} | {:error, term()}
```

# `new`

```elixir
@spec new(String.t(), String.t(), DateTime.t(), String.t() | nil) ::
  {:ok, t()} | {:error, String.t()}
```

# `refresh_if_needed`

```elixir
@spec refresh_if_needed(
  LLMProxy.Provider.Credential.t() | LLMProxy.Schemas.ProviderToken.t(),
  refresh_fun()
) ::
  {:ok, LLMProxy.Provider.Credential.t() | LLMProxy.Schemas.ProviderToken.t()}
  | {:error, term()}
```

# `storage_attrs`

```elixir
@spec storage_attrs(t()) :: map()
```

---

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