Consuming data
Use the npm package if you want typed helpers in a JavaScript or TypeScript app.
bun add ai-model-directory
import { getModel, getProvider, getProviders } from "ai-model-directory";
const openai = getProvider("openai");
const gpt = getModel("openai", "gpt-5.5");
const providers = getProviders();
The package bundles a compact payload and decodes it into the same provider/model shape as data/all.json.
Fetch the JSON directly
If you do not want the package, fetch the generated JSON from the repository or from your own copy of the data.
type Directory = Record<string, unknown>;
const response = await fetch(
"https://raw.githubusercontent.com/The-Best-Codes/ai-model-directory/main/data/all.min.json",
);
const directory = (await response.json()) as Directory;
all.json is formatted for reading. all.min.json is better for download size.
Keep it updated
Provider pricing and model lists change often. Update the package regularly and avoid assuming a model or price will never change.