/langchain
Setup
- Python
- JavaScript
Provider/Model Usage Examples
Your existing Langchain provider switching works unchanged through Bifrost:- Python
- JavaScript
Adding Custom Headers
Add Bifrost-specific headers for governance and tracking. Different LangChain provider classes support different methods for adding custom headers:- Python
- JavaScript
ChatOpenAI
Usedefault_headers parameter for OpenAI models:ChatAnthropic
Usedefault_headers parameter for Anthropic models:ChatGoogleGenerativeAI
Useadditional_headers parameter for Google/Gemini models:ChatBedrockConverse
For Bedrock models, there are two approaches:Method 1: Using the client’s event system (after initialization)Reasoning/Thinking Models
Control extended reasoning capabilities for models that support thinking/reasoning modes.Azure OpenAI Models
For Azure OpenAI reasoning models, useChatOpenAI with the reasoning parameter and Azure-specific headers:
- Python
- JavaScript
OpenAI Models
For OpenAI reasoning models, useChatOpenAI with the reasoning parameter:
- Python
- JavaScript
Bedrock Models (Anthropic & Nova)
Both Anthropic Claude and Amazon Nova models support reasoning/thinking capabilities via Bedrock. UseChatBedrockConverse with model-specific configuration formats.
Model-Specific Configuration:
- Anthropic Claude models use
reasoning_config(snake_case) withbudget_tokensto control the token budget for reasoning - Amazon Nova models use
reasoningConfig(camelCase) withmaxReasoningEffortto control reasoning intensity (“low”, “medium”, “high”)
Google/Vertex AI Models
For Google Gemini 2.5 models (Pro, Flash) and Gemini 3, useChatGoogleGenerativeAI with the thinking_budget parameter:
- Python
Embeddings
LangChain’sOpenAIEmbeddings class can be used to generate embeddings through Bifrost:
Cross-Provider Embeddings
For embedding models from other providers (Cohere, Bedrock, Gemini, etc.), you can useGoogleGenerativeAIEmbeddings 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
- Governance Features - Virtual keys and team management
- Semantic Caching - Intelligent response caching
- Configuration - Provider setup and API key management

