For more information about this repository, visit the project page at https://www.drupal.org/project/ai_provider_bifrost
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-23 15:24:16 +02:00
.idea Initial commit 2026-07-23 15:06:38 +02:00
config Initial commit 2026-07-23 15:06:38 +02:00
definitions Initial commit 2026-07-23 15:06:38 +02:00
src Initial commit 2026-07-23 15:06:38 +02:00
tests/src/Unit Initial commit 2026-07-23 15:06:38 +02:00
.DS_Store Initial commit 2026-07-23 15:06:38 +02:00
ai_provider_bifrost.info.yml Initial commit 2026-07-23 15:06:38 +02:00
ai_provider_bifrost.links.menu.yml Initial commit 2026-07-23 15:06:38 +02:00
ai_provider_bifrost.routing.yml Initial commit 2026-07-23 15:06:38 +02:00
composer.json update maintainers. 2026-07-23 15:24:16 +02:00
README.md update maintainers. 2026-07-23 15:24:16 +02:00

Bifrost AI Provider

Introduction

This Drupal module provides an integration with Bifrost, a self-hosted LLM gateway that exposes an OpenAI-compatible API in front of multiple upstream model providers, with governance features such as virtual keys, budgets, and rate limits.

This module allows you to use Bifrost as an AI Provider for the AI (Artificial Intelligence) module, enabling you to leverage any model routed through your Bifrost deployment through a single, consistent API - without depending on any of the individual upstream provider modules.

Features

  • Provides an AI Provider plugin (bifrost) for the AI module's provider framework.
  • Configuration of the Bifrost host and virtual key via a standard admin form, with a live connectivity check on save.
  • Dynamically discovers models available through your Bifrost deployment - no static model list to maintain.
  • Supports chat, embeddings, text-to-image, text-to-speech and speech-to-text operation types (availability depends on what your Bifrost deployment actually routes to).

Requirements

  • Drupal 11 or later.
  • The AI (Artificial Intelligence) module.
  • The Key module (used to store the virtual key).
  • A running Bifrost gateway with a virtual key configured for the models you want to use.

Installation

  1. Install the module via Composer:
    composer require drupal/ai_provider_bifrost
    
  2. Enable the module.
  3. Configure it at /admin/config/ai/providers/ai_provider_bifrost:
    • Host: the base URL of your Bifrost deployment, including the /v1 suffix (e.g. https://bifrost.example.com/v1).
    • Virtual key: a Key module entity holding your Bifrost virtual key, sent as the x-bf-vk header on every request.

How model discovery works

Bifrost has no capability-metadata endpoint (no /model/info equivalent like some other gateways). Its /v1/models response is mixed-shape depending on which upstream provider a model is routed through:

  • Models routed through providers that themselves expose rich metadata (e.g. OpenRouter) carry an architecture block (input_modalities / output_modalities), which this module reads directly to determine capabilities.
  • Models routed through providers with no such metadata (e.g. Ollama) come back as a bare {id, created, owned_by}. For these, capability is inferred from the model id (e.g. an id containing embed is treated as an embeddings model rather than a chat model).
  • Model ids containing rerank are excluded from every operation type, since reranking isn't a supported AI module operation.

This means classification for non-OpenRouter-routed models is a best-effort heuristic, not an authoritative capability check - double check the model list under each operation type after configuring your virtual key.

AI-assisted development

This module's code and documentation were developed with the assistance of AI tooling (Anthropic's Claude, via Claude Code), based on the ai_provider_litellm module as a reference pattern. All AI-assisted output was reviewed, tested against a live Bifrost gateway, and verified by a human maintainer before release, in line with drupal.org's Policy on the use of AI when contributing to Drupal.

Contributing

Contributions are welcome! Please feel free to open an issue or submit a merge request.

Maintainers

Current maintainers: