Skip to content

feat(providers): add Eden AI as an OpenAI-compatible provider - #4894

Closed
MVS-source wants to merge 1 commit into
maximhq:mainfrom
MVS-source:add-edenai-provider
Closed

feat(providers): add Eden AI as an OpenAI-compatible provider#4894
MVS-source wants to merge 1 commit into
maximhq:mainfrom
MVS-source:add-edenai-provider

Conversation

@MVS-source

Copy link
Copy Markdown

Summary

Adds Eden AI (edenai.co) as a first-class provider. Eden AI is a European, OpenAI-compatible gateway to 100+ models (Mistral, OpenAI, Anthropic, Google, Cohere, DeepSeek, …) behind a single key. The provider delegates to the existing OpenAI implementation — the same pattern as opencode/openrouter — pointing at Eden's /v3 base URL.

Changes

  • core/providers/edenai: new provider package. Chat completions (+ streaming), Responses API (delegated to chat), and list models are supported; other operations return unsupported_operation. Errors use the standard OpenAI envelope, so no custom parser is needed.
  • Register EdenAI in core/schemas/bifrost.go (ModelProvider enum + StandardProviders) and in the provider factory in core/bifrost.go.
  • transports/config.schema.json: add edenai to the provider config + base-provider enum.
  • Docs: providers/supported-providers/edenai page, an overview-table row, and the nav entry.

