@opencode-ai/models
Advanced tools
+1
-1
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "name": "@opencode-ai/models", | ||
| "version": "0.0.3", | ||
| "version": "0.0.4", | ||
| "description": "Official typed client for the models.dev API — an open database of AI model capabilities, pricing, and limits", | ||
@@ -6,0 +6,0 @@ "type": "module", |
+4
-29
| # @opencode-ai/models | ||
| Official typed client for the [models.dev](https://models.dev) API — an open-source database of AI model capabilities, pricing, and limits. | ||
| Official typed client for the [Models.dev](https://models.dev) API. | ||
@@ -9,6 +9,2 @@ ```sh | ||
| - **Zero dependencies.** The root client is a small `fetch` wrapper; works on Node ≥ 18, Bun, Deno, browsers, and edge runtimes. | ||
| - **Fully typed.** Hand-written types, verified in CI to be exactly equivalent to the schemas that generate the data. | ||
| - **Three entrypoints.** Promise client, [Effect](https://effect.website) client, and a bundled offline snapshot. | ||
| ## Usage | ||
@@ -30,15 +26,2 @@ | ||
| | Method | Endpoint | Contents | | ||
| | --- | --- | --- | | ||
| | `providers()` | `/api.json` | Providers with their models, pricing, and limits | | ||
| | `models()` | `/models.json` | Provider-agnostic model metadata, keyed by `<lab>/<model>` | | ||
| | `catalog()` | `/catalog.json` | `{ providers, models }` in a single payload | | ||
| The client is **stateless**: every call performs exactly one GET, nothing is cached, and lookups are plain object access on the returned data. Cache however you like: | ||
| ```ts | ||
| let cached: Promise<ProviderMap> | undefined | ||
| const providers = () => (cached ??= client.providers()) | ||
| ``` | ||
| Options: | ||
@@ -58,5 +41,5 @@ | ||
| ## Offline snapshot | ||
| ## Snapshot | ||
| A full copy of the database ships inside the package as a separate, tree-shakable entrypoint — nothing from it is loaded or bundled unless you import it: | ||
| A full copy of the database ships inside the package as a separate, tree-shakable entrypoint: | ||
@@ -75,3 +58,3 @@ ```ts | ||
| Freshness: the published snapshot is at most ~24h behind the live API (data releases are automated). The client is the freshness path; the snapshot is the availability path. | ||
| The published snapshot is at most ~24h behind the live API (data releases are automated). | ||
@@ -105,9 +88,1 @@ ## Effect | ||
| ``` | ||
| ## Types | ||
| All data types are exported from the root (and re-exported from `/effect`): `Provider`, `Model`, `ModelMetadata`, `Catalog`, `Cost`, `Limit`, `ReasoningOption`, and friends. | ||
| ## Contributing | ||
| The data lives as TOML files in [anomalyco/models.dev](https://github.com/anomalyco/models.dev) — corrections and new models/providers are welcome there. This package is generated and published from that repository. |
Sorry, the diff of this file is too big to display
14034
0.01%3570130
-0.03%84
-22.94%