Metadata-Version: 2.4
Name: modelparams
Version: 0.0.1
Summary: Typed model parameters for Python, generated from the modelparams.dev catalog.
Project-URL: Homepage, https://modelparams.dev
Project-URL: Repository, https://github.com/mnfst/modelparameters.dev
Project-URL: Issues, https://github.com/mnfst/modelparameters.dev/issues
Author: modelparams.dev contributors
License-Expression: MIT
License-File: LICENSE
Keywords: ai,llm,model-parameters,pydantic,typing
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: pydantic<3,>=2.10
Requires-Dist: typing-extensions>=4.12
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: mypy>=1.13; extra == 'dev'
Requires-Dist: pytest>=8.3; extra == 'dev'
Requires-Dist: ruff>=0.9; extra == 'dev'
Requires-Dist: twine>=6.0; extra == 'dev'
Description-Content-Type: text/markdown

# modelparams

Typed model parameters for Python, generated from the open
[modelparams.dev](https://modelparams.dev) catalog.

```bash
pip install modelparams
```

## Typed request parameters

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

```python
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.

```python
from openai import OpenAI

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

Provider-specific dot paths remain literal dictionary keys:

```python
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

```python
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:

```bash
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.
