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

Remote source for Zenmux models (https://zenmux.ai/api/v1/models).

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

## Options

- `:url` - API endpoint (default: "https://zenmux.ai/api/v1/models")
- `:api_key` - Zenmux API key (required, or set `ZENMUX_API_KEY` env var)
- `:req_opts` - Additional Req options for testing

## Configuration

Cache directory can be configured in application config:

    config :llm_db,
      zenmux_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 zenmux

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

# `transform`

Transforms Zenmux API response to canonical Zoi format.
Zenmux is OpenAI compatible, so the structure mirrors OpenAI's.

## Input Format (Expected)

```json
{
  "object": "list",
  "data": [
    {
      "id": "gpt-4",
      "object": "model",
      "created": 1686935002,
      "owned_by": "openai"
    }
  ]
}
```

## Output Format (Canonical Zoi)

```elixir
%{
  "zenmux" => %{
    id: :zenmux,
    name: "Zenmux",
    models: [
      %{
        id: "gpt-4",
        provider: :zenmux,
        extra: %{
          created: 1686935002,
          owned_by: "openai"
        }
      }
    ]
  }
}
```

---

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