Add AI/ML API provider - #6189
Open
hugoaimlapi wants to merge 4 commits into
Open
Conversation
AI/ML API is an aggregator exposing many creators' models behind one OpenAI-compatible key, so it gets a sync provider rather than a hand-written model set. The public catalog needs no key. Only entries served as openai/chat-completions are taken, and of those only the ones whose output is purely text — an id can appear under several endpoint types, and its image or audio surface is a different product. Pricing is quoted as price-per-N-tokens and keyed by origin (provided / generated / cached), which maps onto input / output / cache_read. 163 of the 338 text-output chat models are published here. The rest are skipped by skippedNotice because the catalog does not yet expose a description or an output limit for them; inventing either would be worse than an absent entry. deleteMissing is off since the catalog lists far more than the chat surface, so one response omitting a model is not proof it is gone. Capability flags the catalog does not report (reasoning, tool_call, structured_output, open_weights) keep any value already in the repo instead of being overwritten with a guess. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Add AI/ML API provider with catalog sync
…ng them
AI/ML API hosts other people's models and authors none of them, so every
entry has to point at the lab file. AGENTS.md makes that a blocker
("Non-lab hosts use base_model"), and the previous full inlines both
violated it and drifted from the repository's own data: 65 models
disagreed with their lab entry on reasoning, 75 on tool_call, 37 on
structured_output, 17 on attachment. openai/gpt-5 shipped here as
reasoning = false, tool_call = false while models/openai/gpt-5.toml says
both are true.
The cause was a fallback of the shape `existing?.reasoning ?? false`.
`existing` only ever reads this provider's own directory, which does not
exist for a new provider, so the guard never applied and every model was
written as false. The entries now carry no capability flags at all, so
there is nothing left to contradict.
What a file states is now only what is genuinely ours: cost, a limit when
it differs from the base, and reasoning_options. The limit no longer sets
`input`, because the catalog publishes a context window and an output cap
but no input cap, and equating input with the whole context overwrote the
lab's correct split (272k in + 128k out inside a 400k window).
reasoning_options is required whenever the base reasons, and no lab entry
carries it (0 of 245). It is read per model from the API's own published
request schema at /docs-json, so the declared control is the one the
endpoint actually accepts rather than an assumption.
Coverage is 108 of the 338 text-output chat models. 192 are skipped
because this repository has no lab entry to point at — authoring complete
lab files for them would mean sourcing capability metadata the catalog
does not publish — and 38 because their base reasons but the API does not
document the control. Both groups are reported through skippedNotice.
Verified: bun run validate exits 0 and resolves aimlapi/openai/gpt-5 to
reasoning = true, tool_call = true and the lab limit split, with our
price. bun test is 268 pass / 4 fail, the same four failures a pristine
tree produces. Re-running the sync reports 108 unchanged.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Reference lab entries with base_model instead of inlining them
Contributor
Action items
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds AI/ML API — an OpenAI-compatible multi-model gateway — with a catalog sync module.
providers/aimlapi/:provider.toml(npm = "@ai-sdk/openai-compatible",api = "https://api.aimlapi.com/v1",env = ["AIMLAPI_API_KEY"]),logo.svg(currentColor, square viewBox), and 108 chat modelspackages/core/src/sync/providers/aimlapi.ts+bun aimlapi:sync: syncs from the public catalog (GET /v1/models?include=pricing,modalities, no key required). Onlyopenai/chat-completionsentries with text-only output are importedbase_model; provider files are override-only — cost, host limits where they differ, andreasoning_optionsread per model from the API's published request schemaprovided/generated/cached→input/output/cache_read)models/, and reasoning models where the API exposes no reasoning control, are skipped rather than guessedDocs: https://docs.aimlapi.com · Pricing: https://aimlapi.com/pricing