# `LLMDB.Sources.Anthropic`
[🔗](https://github.com/agentjido/llm_db/blob/main/lib/llm_db/sources/anthropic.ex#L1)

Remote source for Anthropic models (https://api.anthropic.com/v1/models).

- `pull/1` fetches data from Anthropic API and caches locally
- `load/1` reads from cached file (no network call)

## Options

- `:url` - API endpoint (default: "https://api.anthropic.com/v1/models")
- `:api_key` - Anthropic API key (required, or set `ANTHROPIC_API_KEY` env var)
- `:anthropic_version` - API version (default: "2023-06-01")
- `:beta` - Optional beta versions list
- `:limit` - Items per page (1-1000, default: 1000 to fetch all)
- `:req_opts` - Additional Req options for testing

## Configuration

Cache directory can be configured in application config:

    config :llm_db,
      anthropic_cache_dir: "priv/llm_db/remote"

Default: `"priv/llm_db/remote"`

## Usage

    # Pull remote data and cache (requires API key)
    mix llm_db.pull --source anthropic

    # Load from cache
    {:ok, data} = Anthropic.load(%{})

# `transform`

Transforms Anthropic API response to canonical Zoi format.

## Input Format (Anthropic)

```json
{
  "data": [
    {
      "id": "claude-sonnet-4-20250514",
      "type": "model",
      "display_name": "Claude Sonnet 4",
      "created_at": "2025-02-19T00:00:00Z"
    }
  ]
}
```

## Output Format (Canonical Zoi)

```elixir
%{
  "anthropic" => %{
    id: :anthropic,
    name: "Anthropic",
    models: [
      %{
        id: "claude-sonnet-4-20250514",
        provider: :anthropic,
        name: "Claude Sonnet 4",
        extra: %{
          type: "model",
          created_at: "2025-02-19T00:00:00Z"
        }
      }
    ]
  }
}
```

---

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