From c0e4f88644f3e451ec32bb04773ab02fe7a568bc Mon Sep 17 00:00:00 2001 From: Bruno Perez Date: Mon, 15 Jun 2026 15:10:03 +0200 Subject: [PATCH] docs: add npm usage with a type-safe OpenAI example Lead the README with `npm install modelparams` and a short OpenAI SDK snippet showing `ParamsOf` catch an unsupported param at compile time. Trim the intro, API, and contributing sections so the page stays short and points to the package README for the rest. --- README.md | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index dcc1cb1..6da654c 100644 --- a/README.md +++ b/README.md @@ -11,31 +11,45 @@ [![npm downloads](https://img.shields.io/npm/dm/modelparams.svg)](https://www.npmjs.com/package/modelparams) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) -[modelparams.dev](https://modelparams.dev) is an open-source database that lists the parameters available for popular AI models. It is heavily inspired on [models.dev](https://github.com/anomalyco/models.dev) and we use it at [Manifest](https://manifest.build/). +Every parameter each AI model accepts, in one place. Inspired by [models.dev](https://github.com/anomalyco/models.dev); we use it at [Manifest](https://manifest.build/). + +## TypeScript + +```bash +npm install modelparams +``` + +`ParamsOf` is the exact set of parameters a model accepts. Pass one it doesn't, and your code won't compile. + +```ts +import type { ParamsOf } from "modelparams"; +import OpenAI from "openai"; + +const params: ParamsOf<"openai/gpt-4.1"> = { + max_tokens: 1024, + temperature: 0.7, + // top_k: 40, // won't compile: gpt-4.1 has no top_k +}; + +await new OpenAI().chat.completions.create({ model: "gpt-4.1", messages, ...params }); +``` + +Defaults, runtime validation, and the helper APIs are in the [package README](packages/modelparams/README.md). ## API -You can access this data through an API. +Prefer raw JSON? ``` curl https://modelparams.dev/api/v1/models.json curl https://modelparams.dev/api/v1/params/gpt-5.5.json -curl https://modelparams.dev/api/v1/params/gpt-5.5-subscription.json ``` -The catalog follows the [Model Parameters convention](docs/model-parameters-schema.md). -The generated JSON Schema is available at -`https://modelparams.dev/api/v1/schema.json`. - -## Adding a model or a parameter - -See [CONTRIBUTING.md](CONTRIBUTING.md). The short version: +Schema at `https://modelparams.dev/api/v1/schema.json`, per the [Model Parameters convention](docs/model-parameters-schema.md). -1. Pick a unique ID: `/` for the API-key variant, `/-subscription` for the subscription variant. Example: `mistral/mistral-large`. -2. Add a YAML file at `models//.yaml` (or `models//-subscription.yaml`). -3. Open a PR. CI validates against the schema and rebuilds. +## Adding a model -Don't want to open a PR? [File an issue](https://github.com/mnfst/modelparams.dev/issues/new/choose) with the model and a link to the official docs, and someone will pick it up. +Drop a YAML file in `models//`, open a PR, and CI validates it against the schema. Details in [CONTRIBUTING.md](CONTRIBUTING.md). Can't open a PR? [File an issue](https://github.com/mnfst/modelparams.dev/issues/new/choose) with a link to the docs. ## Local development