LangChain (Python) with idapt
Found this helpful? Share it:
Found this helpful? Share it:
Set up LangChain (Python) against idapt's compatible APIs with the steps below. This article and the AI Gateway quickstarts lander render the same shared steps, so they never drift.
LangChain (Python) with idapt
ChatOpenAI with base_url pointed at idapt: every catalog model behind one key.
pip install langchain-openaifrom langchain_openai import ChatOpenAI
model = ChatOpenAI(
model="anthropic/claude-sonnet-5",
api_key=os.environ["IDAPT_API_KEY"],
base_url="https://idapt.app/api/openai/v1",
)Related articles
API keys and scopes
Create a key, choose its scopes, pin it to an API version, rotate it, and cap what it can spend.
Rate limits and errors
Every error shape the API returns, what each rate limit is, and how to handle a wall in code.
Cap what an API key spends
Give every Gateway API key a lifetime, monthly, or daily USD cap, and what a capped-out key returns.
OpenAI-compatible API
Use idapt's 200+ models from any app that speaks the OpenAI API format.
LangChain (JS) with idapt
Use LangChain JS with idapt: configure ChatOpenAI with a custom base URL and route any catalog model, tools included.
OpenAI SDK (Python) with idapt
Point the official OpenAI Python SDK at idapt's compatible API with base_url and run any catalog model unchanged.
LiteLLM with idapt
Configure LiteLLM to route through idapt's OpenAI-compatible API: SDK call and proxy config.yaml forms, one key for 200+ models.
Was this helpful?