> ## Documentation Index
> Fetch the complete documentation index at: https://www.edenai.co/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Bifrost with Eden AI

> Add Eden AI to the Bifrost gateway as a custom OpenAI-compatible provider, so requests to edenai/provider/model reach 500+ models through one key.

**Use Bifrost with Eden AI**

Add Eden AI to the Bifrost gateway as a custom OpenAI-compatible provider, so requests to edenai/provider/model reach 500+ models through one key.

Bifrost has no built-in Eden AI provider, and it adds `/v1` to the base URL of an OpenAI-type provider, which Eden AI does not serve. This page adds Eden AI as a custom provider with the request paths set explicitly.

## Overview

[Bifrost](https://github.com/maximhq/bifrost) is an open-source LLM gateway (Go) that adds routing, fallbacks, load balancing and governance across providers. Eden AI exposes an OpenAI-compatible `/v3/chat/completions` endpoint, so you add it as a **Custom Provider** with `base_provider_type: openai` and path overrides. There is no build and no fork: you route to models from OpenAI, Anthropic, Google, Mistral and more behind one key.

## Prerequisites

* Docker, or Node.js to run `npx`
* An Eden AI API key from [app.edenai.run](https://app.edenai.run)

## Setup

### 1. Write the config

Bifrost reads `config.json` from its app directory at startup, so create it first. With Docker the app directory is the folder you mount, so save it as `data/config.json`. With `npx` it is `~/.config/bifrost` unless you pass `-app-dir`, as in the command below.

The `request_path_overrides` matter: without them Bifrost calls `https://api.edenai.run/v3/v1/chat/completions`, which does not exist.

```json config.json theme={null}
{
  "providers": {
    "edenai": {
      "keys": [
        { "name": "edenai-key", "value": "env.EDEN_AI_API_KEY", "models": ["*"], "weight": 1.0 }
      ],
      "network_config": { "base_url": "https://api.edenai.run/v3" },
      "custom_provider_config": {
        "base_provider_type": "openai",
        "allowed_requests": {
          "chat_completion": true,
          "chat_completion_stream": true,
          "embedding": true
        },
        "request_path_overrides": {
          "chat_completion": "/chat/completions",
          "chat_completion_stream": "/chat/completions",
          "embedding": "/embeddings"
        }
      }
    }
  }
}
```

### 2. Export your key and start Bifrost

The config reads `env.EDEN_AI_API_KEY` from Bifrost's environment. Export it, then start Bifrost. Docker needs `-e EDEN_AI_API_KEY` to pass it into the container:

```bash theme={null}
export EDEN_AI_API_KEY="YOUR_API_KEY"
```

```bash Docker theme={null}
docker run -e EDEN_AI_API_KEY -p 8080:8080 -v $(pwd)/data:/app/data maximhq/bifrost
```

```bash npx theme={null}
npx -y @maximhq/bifrost -app-dir ./data
```

You can also add the provider at runtime with `POST /api/providers` or from the Bifrost web UI under **Model Providers**, with no restart needed.

### 3. Send a request

```bash curl theme={null}
curl -X POST http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "edenai/openai/gpt-latest",
    "messages": [{"role": "user", "content": "Hello! How are you?"}]
  }'
```

## Model naming

Call any Eden AI model through Bifrost as `edenai/<provider>/<model>`. The `edenai/` prefix selects the Bifrost provider you configured, and the rest is Eden AI's own `provider/model` id, sent unchanged. For example:

* `edenai/openai/gpt-latest`
* `edenai/anthropic/claude-sonnet-latest`
* `edenai/vertex/gemini-flash-latest`

See [List LLM Models](https://www.edenai.co/docs/v3/llms/listing-models.md) for the catalog.

## Routing and fallbacks

Fallbacks, retries and weighted key selection are Bifrost features, not Eden AI's. See Bifrost's [retries and fallbacks](https://github.com/maximhq/bifrost/blob/transports/v2.3.2/docs/features/retries-and-fallbacks.mdx) and [key management](https://github.com/maximhq/bifrost/blob/transports/v2.3.2/docs/features/keys-management.mdx) docs.

* **Fallbacks**: pass a `fallbacks` array of `provider/model` strings in the request body. The fallback provider must be configured in Bifrost too. Fallbacks are tried in order if the first model fails.
* **Weighted keys**: give a provider several entries in `keys`, each with a `weight`, and Bifrost picks among them by weight.

```bash theme={null}
curl -X POST http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "edenai/openai/gpt-latest",
    "messages": [{"role": "user", "content": "Hello! How are you?"}],
    "fallbacks": ["edenai/anthropic/claude-sonnet-latest"]
  }'
```

Eden AI has its own server-side fallbacks and routing, described in [Provider routing](https://www.edenai.co/docs/v3/llms/provider-routing.md). The two are independent.

## Troubleshooting

### `404 Not Found` from the provider

The `request_path_overrides` are missing. Bifrost then calls `/v3/v1/chat/completions`. Add the overrides shown above.

### The model goes to another provider

Keep the `edenai/` prefix. A model id such as `openai/gpt-latest` without it is routed to Bifrost's own `openai` provider, not to Eden AI.

## Next Steps

* [Chat Completions](https://www.edenai.co/docs/v3/llms/chat-completions.md) - Core LLM endpoint
* [List LLM Models](https://www.edenai.co/docs/v3/llms/listing-models.md) - Browse available providers and models
* [OpenAI SDK (Python)](https://www.edenai.co/docs/v3/integrations/openai-sdk-python.md) - Direct SDK usage


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.