feat(providers): add Eden AI as an OpenAI-compatible provider - #4894
feat(providers): add Eden AI as an OpenAI-compatible provider#4894MVS-source wants to merge 1 commit into
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds 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 ChangesEden AI Provider Integration
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
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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
9c966fb to
ba3e3a7
Compare
| 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") | ||
| } | ||
| } |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
🧹 Nitpick comments (1)
core/providers/edenai/edenai_live_test.go (1)
22-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider closing the provider's client after the test.
Other provider tests in
core/providers/*_test.gocall 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 onprovider.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
📒 Files selected for processing (9)
core/bifrost.gocore/providers/edenai/edenai.gocore/providers/edenai/edenai_live_test.gocore/providers/edenai/edenai_test.gocore/schemas/bifrost.godocs/docs.jsondocs/providers/supported-providers/edenai.mdxdocs/providers/supported-providers/overview.mdxtransports/config.schema.json
|
@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! |
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/v3base URL.Changes
core/providers/edenai: new provider package. Chat completions (+ streaming), Responses API (delegated to chat), and list models are supported; other operations returnunsupported_operation. Errors use the standard OpenAI envelope, so no custom parser is needed.EdenAIincore/schemas/bifrost.go(ModelProviderenum +StandardProviders) and in the provider factory incore/bifrost.go.transports/config.schema.json: addedenaito the provider config + base-provider enum.providers/supported-providers/edenaipage, an overview-table row, and the nav entry.Design note: Eden serves its OpenAI-compatible API under a
/v3base path (https://api.edenai.run/v3), so the chat path is/chat/completionsappended to that base (not/v1/...).Type of change
Affected areas
How to test
Verified locally:
go build ./...passes, unit tests pass, and the gated live test performs a real chat completion through the provider againstmistral/mistral-small-latest/openai/gpt-4o-miniand returns a valid response.Notes for the reviewer
EDENAI_API_KEYand 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).