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

Copy Markdown View Source

Remote source for models.dev metadata (https://models.dev/api.json).

  • pull/1 fetches data via Req and caches locally
  • load/1 reads from cached file (no network call)

Options

Configuration

Cache directory can be configured in application config:

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

Default: "priv/llm_db/remote"

Usage

# Pull remote data and cache
mix llm_db.pull

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

Summary

Functions

Transforms models.dev JSON format to canonical Zoi format.

Functions

transform(content)

Transforms models.dev JSON format to canonical Zoi format.

Input Format (models.dev)

{
  "provider_id": {
    "id": "provider_id",
    "name": "Provider Name",
    "models": {
      "model_id": {
        "id": "model_id",
        "name": "Model Name",
        "limit": {"context": 128000, "output": 16384},
        "cost": {"input": 2.50, "output": 10.00},
        ...
      }
    }
  }
}

Output Format (Canonical Zoi)

%{
  "provider_id" => %{
    id: :provider_id,
    name: "Provider Name",
    models: [
      %{
        id: "model_id",
        provider: :provider_id,
        name: "Model Name",
        limits: %{context: 128000, output: 16384},
        cost: %{input: 2.50, output: 10.00},
        ...
      }
    ]
  }
}

Main transformations:

  • Convert provider string IDs to atom keys
  • Convert models map to models list
  • Add provider field to each model
  • Transform field names (limit → limits, etc.)
  • Atomize known field keys