Design note: Eden serves its OpenAI-compatible API under a /v3 base path (https://api.edenai.run/v3), so the chat path is /chat/completions appended to that base (not /v1/...).

Type of change

  • Feature
  • Documentation

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Docs

How to test

go build ./...
go test ./core/providers/edenai/...

# Live check (hits the real Eden AI API; skipped when the env var is unset):
EDENAI_API_KEY=<your-key> go test ./core/providers/edenai/... -run EdenAILive -v

Verified locally: go build ./... passes, unit tests pass, and the gated live test performs a real chat completion through the provider against mistral/mistral-small-latest / openai/gpt-4o-mini and returns a valid response.

Notes for the reviewer

  • The live test is gated on EDENAI_API_KEY and skips by default, so CI stays hermetic. Happy to have the Eden AI team provide a CI secret if you'd like it exercised in CI (scoped to the relevant step).
  • I did not add UI dashboard constants (icon/label) for Eden AI — glad to add those if you'd like the provider surfaced in the web UI.

@MVS-source
MVS-source requested a review from a team as a code owner July 3, 2026 15:10
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added support for a new Eden AI provider, including model listing, chat, and responses capabilities.
    • Eden AI is now available as a built-in provider option and can be used in provider configurations.
  • Documentation

    • Added provider setup and usage docs for Eden AI.
    • Updated the supported providers overview to include Eden AI.
  • Tests

    • Added coverage for Eden AI configuration defaults, unsupported operations, and a live chat completion check.

Walkthrough

Adds a new Eden AI provider to Bifrost: a provider implementation delegating chat/responses/list-models to shared OpenAI handlers, wiring into the provider factory and schema constants, unit/live tests, documentation, and config schema updates to recognize edenai.

Changes

Eden AI Provider Integration

Layer / File(s) Summary
Provider enum and factory wiring
core/schemas/bifrost.go, core/bifrost.go
Adds EdenAI constant to ModelProvider and StandardProviders, and wires it into createBaseProvider.
Provider construction and client setup
core/providers/edenai/edenai.go
Defines edenaiProvider struct and NewEdenAIProvider with fasthttp client setup, proxy/TLS config, streaming client, default base URL, plus GetProviderKey and ListModels.
Chat completion and responses delegation
core/providers/edenai/edenai.go
Implements ChatCompletion, ChatCompletionStream (Bearer auth header), Responses, ResponsesStream; marks text completion unsupported.
Unsupported operation stubs
core/providers/edenai/edenai.go
Implements remaining interface methods (embedding, rerank, OCR, speech, transcription, image/video, batch/file/container/cached-content, passthrough) as unsupported.
Unit and live tests
core/providers/edenai/edenai_test.go, core/providers/edenai/edenai_live_test.go
Adds interface conformance, constructor default, unsupported-op tests, and a live chat completion test gated by EDENAI_API_KEY.
Documentation and config schema updates
docs/providers/supported-providers/edenai.mdx, docs/providers/supported-providers/overview.mdx, docs/docs.json, transports/config.schema.json
Adds Eden AI docs page, nav entry, support matrix row, and schema entries for edenai as standard/custom base provider type.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Bifrost
  participant edenaiProvider
  participant EdenAI_API

  Client->>Bifrost: ChatCompletion request
  Bifrost->>edenaiProvider: ChatCompletion(ctx, key, request)
  edenaiProvider->>edenaiProvider: build Authorization Bearer header
  edenaiProvider->>EdenAI_API: POST /chat/completions
  EdenAI_API-->>edenaiProvider: chat response
  edenaiProvider-->>Bifrost: BifrostChatResponse
  Bifrost-->>Client: response
Loading

Possibly related PRs

  • maximhq/bifrost#4425: Overlaps in Authorization Bearer header construction shared with OpenAI-compatible handlers used by the new EdenAI provider.
  • maximhq/bifrost#4601: Modifies the same createBaseProvider switch and StandardProviders list to register a new provider.
  • maximhq/bifrost#4736: Extends the same provider-registration plumbing in core/bifrost.go and core/schemas/bifrost.go for a different new provider.

Suggested reviewers: akshaydeo, danpiths

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding Eden AI as an OpenAI-compatible provider.
Description check ✅ Passed The PR description covers summary, changes, type, affected areas, and testing, with only non-critical template sections missing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@CLAassistant

CLAassistant commented Jul 3, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Eden AI (https://www.edenai.co/) is a European, OpenAI-compatible gateway to
100+ models behind a single key. The provider delegates to the OpenAI
implementation (same pattern as opencode/openrouter), pointing at Eden's
/v3 base URL. Supports chat completions (+ streaming), the Responses API
(delegated), and list models.

- core/providers/edenai: new provider package (+ unit and gated live tests)
- register EdenAI in schemas (ModelProvider enum + StandardProviders) and the
  provider factory in core/bifrost.go
- transports: add edenai to the config JSON schema
- docs: supported-providers/edenai page, overview row, nav entry
@MVS-source
MVS-source force-pushed the add-edenai-provider branch from 9c966fb to ba3e3a7 Compare July 3, 2026 15:21
@coderabbitai
coderabbitai Bot requested review from akshaydeo and danpiths July 3, 2026 15:22
@greptile-apps

greptile-apps Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

The change is additive and self-contained — it wires a new provider that delegates entirely to well-tested OpenAI helpers without touching any shared code paths.

The implementation faithfully mirrors the Fireworks/OpenRouter delegation pattern: unary calls pass key directly to HandleOpenAIChatCompletionRequest (which handles Bearer injection internally), and streaming builds the auth header explicitly before calling HandleOpenAIChatCompletionStreaming with streamingClient. The compile-time interface assertion, constructor defaults test, and gated live test are all present. The only gap is that only 3 of ~30 unsupported operations are asserted, leaving the rest unguarded against accidental future wiring.

core/providers/edenai/edenai_test.go — the unsupported-operation sweep covers only 3 of ~30 methods.

Important Files Changed

Filename Overview
core/providers/edenai/edenai.go New provider; follows Fireworks/OpenRouter delegation pattern correctly. Streaming path uses BuildStreamingClient and constructs auth header explicitly. All interface methods implemented.
core/providers/edenai/edenai_test.go Compile-time interface assertion present; constructor defaults and 3 unsupported operations tested, but test coverage is sparse — no table-driven unsupported-op sweep and no mock-HTTP tests for the happy paths.
core/providers/edenai/edenai_live_test.go Gated on EDENAI_API_KEY; CI-safe live smoke test for ChatCompletion; correct pattern.
core/schemas/bifrost.go EdenAI constant added to ModelProvider enum and StandardProviders list; straightforward and complete.
core/bifrost.go Factory switch-case entry for EdenAI added correctly before the default branch.
transports/config.schema.json edenai added to both the providers object properties and the base-provider enum; aligns with the schema source-of-truth rule.
docs/providers/supported-providers/edenai.mdx New doc page; capabilities table, config.json snippet, and curl example are accurate against the implementation.
docs/providers/supported-providers/overview.mdx Eden AI row added with correct ✅/❌ values matching the provider implementation.
docs/docs.json edenai doc page registered in nav; alphabetically placed between databricks and elevenlabs.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant C as Caller
    participant B as Bifrost Core
    participant E as edenaiProvider
    participant OAI as openai helpers
    participant API as api.edenai.run/v3

    C->>B: ChatCompletion / ChatCompletionStream
    B->>E: route via createBaseProvider (schemas.EdenAI)

    alt Unary ChatCompletion
        E->>OAI: HandleOpenAIChatCompletionRequest(client, url, key, ...)
        OAI->>API: POST /v3/chat/completions (Bearer key)
        API-->>OAI: JSON response
        OAI-->>E: BifrostChatResponse
        E-->>B: BifrostChatResponse
    end

    alt Streaming ChatCompletionStream
        E->>E: build authHeader from key.Value.GetValue()
        E->>OAI: HandleOpenAIChatCompletionStreaming(streamingClient, url, authHeader, ...)
        OAI->>API: POST /v3/chat/completions (SSE)
        API-->>OAI: chunked SSE stream
        OAI-->>E: chan BifrostStreamChunk
        E-->>B: chan BifrostStreamChunk
    end

    alt Responses (delegated)
        E->>E: request.ToChatRequest()
        E->>OAI: ChatCompletion(...)
        OAI-->>E: BifrostChatResponse
        E->>E: chatResponse.ToBifrostResponsesResponse()
        E-->>B: BifrostResponsesResponse
    end

    alt Unsupported operations
        E-->>B: BifrostError (unsupported_operation)
    end
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant C as Caller
    participant B as Bifrost Core
    participant E as edenaiProvider
    participant OAI as openai helpers
    participant API as api.edenai.run/v3

    C->>B: ChatCompletion / ChatCompletionStream
    B->>E: route via createBaseProvider (schemas.EdenAI)

    alt Unary ChatCompletion
        E->>OAI: HandleOpenAIChatCompletionRequest(client, url, key, ...)
        OAI->>API: POST /v3/chat/completions (Bearer key)
        API-->>OAI: JSON response
        OAI-->>E: BifrostChatResponse
        E-->>B: BifrostChatResponse
    end

    alt Streaming ChatCompletionStream
        E->>E: build authHeader from key.Value.GetValue()
        E->>OAI: HandleOpenAIChatCompletionStreaming(streamingClient, url, authHeader, ...)
        OAI->>API: POST /v3/chat/completions (SSE)
        API-->>OAI: chunked SSE stream
        OAI-->>E: chan BifrostStreamChunk
        E-->>B: chan BifrostStreamChunk
    end

    alt Responses (delegated)
        E->>E: request.ToChatRequest()
        E->>OAI: ChatCompletion(...)
        OAI-->>E: BifrostChatResponse
        E->>E: chatResponse.ToBifrostResponsesResponse()
        E-->>B: BifrostResponsesResponse
    end

    alt Unsupported operations
        E-->>B: BifrostError (unsupported_operation)
    end
Loading

Reviews (1): Last reviewed commit: "feat(providers): add Eden AI as an OpenA..." | Re-trigger Greptile

Comment on lines +29 to +43
func TestEdenAIUnsupportedOperations(t *testing.T) {
t.Parallel()

p := &edenaiProvider{}

if _, err := p.TextCompletion(nil, schemas.Key{}, nil); err == nil {
t.Error("expected TextCompletion to be unsupported")
}
if _, err := p.Embedding(nil, schemas.Key{}, nil); err == nil {
t.Error("expected Embedding to be unsupported")
}
if _, err := p.Speech(nil, schemas.Key{}, nil); err == nil {
t.Error("expected Speech to be unsupported")
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Sparse unsupported-operation coverage

Only 3 of the ~30 unsupported operations are asserted. If a future refactor accidentally wires one of the others (e.g. Embedding, Rerank, ImageGeneration) to a real implementation path, the test suite won't catch the regression. The repo pattern for new providers uses table-driven sweeps over all unsupported ops — e.g. looping over a slice of func() *schemas.BifrostError calls and asserting each returns non-nil. Also note that the repo's make test-core target runs the shared provider scenario suite; the PR description references bare go test ./core/providers/edenai/..., which skips that broader coverage.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
core/providers/edenai/edenai_live_test.go (1)

22-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider closing the provider's client after the test.

Other provider tests in core/providers/*_test.go call the client's shutdown/cleanup at the end of the test function to release the fasthttp client resources. This live test never calls any cleanup on provider.

Based on learnings: "In provider tests under core/providers//*_test.go, do not require or flag the use of defer for Shutdown(); instead call client.Shutdown() at the end of each test function."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@core/providers/edenai/edenai_live_test.go` around lines 22 - 27, The live
test creates an EdenAI provider but never releases its fasthttp client
resources. In edenai_live_test.go, make sure the test explicitly cleans up the
provider at the end of the test function, following the pattern used by other
core/providers/*_test.go tests, by calling the provider client shutdown/cleanup
method directly rather than leaving it open.

Source: Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@core/providers/edenai/edenai_live_test.go`:
- Around line 22-27: The live test creates an EdenAI provider but never releases
its fasthttp client resources. In edenai_live_test.go, make sure the test
explicitly cleans up the provider at the end of the test function, following the
pattern used by other core/providers/*_test.go tests, by calling the provider
client shutdown/cleanup method directly rather than leaving it open.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ff50c852-0402-492e-89da-a3d693578b42

📥 Commits

Reviewing files that changed from the base of the PR and between e21ae23 and ba3e3a7.

📒 Files selected for processing (9)
  • core/bifrost.go
  • core/providers/edenai/edenai.go
  • core/providers/edenai/edenai_live_test.go
  • core/providers/edenai/edenai_test.go
  • core/schemas/bifrost.go
  • docs/docs.json
  • docs/providers/supported-providers/edenai.mdx
  • docs/providers/supported-providers/overview.mdx
  • transports/config.schema.json

@R-droid101
R-droid101 self-requested a review July 7, 2026 14:17

@R-droid101 R-droid101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@R-droid101

Copy link
Copy Markdown
Collaborator

@MVS-source Thanks for taking the time to contribute this provider and for the effort you put into the PR!

After an internal review, we've decided to close this PR. Since this provider is fully OpenAI-compatible, it can already be integrated using Bifrost's Custom Provider configuration with OpenAI as the base provider type, so a dedicated provider implementation isn't necessary at this time.

We really appreciate your contribution and hope you'll continue contributing to Bifrost in the future. Thanks again!

@R-droid101 R-droid101 closed this Jul 7, 2026
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.

3 participants