LLMDB.Sources.Anthropic (LLM DB v2026.3.0)

Copy Markdown View Source

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(%{})

Summary

Functions

Transforms Anthropic API response to canonical Zoi format.

Functions

transform(content)

Transforms Anthropic API response to canonical Zoi format.

Input Format (Anthropic)

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

Output Format (Canonical Zoi)

%{
  "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"
        }
      }
    ]
  }
}