feat(provider): add Eden AI as a first-class provider#36397
Open
Nosenzor wants to merge 2 commits into
Open
Conversation
Eden AI (https://www.edenai.co) is an OpenAI-compatible aggregator gateway: one API key routes to 500+ models with smart routing and fallbacks. This wires it up like OpenRouter so it needs no manual opencode.json config. Because the provider catalog is sourced from models.dev (where Eden AI is not yet published), Eden AI ships as a built-in models.dev-shaped provider in packages/core/src/models-dev-builtin.ts. It is merged into the catalog via withBuiltinProviders() at every assembly site (v1 Provider service, v2 Catalog, the connect/list handlers and CLI), while ModelsDev.get() stays a faithful mirror of models.dev. A real models.dev entry, if one lands, always wins over the built-in. Details: - Curated default models: @edenai (Smart Router) plus popular provider/model ids (Claude, GPT-5, Gemini). Base URL https://api.edenai.run/v3, auth via EDENAI_API_KEY. - OpenRouter-style identity-header enrichment in both provider systems (legacy CUSTOMIZE map + v2 EdenAiPlugin). - packages/llm: edenai profile + provider (OpenAI-compatible chat with fallbacks/routerCandidates passthrough). - UI: icon, popular-providers entry, connect note (en). - Tests for the llm provider and the v2 plugin; updated models-dev and exports tests for the built-in. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Issue for this PR
Closes #
Type of change
What does this PR do?
Adds Eden AI (https://www.edenai.co) as a built-in provider, wired the same way as OpenRouter so it works with no manual
providerblock inopencode.json. Eden AI is an OpenAI-compatible gateway (POST /v3/chat/completions,Authorization: Bearer,EDENAI_API_KEY) that routes to many models behind one key, including the@edenaismart router.The catch: the provider catalog is sourced entirely from models.dev, and Eden AI isn't published there yet. Instead of blocking on an upstream models.dev entry, Eden AI ships as a models.dev-shaped record in
packages/core/src/models-dev-builtin.tsand is merged into the catalog via a smallwithBuiltinProviders()helper at each place the catalog is assembled — the v1Providerservice, the v2Catalog, the connect/list HTTP handler, and the CLI listing commands. I deliberately keptModelsDev.get()itself untouched so it stays a faithful mirror of models.dev (its unit tests pin that contract), which is why the merge lives at the consumers rather than in the service. The merge is{ ...builtin, ...data }, so if Eden AI ever lands on models.dev the real entry wins and the built-in silently steps aside.The rest mirrors how OpenRouter is wired:
HTTP-Referer/X-Title) in both the legacyCUSTOMIZEmap and a new v2EdenAiPlugin;edenaiprofile + provider inpackages/llm(OpenAI-compatible chat, withfallbacks/routerCandidatespassthrough);Like OpenRouter it's connect-gated — it only shows up once
EDENAI_API_KEYis present. Default models are the@edenaismart router plus a few popularprovider/modelids (Claude, GPT-5, Gemini); their costs/limits are indicative list prices, since Eden AI reports exact per-request cost at runtime.How did you verify your code works?
typecheckpasses across core, opencode, llm, schema, app, ui, and server.packages/llm/test/provider/edenai.test.ts) and the v2 plugin (packages/core/test/plugin/provider-edenai.test.ts), and updated themodels-devandexportstests for the built-in.OPENCODE_DISABLE_MODELS_FETCH=true,EDENAI_API_KEYset):opencode models edenailists exactly the six built-in models, and with no key it's hidden — identical toopenrouter.Screenshots / recordings
The only UI surface is the Eden AI entry in the connect/model dialogs (icon + name + note); there are no layout changes.
Providers → connected, showing Eden AI with its icon:
Popular providers, Eden AI listed with its connect note ("Route to 500+ models with smart routing and fallbacks"):
Connect dialog, prompting for
EDENAI_API_KEY:Models, the Eden AI section listing the routed models (Smart Router +
provider/modelids):Checklist