LangChain / LangGraph
Every LangChain chat model takes a base_url, and LangGraph inherits whatever model you pass it. Set the base URL to the gateway and calls route through it; Anthropic models keep their native protocol.
import os
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="gpt-4.1",
base_url="http://127.0.0.1:8787/w/my-service/openai/v1",
api_key=os.environ["OPENAI_API_KEY"],
)
llm.invoke("Why is the sky blue?")
# Anthropic models keep their native protocol (no translation):
# from langchain_anthropic import ChatAnthropic
# llm = ChatAnthropic(model="claude-sonnet-4-5", base_url="http://127.0.0.1:8787/w/my-service")Every LangChain chat model takes a base_url; LangGraph inherits whatever model you pass it.
Local vs. connected
The base URL above is the local proxy default (http://127.0.0.1:8787). Connected or managed use swaps in the cloud gateway URL and adds x-cave-api-key (gateway auth) plus x-cave-upstream-key (your per-request provider key) as request headers on the same client.