# `Pixir.Providers.Anthropic`
[🔗](https://github.com/Ranvier-Technologies/pixir/blob/main/lib/pixir/providers/anthropic.ex#L1)

Anthropic Messages API transport core for Pixir's Provider seam.

This module accepts Anthropic-native request maps and returns the same assembled
streamed shape the Turn loop consumes from providers. The OpenAI Responses
implementation stays separate in `Pixir.Provider`; this namespace owns Anthropic
request shaping, SSE event decoding, usage normalization, and transport selection.

# `request`

```elixir
@type request() :: %{
  optional(:model) =&gt; String.t(),
  optional(:messages) =&gt; [map()],
  optional(:history) =&gt; [map()],
  optional(:system) =&gt; String.t() | [map()],
  optional(:system_prompt) =&gt; String.t(),
  optional(:tools) =&gt; [map()],
  optional(:max_tokens) =&gt; pos_integer(),
  optional(:reasoning_effort) =&gt; String.t() | atom()
}
```

# `result`

```elixir
@type result() :: %{
  text: String.t(),
  reasoning: String.t(),
  reasoning_items: [map()],
  function_calls: [%{call_id: String.t(), name: String.t(), args: map()}],
  output_items: [reasoning: map(), function_call: map()],
  usage: map() | nil,
  usage_summary: map(),
  provider_metadata: map(),
  finish_reason: :stop | :tool_calls,
  output_truncation: Pixir.Provider.OutputTruncation.t()
}
```

# `stream`

```elixir
@spec stream(
  request(),
  keyword()
) :: {:ok, result()} | {:error, map()}
```

Stream one Anthropic Messages API call over HTTP/SSE.

---

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