Skip to main content
⚠️ IMPORTANT: Before developing an integration, thoroughly read the Request Flow Documentation and System Overview to understand:
  • HTTP transport layer architecture and request processing pipeline
  • Integration patterns and GenericRouter design
  • Error handling and response formatting
  • Security considerations and validation requirements

🏗️ Integration Structure Requirements

Each HTTP integration should be organized as follows:

Integration Testing Structure


🎯 Overview

HTTP integrations provide API-compatible endpoints that translate between external service formats (OpenAI, Anthropic, etc.) and Bifrost’s unified request/response format. Each integration follows a standardized pattern using Bifrost’s GenericRouter architecture. Key Feature: All integrations should support multi-provider model syntax using ParseModelString, allowing users to access any provider through any SDK (e.g., "anthropic/claude-3-sonnet" via OpenAI SDK).

Integration Architecture Flow


📋 Prerequisites

Required Skills

  • Go Programming - Proficient in Go interfaces and HTTP handling
  • API Design - Understanding of REST API patterns and HTTP standards
  • JSON Processing - Experience with JSON marshaling/unmarshaling
  • Testing - Python pytest experience for integration testing

Development Environment

  • Go 1.23+ - Latest Go version for integration development
  • Python 3.8+ - For integration testing with pytest
  • Bifrost Core - Understanding of Bifrost request/response schemas
  • Target SDK - SDK for the service you’re integrating (OpenAI, Anthropic, etc.)

🏗️ Integration Implementation

1. Route Configuration (router.go)

Define your integration routes using the GenericRouter pattern:

2. Type Definitions (types.go)

Define request/response types and conversion functions:

🧪 Testing Framework

Python Integration Tests

Create comprehensive tests using pytest and the target service’s SDK:

Test Configuration

Add your integration to the test configuration:

Advanced Integration Patterns

1. Multi-Endpoint Integration

Support multiple endpoints with different request/response formats:

2. Model Parameter Extraction

Extract model from URL parameters:

3. Custom Header Handling

Add service-specific headers and authentication:

4. Streaming Response Support

Handle streaming responses (if your service supports them):

📚 Integration Registration

Main Router Registration

Register your integration in the main HTTP transport by adding it to the extensions slice in transports/bifrost-http/main.go:

Import Requirements

Don’t forget to add the import for your integration:

Integration Checklist

Development Checklist

  • Router Implementation - Created router.go with route configurations
  • Type Definitions - Implemented types.go with request/response types
  • Request Conversion - Properly converts service format to Bifrost format
  • Response Conversion - Properly converts Bifrost format to service format
  • Multi-Provider Support - Uses ParseModelString to enable “provider/model” syntax
  • Error Handling - Handles all error cases gracefully
  • Tool Support - Supports function/tool calling if applicable
  • Multi-Modal Support - Supports images/vision if applicable
  • Streaming Support - Supports streaming responses if applicable

Testing Checklist

  • Python Test Suite - Created comprehensive pytest integration tests
  • All 11 Core Scenarios - Implemented all standard test cases
  • Service-Specific Tests - Added integration-specific test cases
  • Error Testing - Tests error handling and edge cases
  • Performance Testing - Validated latency and throughput
  • Configuration - Added to test configuration files

Documentation Checklist

  • API Documentation - Documented all supported endpoints
  • Usage Examples - Provided clear usage examples
  • Migration Guide - Created migration guide from direct service usage
  • Compatibility Notes - Documented any limitations or differences
  • Performance Metrics - Documented performance characteristics

Deployment Checklist

  • Configuration - Added to deployment configuration
  • Environment Variables - Documented required environment variables
  • Dependencies - Updated dependency management files
  • Health Checks - Implemented health check endpoints
  • Monitoring - Added metrics and logging

Common Patterns

Multi-Provider Model Support (same as shown above in the types.go file example)

Enable users to access multiple providers through your integration using ParseModelString:
Benefits for Users:
  • OpenAI SDK: model: "anthropic/claude-3-sonnet" routes to Anthropic
  • Anthropic SDK: model: "openai/gpt-4o" routes to OpenAI
  • Your SDK: model: "vertex/gemini-pro" routes to Google Vertex
  • Backward Compatible: model: "claude-3-sonnet" uses your default provider

Alternative: Pattern-Based Detection

For automatic provider detection without prefixes:

Content Type Handling

Handle different content types (text, images, tool calls):
Need Help? Check existing integrations in the codebase or ask for guidance in the development community!