Skip to main content

modelparams

Typed model parameters for Python, generated from the open modelparams.dev catalog.

pip install modelparams

Typed request parameters

Generated TypedDict definitions provide autocomplete and static errors for unsupported keys, incorrect value types, and invalid enum values:

from modelparams import validate_params
from modelparams.types.openai import Gpt_4_1Params

params: Gpt_4_1Params = {
    "max_tokens": 1024,
    "temperature": 0.7,
}

validated = validate_params("openai/gpt-4.1", params)

validate_params uses a cached strict Pydantic adapter. It returns a provider-keyed dictionary or raises pydantic.ValidationError for unknown parameters, coercions, invalid enum values, or values outside the catalog range.

from openai import OpenAI

OpenAI().chat.completions.create(model="gpt-4.1", messages=messages, **validated)

Provider-specific dot paths remain literal dictionary keys:

from modelparams.types.anthropic import Claude_Haiku_4_5_20251001Params

params: Claude_Haiku_4_5_20251001Params = {
    "thinking.type": "enabled",
    "thinking.budget_tokens": 4096,
}

Catalog helpers

from modelparams import get_defaults, get_model, get_param, list_models

model = get_model("anthropic/claude-haiku-4-5-20251001")
print(model.auth_type, model.params)

defaults = get_defaults("anthropic/claude-haiku-4-5-20251001")
thinking = get_param("anthropic/claude-haiku-4-5-20251001", "thinking.type")
anthropic_models = list_models("anthropic")

The catalog is bundled with the package. No network request is made at runtime.

Development

From the repository root:

npm run codegen:python
uv sync --project packages/modelparams-python --extra dev
uv run --project packages/modelparams-python pytest packages/modelparams-python/tests

Generated catalog and type files are committed and verified in CI. Python releases use independent modelparams-py@x.y.z tags and publish to PyPI through the repository's trusted-publisher workflow.

Download files

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

Source Distribution

modelparams-0.0.2.tar.gz (29.8 kB view details)

Uploaded Source

Built Distribution

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

modelparams-0.0.2-py3-none-any.whl (43.9 kB view details)

Uploaded Python 3

File details

Details for the file modelparams-0.0.2.tar.gz.

File metadata

  • Download URL: modelparams-0.0.2.tar.gz
  • Upload date:
  • Size: 29.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for modelparams-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c4c804b488f6186f3188e49b332ec355e00a8459247091a945667c36fba3a1e0
MD5 27e53185864409d4641dd4a7b1d4d65a
BLAKE2b-256 739d3a7e89dda935998735eeeb6ea740670fe433f36585575cd8fee84c519d36

See more details on using hashes here.

Provenance

The following attestation bundles were made for modelparams-0.0.2.tar.gz:

Publisher: release-modelparams-python.yml on mnfst/modelparams.dev

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

File details

Details for the file modelparams-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: modelparams-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 43.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for modelparams-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 40aa04d431849d02c78611e8d6aee34d1fb4da54f126455c2b8112a7f24083d1
MD5 dfa2ce7846b02179db7b7bc39e2f8e81
BLAKE2b-256 2ab4d84b8feeafb5512e4592e0c46685a583ffbddd9ce1028467aa91384fa4cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for modelparams-0.0.2-py3-none-any.whl:

Publisher: release-modelparams-python.yml on mnfst/modelparams.dev

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