Skip to main content
Since Langchain already provides multi-provider abstraction and chaining capabilities, Bifrost adds enterprise features like governance, semantic caching, MCP tools, observability, etc, on top of your existing setup. Endpoint: /langchain
Provider Compatibility: This integration only works for AI providers that both Langchain and Bifrost support. If you’re using a provider specific to Langchain that Bifrost doesn’t support (or vice versa), those requests will fail.

Setup


Provider/Model Usage Examples

Your existing Langchain provider switching works unchanged through Bifrost:

Adding Custom Headers

Add Bifrost-specific headers for governance and tracking. Different LangChain provider classes support different methods for adding custom headers:

ChatOpenAI

Use default_headers parameter for OpenAI models:

ChatAnthropic

Use default_headers parameter for Anthropic models:

ChatGoogleGenerativeAI

Use additional_headers parameter for Google/Gemini models:

ChatBedrockConverse

For Bedrock models, there are two approaches:Method 1: Using the client’s event system (after initialization)
Method 2: Pre-configuring a boto3 client

Reasoning/Thinking Models

Control extended reasoning capabilities for models that support thinking/reasoning modes.

Azure OpenAI Models

For Azure OpenAI reasoning models, use ChatOpenAI with the reasoning parameter and Azure-specific headers:

OpenAI Models

For OpenAI reasoning models, use ChatOpenAI with the reasoning parameter:

Bedrock Models (Anthropic & Nova)

Both Anthropic Claude and Amazon Nova models support reasoning/thinking capabilities via Bedrock. Use ChatBedrockConverse with model-specific configuration formats.

Anthropic Claude Models

Amazon Nova Models

Model-Specific Configuration:
  • Anthropic Claude models use reasoning_config (snake_case) with budget_tokens to control the token budget for reasoning
  • Amazon Nova models use reasoningConfig (camelCase) with maxReasoningEffort to control reasoning intensity (“low”, “medium”, “high”)

Google/Vertex AI Models

For Google Gemini 2.5 models (Pro, Flash) and Gemini 3, use ChatGoogleGenerativeAI with the thinking_budget parameter:
Experimental Module: ChatGoogleGenerativeAI is a recently released module that deprecates ChatVertexAI. It may have some issues or breaking changes. If you encounter problems, you can use ChatAnthropic with model="gemini/..." or model="vertex/..." as an alternative, which provides stable access to Gemini and Vertex AI models through Bifrost.

Embeddings

LangChain’s OpenAIEmbeddings class can be used to generate embeddings through Bifrost:
Provider Compatibility Limitation: LangChain’s OpenAIEmbeddings class converts text to int array before sending to the API. While OpenAI’s API supports both text strings and int arrays as input, other providers like Cohere, Bedrock, and Gemini only accept text strings.This means OpenAIEmbeddings only works reliably with OpenAI embedding models. Using it with other providers (e.g., model="cohere/embed-v4.0") will fail because those providers cannot process int array inputs.

Cross-Provider Embeddings

For embedding models from other providers (Cohere, Bedrock, Gemini, etc.), you can use GoogleGenerativeAIEmbeddings from the langchain_google_genai package. This module sends text strings directly and works across multiple providers:

Supported Features

The Langchain integration supports all features that are available in both the Langchain SDK and Bifrost core functionality. Your existing Langchain chains and workflows work seamlessly with Bifrost’s enterprise features. 😄

Next Steps