Home
Model List

Adding a provider

Before adding a provider, read a few existing adapters so the new one follows the same conventions. Good examples are openai, anthropic, openrouter, and aihubmix.

Steps

  1. Create src/providers/<provider>.ts exporting a ProviderDefinition with name, outputDirectory, and fetchModels.
  2. Use fetchJson from src/lib/http.ts for HTTP calls.
  3. Use helpers from src/providers/helpers.ts and src/lib/pricing.ts for normalized fields and price math.
  4. Add the provider to src/providers/index.ts.
  5. Create data/providers/<provider>/index.toml with provider metadata.
  6. If the provider needs a credential, add it to .env.example and the update workflow.
  7. Run bun src/index.ts -p <provider> and inspect the generated model TOML.
  8. Run bun src/build-all.ts so data/all.json and data/all.min.json are updated.
  9. Run bunx --bun tsc -b and bunx prettier . -w.

Metadata fixes

Generated index.toml files are rewritten by the updater. To override or preserve model data, add metadata.toml next to the generated model file.

metadata.toml supports manual_data, extends, priorities, and preserve. Use it for provider API gaps, friendly names, inherited metadata, or models that should stay even if they disappear upstream.