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

Provider execution result tagged by response kind.

Providers return this struct from native and compatibility calls so routing,
fallback, HTTP route rendering, and token accounting can branch on an explicit
`:kind` instead of inferring meaning from nullable fields.

# `kind`

```elixir
@type kind() :: :response | :stream | :error
```

# `replay_safety`

```elixir
@type replay_safety() :: :safe | :uncertain | :forbidden
```

# `t`

```elixir
@type t() :: %LLMProxy.Providers.Result{
  error: String.t() | nil,
  kind: kind(),
  model: String.t() | nil,
  provider: module() | nil,
  provider_body: term() | nil,
  provider_name: String.t() | nil,
  rate_limit_kind: :throttle | :quota | :none,
  rate_limit_scope: :model | :account,
  replay_safety: replay_safety() | nil,
  response: map() | nil,
  retry_after_ms: non_neg_integer() | nil,
  status: pos_integer() | nil,
  stream: Enumerable.t() | nil,
  token: token()
}
```

# `token`

```elixir
@type token() :: map() | nil
```

# `client_error`

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

# `error`

```elixir
@spec error(String.t(), pos_integer(), token(), keyword()) :: t()
```

# `response`

```elixir
@spec response(map(), token()) :: t()
```

# `stream`

```elixir
@spec stream(Enumerable.t(), token()) :: t()
```

# `stream_failure`

```elixir
@spec stream_failure(module(), String.t(), token(), term(), String.t() | nil) :: t()
```

# `unavailable_tokens`

```elixir
@spec unavailable_tokens(term()) :: {:error, t()}
```

# `with_attempt`

```elixir
@spec with_attempt({:ok, t()} | {:error, t()}, LLMProxy.Providers.Attempt.t()) ::
  {:ok, t()} | {:error, t()}
```

# `with_attempt`

```elixir
@spec with_attempt({:ok, t()} | {:error, t()}, module(), String.t()) ::
  {:ok, t()} | {:error, t()}
```

---

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