# Use LangChain with Bridge

URL: https://bridge.wekoya.tech/guides/langchain
Updated: 2026-11-08

**In short:** Use LangChain's `ChatOpenAI` with `base_url` set to Bridge's API and your Bridge key. In Python, also pass `use_responses_api=False` so every request uses Chat Completions. Then any Bridge model ID works: GPT, Claude, Gemini or open-source, billed in naira.

## Python

```bash
pip install langchain-openai
```

```python
import os
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="claude-sonnet-5-5",
    base_url="https://wekoya-api.wekoya.tech/v1",
    api_key=os.environ["WEKOYA_API_KEY"],
    use_responses_api=False,
)
print(llm.invoke("Hello").content)
```

Why `use_responses_api=False`: langchain-openai switches some models and options to OpenAI's Responses API on its own (for example GPT model IDs with tools). Bridge answers the Responses API too, but Chat Completions carries every Bridge option, so pinning it keeps behaviour the same on every model.

## JavaScript

```bash
npm install @langchain/openai
```

```javascript
import { ChatOpenAI } from "@langchain/openai"

const llm = new ChatOpenAI({
  model: "gemini-3.5-flash-lite",
  apiKey: process.env.WEKOYA_API_KEY,
  configuration: { baseURL: "https://wekoya-api.wekoya.tech/v1" },
})
console.log((await llm.invoke("Hello")).content)
```

Tool calling works with `bind_tools` (Python) or `bindTools` (JavaScript) on any model with tool calling. Checked against langchain-openai 1.7 and @langchain/openai 1.8 on 8 November 2026.

[Create a free account](https://bridge.wekoya.tech/sign-up)

## Common questions

**Does LangChain work with Claude through Bridge?**

Yes. Use ChatOpenAI with Bridge's base URL and a Claude model ID; you do not need langchain-anthropic.

**Do LangChain agents and tools work?**

Yes, on models with tool calling. Bridge uses OpenAI's tool format, which ChatOpenAI sends.

## Read next

- [LlamaIndex with Bridge](https://bridge.wekoya.tech/guides/llamaindex)
- [Vercel AI SDK with Bridge](https://bridge.wekoya.tech/guides/vercel-ai-sdk)
