Skip to content

feat(provider): add Eden AI as a first-class provider#36397

Open
Nosenzor wants to merge 2 commits into
anomalyco:devfrom
Nosenzor:feat/edenai-provider
Open

feat(provider): add Eden AI as a first-class provider#36397
Nosenzor wants to merge 2 commits into
anomalyco:devfrom
Nosenzor:feat/edenai-provider

Conversation

@Nosenzor

@Nosenzor Nosenzor commented Jul 11, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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 provider block in opencode.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 @edenai smart 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.ts and is merged into the catalog via a small withBuiltinProviders() helper at each place the catalog is assembled — the v1 Provider service, the v2 Catalog, the connect/list HTTP handler, and the CLI listing commands. I deliberately kept ModelsDev.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:

  • identity headers (HTTP-Referer / X-Title) in both the legacy CUSTOMIZE map and a new v2 EdenAiPlugin;
  • an edenai profile + provider in packages/llm (OpenAI-compatible chat, with fallbacks / routerCandidates passthrough);
  • UI wiring: provider icon, popular-providers entry, and a connect note.

Like OpenRouter it's connect-gated — it only shows up once EDENAI_API_KEY is present. Default models are the @edenai smart router plus a few popular provider/model ids (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?

  • typecheck passes across core, opencode, llm, schema, app, ui, and server.
  • Tests: the full core suite and the legacy opencode provider/config/server suites pass. Added unit tests for the llm provider (packages/llm/test/provider/edenai.test.ts) and the v2 plugin (packages/core/test/plugin/provider-edenai.test.ts), and updated the models-dev and exports tests for the built-in.
  • Ran the CLI against the built-in in isolation (empty config, OPENCODE_DISABLE_MODELS_FETCH=true, EDENAI_API_KEY set): opencode models edenai lists exactly the six built-in models, and with no key it's hidden — identical to openrouter.

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:

Eden AI connected in the Providers settings

Popular providers, Eden AI listed with its connect note ("Route to 500+ models with smart routing and fallbacks"):

Eden AI in the Popular providers list

Connect dialog, prompting for EDENAI_API_KEY:

Connect Eden AI dialog

Models, the Eden AI section listing the routed models (Smart Router + provider/model ids):

Eden AI models in the Models settings

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant