Skip to main content

Standalone model alias resolver

Project description

llm_model_alias

A standalone Python package for resolving model aliases across platforms (vllm, vllm-metal, ollama, openai, custom) with JSON-backed mappings.

Features

  • Resolve a model alias to a platform-specific model id.
  • Store mappings in a JSON file.
  • Seed defaults from packaged mappings.
  • Pass through openai and custom model names unchanged.
  • Local-only is_downloaded checks for Ollama and Hugging Face cache.

Installation

From the llm_model_alias directory:

pip install -e .

Public API

  • Class: LLMModelAlias
  • Types: ModelPlatform, ModelPlatformMapping, ModelMapping, ResolvedModelMapping
  • Constant: MODEL_PLATFORMS

Main methods:

  • resolve(model_name, platform) -> str
  • get(model_name, platform) -> ResolvedModelMapping
  • is_downloaded(model_name, platform) -> bool
  • load() -> list[ModelMapping]
  • json_path() -> Path
  • normalize_model_name(model_name) -> str
  • ollama_url() -> str

Configuration

Mapping file location

JSON schema:

{
  "mappings": []
}

Path precedence:

  1. data_file constructor parameter
  2. MODEL_ALIAS_JSON_FILE environment variable
  3. OS default path

If the selected path does not exist and data_file is not explicitly provided, packaged defaults are loaded from src/llm_model_alias/data/default_model_mappings.json.

OS defaults:

  • Linux: ${XDG_DATA_HOME:-~/.local/share}/llm_model_alias/model_mappings.json
  • macOS: ~/Library/Application Support/llm_model_alias/model_mappings.json

Ollama URL

URL precedence:

  1. ollama_url constructor parameter
  2. MODEL_ALIAS_OLLAMA_URL environment variable
  3. http://localhost:11434

Usage

from pathlib import Path

from llm_model_alias import LLMModelAlias

alias = LLMModelAlias(
  data_file=Path("./model_mappings.json"),
  ollama_url="http://localhost:11434",
)

resolved = alias.resolve("qwen3.5:9b", "vllm")
print(resolved)

mapping = alias.get("qwen3.5:9b", "vllm")
print(mapping)

Notes

  • Default mappings live at src/llm_model_alias/data/default_model_mappings.json.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_model_alias-0.1.0.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_model_alias-0.1.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file llm_model_alias-0.1.0.tar.gz.

File metadata

  • Download URL: llm_model_alias-0.1.0.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for llm_model_alias-0.1.0.tar.gz
Algorithm Hash digest
SHA256 317b39104a4017d2b545042f6a5e0f5f71d3099b722bf2ef5a8216531d11cb34
MD5 e777005a6be315c6cf418b95e5a3d694
BLAKE2b-256 36a928bae55c5c4dc1375afd9b3790a62daab8ec17df19ed924df41967b77ec4

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_model_alias-0.1.0.tar.gz:

Publisher: publish.yml on charlesverge/llm-model-alias

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_model_alias-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: llm_model_alias-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for llm_model_alias-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 53e7fab0b980fefac5314d103f4cbb42eca4bd47b422f3abf68c490cc5114d7e
MD5 e500c2708d4d89988d652f1782f21f8b
BLAKE2b-256 82b11450eac60f778050ef5d4c606e4daf2eef8177e1de4b3b2d526d6c16be07

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_model_alias-0.1.0-py3-none-any.whl:

Publisher: publish.yml on charlesverge/llm-model-alias

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page